@principal-ai/principal-view-react 0.13.6 → 0.13.8

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/dist/components/GraphRenderer.d.ts +1 -15
  2. package/dist/components/GraphRenderer.d.ts.map +1 -1
  3. package/dist/components/GraphRenderer.js +94 -269
  4. package/dist/components/GraphRenderer.js.map +1 -1
  5. package/dist/components/NodeInfoPanel.d.ts.map +1 -1
  6. package/dist/components/NodeInfoPanel.js.map +1 -1
  7. package/dist/edges/CustomEdge.d.ts +2 -2
  8. package/dist/edges/CustomEdge.d.ts.map +1 -1
  9. package/dist/edges/CustomEdge.js +5 -4
  10. package/dist/edges/CustomEdge.js.map +1 -1
  11. package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
  12. package/dist/hooks/usePathBasedEvents.js +2 -1
  13. package/dist/hooks/usePathBasedEvents.js.map +1 -1
  14. package/dist/index.d.ts +0 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +0 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/nodes/CustomNode.d.ts +2 -2
  19. package/dist/nodes/CustomNode.d.ts.map +1 -1
  20. package/dist/nodes/CustomNode.js +41 -10
  21. package/dist/nodes/CustomNode.js.map +1 -1
  22. package/package.json +1 -1
  23. package/src/components/GraphRenderer.tsx +106 -354
  24. package/src/edges/CustomEdge.tsx +8 -7
  25. package/src/hooks/usePathBasedEvents.ts +2 -1
  26. package/src/index.ts +0 -6
  27. package/src/nodes/CustomNode.tsx +50 -13
  28. package/src/stories/ColorPriority.stories.tsx +256 -1
  29. package/src/stories/EventDrivenAnimations.stories.tsx +332 -326
  30. package/src/stories/GraphRenderer.stories.tsx +2 -2
  31. package/src/stories/NodeDefinitionComparison.stories.tsx +1 -1
  32. package/src/stories/NodeDimensionsTesting.stories.tsx +2 -2
  33. package/src/stories/OtelComponents.stories.tsx +0 -47
  34. package/src/stories/data/graph-converter-test-execution.json +244 -26
  35. package/src/stories/data/graph-converter-validated-execution.json +6 -6
  36. package/src/components/EdgeInfoPanel.tsx +0 -247
  37. package/src/components/NodeInfoPanel.tsx +0 -724
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { GraphRenderer } from '../components/GraphRenderer';
4
4
  import type { GraphRendererHandle, PendingChanges } from '../components/GraphRenderer';
5
- import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
5
+ import type { ExtendedCanvas, PVEventSchema } from '@principal-ai/principal-view-core';
6
6
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
7
7
 
8
8
  const meta = {
@@ -1629,7 +1629,7 @@ const HighlightedNodeSyncTemplate = () => {
1629
1629
 
1630
1630
  // Mock event registry to demonstrate resolveEventRef
1631
1631
  const resolveEventRef = (eventRef: string) => {
1632
- const eventRegistry: Record<string, any> = {
1632
+ const eventRegistry: Record<string, PVEventSchema> = {
1633
1633
  'user.clicked': {
1634
1634
  name: 'user.clicked',
1635
1635
  description: 'Triggered when a user clicks on an interactive element',
@@ -28,7 +28,7 @@ type Story = StoryObj<typeof meta>;
28
28
  */
29
29
  const SideBySideComparison: React.FC<{
30
30
  title: string;
31
- nodeDefinition: any;
31
+ nodeDefinition: Record<string, unknown>;
32
32
  canvas: ExtendedCanvas;
33
33
  description?: string;
34
34
  }> = ({ title, nodeDefinition, canvas, description }) => {
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { GraphRenderer } from '../components/GraphRenderer';
4
- import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
4
+ import type { ExtendedCanvas, ExtendedCanvasNode } from '@principal-ai/principal-view-core';
5
5
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
6
6
 
7
7
  const meta = {
@@ -61,7 +61,7 @@ const createGrid = (
61
61
  gapX = 40,
62
62
  gapY = 40
63
63
  ) => {
64
- const nodes: any[] = [];
64
+ const nodes: ExtendedCanvasNode[] = [];
65
65
 
66
66
  rows.forEach((row, rowIdx) => {
67
67
  cols.forEach((col, colIdx) => {
@@ -2,9 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react';
2
2
  import React from 'react';
3
3
  import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
4
4
  import { GraphRenderer } from '../components/GraphRenderer';
5
- import { NodeInfoPanel } from '../components/NodeInfoPanel';
6
5
  import { NodeTooltip } from '../components/NodeTooltip';
7
- import type { NodeState, NodeTypeDefinition } from '@principal-ai/principal-view-core';
8
6
 
9
7
  // OTEL Log Association canvas data
10
8
  const otelCanvas = {
@@ -353,48 +351,3 @@ Use \`config.json\` to customize.`}
353
351
  ),
354
352
  };
355
353
 
356
- /**
357
- * NodeInfoPanel with OTEL information section.
358
- */
359
- export const InfoPanelWithOtel: StoryObj = {
360
- render: () => {
361
- const selectedNode: NodeState = {
362
- id: 'log-router',
363
- type: 'otel-service',
364
- name: 'LogRouter',
365
- data: {
366
- description:
367
- 'Routes incoming OTEL logs to canvas nodes based on scope and resourceMatch criteria',
368
- otel: {
369
- kind: 'service',
370
- category: 'router',
371
- isNew: true,
372
- },
373
- icon: 'GitBranch',
374
- color: '#7ED321',
375
- sources: ['src/services/LogRouter.ts'],
376
- },
377
- position: { x: 0, y: 0 },
378
- createdAt: Date.now(),
379
- updatedAt: Date.now(),
380
- };
381
-
382
- const typeDefinition: NodeTypeDefinition = {
383
- shape: 'hexagon',
384
- color: '#7ED321',
385
- icon: 'GitBranch',
386
- };
387
-
388
- return (
389
- <ThemeProvider theme={defaultEditorTheme}>
390
- <div style={{ padding: '20px', position: 'relative', minHeight: '400px' }}>
391
- <h3 style={{ marginBottom: '20px' }}>NodeInfoPanel with OTEL Section</h3>
392
- <p style={{ marginBottom: '20px', color: '#666' }}>
393
- The panel shows the OpenTelemetry section with kind badge, category, and NEW indicator.
394
- </p>
395
- <NodeInfoPanel node={selectedNode} typeDefinition={typeDefinition} onClose={() => {}} />
396
- </div>
397
- </ThemeProvider>
398
- );
399
- },
400
- };
@@ -1,8 +1,226 @@
1
1
  [
2
2
  {
3
3
  "id": "span-1",
4
+ "name": "rules.lint.with.violations",
5
+ "startTime": 1772501743614,
6
+ "attributes": {
7
+ "span.kind": "test.case",
8
+ "test.name": "rules.lint.with.violations",
9
+ "test.framework": "bun",
10
+ "test.result": "pass"
11
+ },
12
+ "events": [
13
+ {
14
+ "time": 1772501743614,
15
+ "name": "test.started",
16
+ "attributes": {
17
+ "code.filepath": "rules-engine-instrumented.test.ts",
18
+ "code.lineno": 93,
19
+ "test.type": "integration",
20
+ "test.subject": "rules-engine"
21
+ }
22
+ },
23
+ {
24
+ "time": 1772501743614,
25
+ "name": "engine.creating",
26
+ "attributes": {
27
+ "code.filepath": "rules-engine-instrumented.test.ts",
28
+ "code.lineno": 99,
29
+ "engine.type": "default"
30
+ }
31
+ },
32
+ {
33
+ "time": 1772501743614,
34
+ "name": "engine.created",
35
+ "attributes": {
36
+ "code.filepath": "rules-engine-instrumented.test.ts",
37
+ "code.lineno": 104,
38
+ "engine.rules.count": 14
39
+ }
40
+ },
41
+ {
42
+ "time": 1772501743614,
43
+ "name": "lint.starting",
44
+ "attributes": {
45
+ "code.filepath": "rules-engine-instrumented.test.ts",
46
+ "code.lineno": 109,
47
+ "config.node.types.count": 3,
48
+ "config.edge.types.count": 2,
49
+ "config.connections.count": 1
50
+ }
51
+ },
52
+ {
53
+ "time": 1772501743618,
54
+ "name": "lint.completed",
55
+ "attributes": {
56
+ "code.filepath": "rules-engine-instrumented.test.ts",
57
+ "code.lineno": 119,
58
+ "result.violations.total": 6,
59
+ "result.violations.errors": 6,
60
+ "result.violations.warnings": 0,
61
+ "result.violations.fixable": 1
62
+ }
63
+ },
64
+ {
65
+ "time": 1772501743618,
66
+ "name": "violations.analyzed",
67
+ "attributes": {
68
+ "code.filepath": "rules-engine-instrumented.test.ts",
69
+ "code.lineno": 135,
70
+ "violation.required-metadata.found": true,
71
+ "violation.valid-color-format.found": true,
72
+ "violation.minimum-node-sources.found": true
73
+ }
74
+ }
75
+ ],
76
+ "status": "OK",
77
+ "endTime": 1772501743618,
78
+ "duration": 4
79
+ },
80
+ {
81
+ "id": "span-2",
82
+ "name": "rules.lint.valid.config",
83
+ "startTime": 1772501743618,
84
+ "attributes": {
85
+ "span.kind": "test.case",
86
+ "test.name": "rules.lint.valid.config",
87
+ "test.framework": "bun",
88
+ "test.result": "pass"
89
+ },
90
+ "events": [
91
+ {
92
+ "time": 1772501743618,
93
+ "name": "test.started",
94
+ "attributes": {
95
+ "code.filepath": "rules-engine-instrumented.test.ts",
96
+ "code.lineno": 153,
97
+ "test.type": "integration",
98
+ "test.subject": "rules-engine",
99
+ "test.expectation": "no-violations"
100
+ }
101
+ },
102
+ {
103
+ "time": 1772501743618,
104
+ "name": "lint.starting",
105
+ "attributes": {
106
+ "code.filepath": "rules-engine-instrumented.test.ts",
107
+ "code.lineno": 161,
108
+ "config.node.types.count": 1,
109
+ "config.edge.types.count": 1
110
+ }
111
+ },
112
+ {
113
+ "time": 1772501743619,
114
+ "name": "lint.completed",
115
+ "attributes": {
116
+ "code.filepath": "rules-engine-instrumented.test.ts",
117
+ "code.lineno": 170,
118
+ "result.violations.total": 0,
119
+ "result.violations.errors": 0,
120
+ "result.violations.warnings": 0
121
+ }
122
+ }
123
+ ],
124
+ "status": "OK",
125
+ "endTime": 1772501743619,
126
+ "duration": 1
127
+ },
128
+ {
129
+ "id": "span-3",
130
+ "name": "rules.lint.severity.override",
131
+ "startTime": 1772501743619,
132
+ "attributes": {
133
+ "span.kind": "test.case",
134
+ "test.name": "rules.lint.severity.override",
135
+ "test.framework": "bun",
136
+ "test.result": "pass"
137
+ },
138
+ "events": [
139
+ {
140
+ "time": 1772501743619,
141
+ "name": "test.started",
142
+ "attributes": {
143
+ "code.filepath": "rules-engine-instrumented.test.ts",
144
+ "code.lineno": 187,
145
+ "test.type": "integration",
146
+ "test.subject": "rules-engine-config"
147
+ }
148
+ },
149
+ {
150
+ "time": 1772501743619,
151
+ "name": "lint.starting",
152
+ "attributes": {
153
+ "code.filepath": "rules-engine-instrumented.test.ts",
154
+ "code.lineno": 194,
155
+ "config.has.violations": true,
156
+ "config.severity.override": "valid-color-format=warn"
157
+ }
158
+ },
159
+ {
160
+ "time": 1772501743619,
161
+ "name": "lint.completed",
162
+ "attributes": {
163
+ "code.filepath": "rules-engine-instrumented.test.ts",
164
+ "code.lineno": 207,
165
+ "result.violations.total": 6,
166
+ "violation.color.severity": "warn"
167
+ }
168
+ }
169
+ ],
170
+ "status": "OK",
171
+ "endTime": 1772501743619,
172
+ "duration": 0
173
+ },
174
+ {
175
+ "id": "span-4",
176
+ "name": "rules.lint.disabled.rules",
177
+ "startTime": 1772501743619,
178
+ "attributes": {
179
+ "span.kind": "test.case",
180
+ "test.name": "rules.lint.disabled.rules",
181
+ "test.framework": "bun",
182
+ "test.result": "pass"
183
+ },
184
+ "events": [
185
+ {
186
+ "time": 1772501743619,
187
+ "name": "test.started",
188
+ "attributes": {
189
+ "code.filepath": "rules-engine-instrumented.test.ts",
190
+ "code.lineno": 222,
191
+ "test.type": "integration",
192
+ "test.subject": "rules-engine-config"
193
+ }
194
+ },
195
+ {
196
+ "time": 1772501743619,
197
+ "name": "lint.starting",
198
+ "attributes": {
199
+ "code.filepath": "rules-engine-instrumented.test.ts",
200
+ "code.lineno": 229,
201
+ "config.disabled.rules": "valid-color-format,minimum-node-sources"
202
+ }
203
+ },
204
+ {
205
+ "time": 1772501743619,
206
+ "name": "lint.completed",
207
+ "attributes": {
208
+ "code.filepath": "rules-engine-instrumented.test.ts",
209
+ "code.lineno": 241,
210
+ "result.violations.total": 4,
211
+ "violation.color.disabled": true,
212
+ "violation.sources.disabled": true
213
+ }
214
+ }
215
+ ],
216
+ "status": "OK",
217
+ "endTime": 1772501743619,
218
+ "duration": 0
219
+ },
220
+ {
221
+ "id": "span-5",
4
222
  "name": "should convert simple config to nodes and edges",
5
- "startTime": 1772124586321,
223
+ "startTime": 1772501743878,
6
224
  "attributes": {
7
225
  "span.kind": "test.case",
8
226
  "test.name": "should convert simple config to nodes and edges",
@@ -13,7 +231,7 @@
13
231
  },
14
232
  "events": [
15
233
  {
16
- "time": 1772124586321,
234
+ "time": 1772501743878,
17
235
  "name": "setup.started",
18
236
  "attributes": {
19
237
  "code.filepath": "GraphConverter.test.ts",
@@ -22,7 +240,7 @@
22
240
  }
23
241
  },
24
242
  {
25
- "time": 1772124586321,
243
+ "time": 1772501743878,
26
244
  "name": "setup.complete",
27
245
  "attributes": {
28
246
  "code.filepath": "GraphConverter.test.ts",
@@ -32,7 +250,7 @@
32
250
  }
33
251
  },
34
252
  {
35
- "time": 1772124586321,
253
+ "time": 1772501743878,
36
254
  "name": "execution.started",
37
255
  "attributes": {
38
256
  "code.filepath": "GraphConverter.ts",
@@ -41,7 +259,7 @@
41
259
  }
42
260
  },
43
261
  {
44
- "time": 1772124586321,
262
+ "time": 1772501743878,
45
263
  "name": "execution.complete",
46
264
  "attributes": {
47
265
  "code.filepath": "GraphConverter.ts",
@@ -51,7 +269,7 @@
51
269
  }
52
270
  },
53
271
  {
54
- "time": 1772124586321,
272
+ "time": 1772501743878,
55
273
  "name": "assertion.started",
56
274
  "attributes": {
57
275
  "code.filepath": "GraphConverter.test.ts",
@@ -60,7 +278,7 @@
60
278
  }
61
279
  },
62
280
  {
63
- "time": 1772124586321,
281
+ "time": 1772501743878,
64
282
  "name": "assertion.complete",
65
283
  "attributes": {
66
284
  "code.filepath": "GraphConverter.test.ts",
@@ -71,13 +289,13 @@
71
289
  }
72
290
  ],
73
291
  "status": "OK",
74
- "endTime": 1772124586321,
292
+ "endTime": 1772501743878,
75
293
  "duration": 0
76
294
  },
77
295
  {
78
- "id": "span-2",
296
+ "id": "span-6",
79
297
  "name": "should extract manual positions from node types",
80
- "startTime": 1772124586321,
298
+ "startTime": 1772501743878,
81
299
  "attributes": {
82
300
  "span.kind": "test.case",
83
301
  "test.name": "should extract manual positions from node types",
@@ -88,7 +306,7 @@
88
306
  },
89
307
  "events": [
90
308
  {
91
- "time": 1772124586321,
309
+ "time": 1772501743878,
92
310
  "name": "setup.started",
93
311
  "attributes": {
94
312
  "code.filepath": "GraphConverter.test.ts",
@@ -97,7 +315,7 @@
97
315
  }
98
316
  },
99
317
  {
100
- "time": 1772124586321,
318
+ "time": 1772501743878,
101
319
  "name": "setup.complete",
102
320
  "attributes": {
103
321
  "code.filepath": "GraphConverter.test.ts",
@@ -107,7 +325,7 @@
107
325
  }
108
326
  },
109
327
  {
110
- "time": 1772124586321,
328
+ "time": 1772501743878,
111
329
  "name": "execution.started",
112
330
  "attributes": {
113
331
  "code.filepath": "GraphConverter.ts",
@@ -116,7 +334,7 @@
116
334
  }
117
335
  },
118
336
  {
119
- "time": 1772124586321,
337
+ "time": 1772501743878,
120
338
  "name": "execution.complete",
121
339
  "attributes": {
122
340
  "code.filepath": "GraphConverter.ts",
@@ -125,7 +343,7 @@
125
343
  }
126
344
  },
127
345
  {
128
- "time": 1772124586321,
346
+ "time": 1772501743878,
129
347
  "name": "assertion.started",
130
348
  "attributes": {
131
349
  "code.filepath": "GraphConverter.test.ts",
@@ -134,7 +352,7 @@
134
352
  }
135
353
  },
136
354
  {
137
- "time": 1772124586321,
355
+ "time": 1772501743878,
138
356
  "name": "assertion.complete",
139
357
  "attributes": {
140
358
  "code.filepath": "GraphConverter.test.ts",
@@ -145,13 +363,13 @@
145
363
  }
146
364
  ],
147
365
  "status": "OK",
148
- "endTime": 1772124586321,
366
+ "endTime": 1772501743878,
149
367
  "duration": 0
150
368
  },
151
369
  {
152
- "id": "span-3",
370
+ "id": "span-7",
153
371
  "name": "should handle nodes without positions",
154
- "startTime": 1772124586321,
372
+ "startTime": 1772501743878,
155
373
  "attributes": {
156
374
  "span.kind": "test.case",
157
375
  "test.name": "should handle nodes without positions",
@@ -162,7 +380,7 @@
162
380
  },
163
381
  "events": [
164
382
  {
165
- "time": 1772124586321,
383
+ "time": 1772501743878,
166
384
  "name": "setup.started",
167
385
  "attributes": {
168
386
  "code.filepath": "GraphConverter.test.ts",
@@ -171,7 +389,7 @@
171
389
  }
172
390
  },
173
391
  {
174
- "time": 1772124586321,
392
+ "time": 1772501743878,
175
393
  "name": "setup.complete",
176
394
  "attributes": {
177
395
  "code.filepath": "GraphConverter.test.ts",
@@ -181,7 +399,7 @@
181
399
  }
182
400
  },
183
401
  {
184
- "time": 1772124586321,
402
+ "time": 1772501743878,
185
403
  "name": "execution.started",
186
404
  "attributes": {
187
405
  "code.filepath": "GraphConverter.ts",
@@ -190,7 +408,7 @@
190
408
  }
191
409
  },
192
410
  {
193
- "time": 1772124586321,
411
+ "time": 1772501743878,
194
412
  "name": "execution.complete",
195
413
  "attributes": {
196
414
  "code.filepath": "GraphConverter.ts",
@@ -199,7 +417,7 @@
199
417
  }
200
418
  },
201
419
  {
202
- "time": 1772124586321,
420
+ "time": 1772501743878,
203
421
  "name": "assertion.started",
204
422
  "attributes": {
205
423
  "code.filepath": "GraphConverter.test.ts",
@@ -208,7 +426,7 @@
208
426
  }
209
427
  },
210
428
  {
211
- "time": 1772124586321,
429
+ "time": 1772501743878,
212
430
  "name": "assertion.complete",
213
431
  "attributes": {
214
432
  "code.filepath": "GraphConverter.test.ts",
@@ -219,7 +437,7 @@
219
437
  }
220
438
  ],
221
439
  "status": "OK",
222
- "endTime": 1772124586321,
440
+ "endTime": 1772501743878,
223
441
  "duration": 0
224
442
  }
225
443
  ]
@@ -2,7 +2,7 @@
2
2
  {
3
3
  "id": "span-1",
4
4
  "name": "graph conversion with validation",
5
- "startTime": 1772124586203,
5
+ "startTime": 1772390254917,
6
6
  "attributes": {
7
7
  "span.kind": "test.case",
8
8
  "test.name": "graph conversion with validation",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "events": [
14
14
  {
15
- "time": 1772124586203,
15
+ "time": 1772390254917,
16
16
  "name": "conversion.started",
17
17
  "attributes": {
18
18
  "code.filepath": "GraphConverter.ts",
@@ -22,7 +22,7 @@
22
22
  }
23
23
  },
24
24
  {
25
- "time": 1772124586203,
25
+ "time": 1772390254917,
26
26
  "name": "conversion.processingNodes",
27
27
  "attributes": {
28
28
  "code.filepath": "GraphConverter.ts",
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  {
34
- "time": 1772124586203,
34
+ "time": 1772390254917,
35
35
  "name": "conversion.processingEdges",
36
36
  "attributes": {
37
37
  "code.filepath": "GraphConverter.ts",
@@ -40,7 +40,7 @@
40
40
  }
41
41
  },
42
42
  {
43
- "time": 1772124586203,
43
+ "time": 1772390254917,
44
44
  "name": "conversion.complete",
45
45
  "attributes": {
46
46
  "code.filepath": "GraphConverter.ts",
@@ -52,7 +52,7 @@
52
52
  }
53
53
  ],
54
54
  "status": "OK",
55
- "endTime": 1772124586203,
55
+ "endTime": 1772390254917,
56
56
  "duration": 0
57
57
  }
58
58
  ]