@principal-ai/principal-view-react 0.6.6

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 (96) hide show
  1. package/README.md +111 -0
  2. package/dist/components/ConfigurationSelector.d.ts +37 -0
  3. package/dist/components/ConfigurationSelector.d.ts.map +1 -0
  4. package/dist/components/ConfigurationSelector.js +67 -0
  5. package/dist/components/ConfigurationSelector.js.map +1 -0
  6. package/dist/components/EdgeInfoPanel.d.ts +16 -0
  7. package/dist/components/EdgeInfoPanel.d.ts.map +1 -0
  8. package/dist/components/EdgeInfoPanel.js +85 -0
  9. package/dist/components/EdgeInfoPanel.js.map +1 -0
  10. package/dist/components/EventLog.d.ts +20 -0
  11. package/dist/components/EventLog.d.ts.map +1 -0
  12. package/dist/components/EventLog.js +13 -0
  13. package/dist/components/EventLog.js.map +1 -0
  14. package/dist/components/EventLog.test.d.ts +2 -0
  15. package/dist/components/EventLog.test.d.ts.map +1 -0
  16. package/dist/components/EventLog.test.js +73 -0
  17. package/dist/components/EventLog.test.js.map +1 -0
  18. package/dist/components/GraphRenderer.d.ts +121 -0
  19. package/dist/components/GraphRenderer.d.ts.map +1 -0
  20. package/dist/components/GraphRenderer.js +809 -0
  21. package/dist/components/GraphRenderer.js.map +1 -0
  22. package/dist/components/GraphRenderer.test.d.ts +2 -0
  23. package/dist/components/GraphRenderer.test.d.ts.map +1 -0
  24. package/dist/components/GraphRenderer.test.js +88 -0
  25. package/dist/components/GraphRenderer.test.js.map +1 -0
  26. package/dist/components/MetricsDashboard.d.ts +14 -0
  27. package/dist/components/MetricsDashboard.d.ts.map +1 -0
  28. package/dist/components/MetricsDashboard.js +13 -0
  29. package/dist/components/MetricsDashboard.js.map +1 -0
  30. package/dist/components/NodeInfoPanel.d.ts +21 -0
  31. package/dist/components/NodeInfoPanel.d.ts.map +1 -0
  32. package/dist/components/NodeInfoPanel.js +217 -0
  33. package/dist/components/NodeInfoPanel.js.map +1 -0
  34. package/dist/edges/CustomEdge.d.ts +16 -0
  35. package/dist/edges/CustomEdge.d.ts.map +1 -0
  36. package/dist/edges/CustomEdge.js +200 -0
  37. package/dist/edges/CustomEdge.js.map +1 -0
  38. package/dist/edges/GenericEdge.d.ts +18 -0
  39. package/dist/edges/GenericEdge.d.ts.map +1 -0
  40. package/dist/edges/GenericEdge.js +14 -0
  41. package/dist/edges/GenericEdge.js.map +1 -0
  42. package/dist/hooks/usePathBasedEvents.d.ts +42 -0
  43. package/dist/hooks/usePathBasedEvents.d.ts.map +1 -0
  44. package/dist/hooks/usePathBasedEvents.js +122 -0
  45. package/dist/hooks/usePathBasedEvents.js.map +1 -0
  46. package/dist/index.d.ts +33 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +41 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/nodes/CustomNode.d.ts +18 -0
  51. package/dist/nodes/CustomNode.d.ts.map +1 -0
  52. package/dist/nodes/CustomNode.js +298 -0
  53. package/dist/nodes/CustomNode.js.map +1 -0
  54. package/dist/nodes/GenericNode.d.ts +20 -0
  55. package/dist/nodes/GenericNode.d.ts.map +1 -0
  56. package/dist/nodes/GenericNode.js +24 -0
  57. package/dist/nodes/GenericNode.js.map +1 -0
  58. package/dist/utils/animationMapping.d.ts +53 -0
  59. package/dist/utils/animationMapping.d.ts.map +1 -0
  60. package/dist/utils/animationMapping.js +133 -0
  61. package/dist/utils/animationMapping.js.map +1 -0
  62. package/dist/utils/graphConverter.d.ts +22 -0
  63. package/dist/utils/graphConverter.d.ts.map +1 -0
  64. package/dist/utils/graphConverter.js +176 -0
  65. package/dist/utils/graphConverter.js.map +1 -0
  66. package/dist/utils/iconResolver.d.ts +29 -0
  67. package/dist/utils/iconResolver.d.ts.map +1 -0
  68. package/dist/utils/iconResolver.js +68 -0
  69. package/dist/utils/iconResolver.js.map +1 -0
  70. package/package.json +61 -0
  71. package/src/components/ConfigurationSelector.tsx +147 -0
  72. package/src/components/EdgeInfoPanel.tsx +198 -0
  73. package/src/components/EventLog.test.tsx +85 -0
  74. package/src/components/EventLog.tsx +51 -0
  75. package/src/components/GraphRenderer.test.tsx +118 -0
  76. package/src/components/GraphRenderer.tsx +1222 -0
  77. package/src/components/MetricsDashboard.tsx +40 -0
  78. package/src/components/NodeInfoPanel.tsx +425 -0
  79. package/src/edges/CustomEdge.tsx +344 -0
  80. package/src/edges/GenericEdge.tsx +40 -0
  81. package/src/hooks/usePathBasedEvents.ts +182 -0
  82. package/src/index.ts +67 -0
  83. package/src/nodes/CustomNode.tsx +432 -0
  84. package/src/nodes/GenericNode.tsx +54 -0
  85. package/src/stories/AnimationWorkshop.stories.tsx +608 -0
  86. package/src/stories/EventDrivenAnimations.stories.tsx +499 -0
  87. package/src/stories/EventLog.stories.tsx +161 -0
  88. package/src/stories/GraphRenderer.stories.tsx +628 -0
  89. package/src/stories/Introduction.mdx +51 -0
  90. package/src/stories/MetricsDashboard.stories.tsx +227 -0
  91. package/src/stories/MultiConfig.stories.tsx +531 -0
  92. package/src/stories/MultiDirectionalConnections.stories.tsx +345 -0
  93. package/src/stories/NodeShapes.stories.tsx +769 -0
  94. package/src/utils/animationMapping.ts +170 -0
  95. package/src/utils/graphConverter.ts +218 -0
  96. package/src/utils/iconResolver.tsx +49 -0
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomEdge = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@xyflow/react");
7
+ /**
8
+ * Custom edge component for xyflow that renders based on EdgeTypeDefinition
9
+ */
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const CustomEdge = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, markerEnd, selected, }) => {
12
+ const edgeProps = data;
13
+ const { typeDefinition, hasViolations, data: edgeData, animationType, animationDuration = 1000, animationDirection = 'forward' } = edgeProps || {};
14
+ const [particlePosition, setParticlePosition] = (0, react_1.useState)(0);
15
+ const pathRef = (0, react_1.useRef)(null);
16
+ // Particle animation effect
17
+ (0, react_1.useEffect)(() => {
18
+ if (animationType !== 'particle')
19
+ return;
20
+ const animate = () => {
21
+ setParticlePosition((prev) => {
22
+ const next = prev + (100 / animationDuration) * 16; // ~60fps
23
+ return next >= 100 ? 0 : next;
24
+ });
25
+ };
26
+ const intervalId = setInterval(animate, 16);
27
+ return () => clearInterval(intervalId);
28
+ }, [animationType, animationDuration]);
29
+ // Early return after hooks
30
+ if (!typeDefinition) {
31
+ return null;
32
+ }
33
+ const color = hasViolations ? '#D0021B' : (typeDefinition.color || '#888');
34
+ const width = typeDefinition.width || 2;
35
+ // Get Bezier path
36
+ const [edgePath, labelX, labelY] = (0, react_2.getBezierPath)({
37
+ sourceX,
38
+ sourceY,
39
+ sourcePosition,
40
+ targetX,
41
+ targetY,
42
+ targetPosition,
43
+ });
44
+ // Style based on edge type
45
+ const getStrokeStyle = () => {
46
+ switch (typeDefinition.style) {
47
+ case 'dashed':
48
+ return '5 5';
49
+ case 'dotted':
50
+ return '2 2';
51
+ default:
52
+ return 'none';
53
+ }
54
+ };
55
+ // Label configuration
56
+ const labelConfig = typeDefinition.label;
57
+ const labelField = labelConfig?.field;
58
+ const labelText = labelField && edgeData?.[labelField] ? String(edgeData[labelField]) : '';
59
+ // Animation-specific rendering helpers
60
+ const getAnimationClass = () => {
61
+ if (!animationType) {
62
+ return typeDefinition.style === 'animated' ? 'edge-flow-forward' : '';
63
+ }
64
+ switch (animationType) {
65
+ case 'flow':
66
+ return animationDirection === 'backward'
67
+ ? 'edge-flow-backward'
68
+ : animationDirection === 'bidirectional'
69
+ ? 'edge-flow-bidirectional'
70
+ : 'edge-flow-forward';
71
+ case 'pulse':
72
+ return 'edge-pulse';
73
+ case 'glow':
74
+ return 'edge-glow';
75
+ default:
76
+ return '';
77
+ }
78
+ };
79
+ const getAnimationDurationStyle = () => {
80
+ if (!animationType)
81
+ return {};
82
+ return {
83
+ animationDuration: `${animationDuration}ms`,
84
+ };
85
+ };
86
+ // Calculate particle position along path using SVG path methods
87
+ const getParticleTransform = () => {
88
+ if (!pathRef.current) {
89
+ // Fallback to linear interpolation if path ref not available yet
90
+ const progress = animationDirection === 'backward' ? 1 - particlePosition / 100 : particlePosition / 100;
91
+ const x = sourceX + (targetX - sourceX) * progress;
92
+ const y = sourceY + (targetY - sourceY) * progress;
93
+ return { x, y };
94
+ }
95
+ // Use actual path to get point along the curve
96
+ const pathLength = pathRef.current.getTotalLength();
97
+ const progress = animationDirection === 'backward' ? 1 - particlePosition / 100 : particlePosition / 100;
98
+ const distance = pathLength * progress;
99
+ const point = pathRef.current.getPointAtLength(distance);
100
+ return { x: point.x, y: point.y };
101
+ };
102
+ const particlePos = animationType === 'particle' ? getParticleTransform() : null;
103
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("path", { ref: pathRef, d: edgePath, fill: "none", stroke: "transparent", strokeWidth: 0, style: { pointerEvents: 'none' } }), (0, jsx_runtime_1.jsx)("path", { d: edgePath, fill: "none", stroke: "transparent", strokeWidth: Math.max(width + 10, 20), style: { cursor: 'pointer' } }), (0, jsx_runtime_1.jsx)(react_2.BaseEdge, { id: id, path: edgePath, markerEnd: markerEnd, style: {
104
+ stroke: color,
105
+ strokeWidth: selected ? width + 2 : width,
106
+ strokeDasharray: getStrokeStyle(),
107
+ opacity: animationType ? 0.7 : 1,
108
+ cursor: 'pointer',
109
+ } }), animationType === 'flow' && ((0, jsx_runtime_1.jsx)("path", { d: edgePath, fill: "none", stroke: typeDefinition.animation?.color || color, strokeWidth: width, strokeDasharray: "10 5", className: getAnimationClass(), style: {
110
+ ...getAnimationDurationStyle(),
111
+ opacity: 0.8,
112
+ } })), animationType === 'pulse' && ((0, jsx_runtime_1.jsx)("path", { d: edgePath, fill: "none", stroke: typeDefinition.animation?.color || color, strokeWidth: width + 2, className: getAnimationClass(), style: {
113
+ ...getAnimationDurationStyle(),
114
+ } })), animationType === 'glow' && ((0, jsx_runtime_1.jsx)("path", { d: edgePath, fill: "none", stroke: typeDefinition.animation?.color || color, strokeWidth: width + 4, className: getAnimationClass(), style: {
115
+ ...getAnimationDurationStyle(),
116
+ filter: 'blur(3px)',
117
+ } })), animationType === 'particle' && particlePos && ((0, jsx_runtime_1.jsx)("circle", { cx: particlePos.x, cy: particlePos.y, r: width * 1.5, fill: typeDefinition.animation?.color || color, style: {
118
+ filter: 'drop-shadow(0 0 3px rgba(0,0,0,0.3))',
119
+ } })), !animationType && typeDefinition.style === 'animated' && ((0, jsx_runtime_1.jsx)("path", { d: edgePath, fill: "none", stroke: typeDefinition.animation?.color || color, strokeWidth: width, strokeDasharray: "5 5", className: "edge-flow-forward", style: {
120
+ animationDuration: '500ms',
121
+ } })), labelText && ((0, jsx_runtime_1.jsx)(react_2.EdgeLabelRenderer, { children: (0, jsx_runtime_1.jsx)("div", { style: {
122
+ position: 'absolute',
123
+ transform: `translate(-50%, -50%) translate(${labelX}px,${labelY}px)`,
124
+ backgroundColor: 'white',
125
+ padding: '2px 6px',
126
+ borderRadius: '4px',
127
+ fontSize: '10px',
128
+ fontWeight: 500,
129
+ border: `1px solid ${color}`,
130
+ pointerEvents: 'all',
131
+ }, className: "nodrag nopan", children: labelText }) })), (0, jsx_runtime_1.jsx)("style", { children: `
132
+ /* Flow animation - forward direction */
133
+ .edge-flow-forward {
134
+ animation: flow-forward linear infinite;
135
+ }
136
+
137
+ @keyframes flow-forward {
138
+ to {
139
+ stroke-dashoffset: -15;
140
+ }
141
+ }
142
+
143
+ /* Flow animation - backward direction */
144
+ .edge-flow-backward {
145
+ animation: flow-backward linear infinite;
146
+ }
147
+
148
+ @keyframes flow-backward {
149
+ to {
150
+ stroke-dashoffset: 15;
151
+ }
152
+ }
153
+
154
+ /* Flow animation - bidirectional (alternating) */
155
+ .edge-flow-bidirectional {
156
+ animation: flow-bidirectional linear infinite alternate;
157
+ }
158
+
159
+ @keyframes flow-bidirectional {
160
+ 0% {
161
+ stroke-dashoffset: -15;
162
+ }
163
+ 100% {
164
+ stroke-dashoffset: 15;
165
+ }
166
+ }
167
+
168
+ /* Pulse animation - wave effect */
169
+ .edge-pulse {
170
+ animation: pulse ease-in-out infinite;
171
+ }
172
+
173
+ @keyframes pulse {
174
+ 0%, 100% {
175
+ opacity: 0.3;
176
+ stroke-width: inherit;
177
+ }
178
+ 50% {
179
+ opacity: 1;
180
+ stroke-width: calc(inherit + 2);
181
+ }
182
+ }
183
+
184
+ /* Glow animation - brief highlight */
185
+ .edge-glow {
186
+ animation: glow ease-out forwards;
187
+ }
188
+
189
+ @keyframes glow {
190
+ 0% {
191
+ opacity: 1;
192
+ }
193
+ 100% {
194
+ opacity: 0;
195
+ }
196
+ }
197
+ ` })] }));
198
+ };
199
+ exports.CustomEdge = CustomEdge;
200
+ //# sourceMappingURL=CustomEdge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomEdge.js","sourceRoot":"","sources":["../../src/edges/CustomEdge.tsx"],"names":[],"mappings":";;;;AAAA,iCAA2D;AAC3D,yCAA2E;AAc3E;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAA6B,CAAC,EACnD,EAAE,EACF,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,IAAI,EACJ,SAAS,EACT,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,SAAS,GAAG,IAAkC,CAAC;IACrD,MAAM,EACJ,cAAc,EACd,aAAa,EACb,IAAI,EAAE,QAAQ,EACd,aAAa,EACb,iBAAiB,GAAG,IAAI,EACxB,kBAAkB,GAAG,SAAS,EAC/B,GAAG,SAAS,IAAK,EAAqB,CAAC;IAExC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAE7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+1,18 @@
1
+ import React from 'react';
2
+ import type { EdgeTypeDefinition } from '@principal-ai/principal-view-core';
3
+ export interface GenericEdgeProps {
4
+ /** Edge ID */
5
+ id: string;
6
+ /** Edge type definition from configuration */
7
+ typeDefinition: EdgeTypeDefinition;
8
+ /** Edge data */
9
+ data?: Record<string, unknown>;
10
+ /** Whether this edge has violations */
11
+ hasViolations?: boolean;
12
+ }
13
+ /**
14
+ * Generic edge renderer that adapts based on EdgeTypeDefinition
15
+ * TODO: Implement different styles, animations, and labels
16
+ */
17
+ export declare const GenericEdge: React.FC<GenericEdgeProps>;
18
+ //# sourceMappingURL=GenericEdge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericEdge.d.ts","sourceRoot":"","sources":["../../src/edges/GenericEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,WAAW,gBAAgB;IAC/B,cAAc;IACd,EAAE,EAAE,MAAM,CAAC;IAEX,8CAA8C;IAC9C,cAAc,EAAE,kBAAkB,CAAC;IAEnC,gBAAgB;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE/B,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAkBlD,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericEdge = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * Generic edge renderer that adapts based on EdgeTypeDefinition
7
+ * TODO: Implement different styles, animations, and labels
8
+ */
9
+ const GenericEdge = ({ id, typeDefinition, hasViolations, }) => {
10
+ const color = hasViolations ? 'red' : (typeDefinition.color || '#888');
11
+ return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { style: { fontSize: '10px', color }, children: ["Edge: ", id, " (", typeDefinition.style, ")"] }), (0, jsx_runtime_1.jsxs)("div", { style: { fontSize: '8px' }, children: [(0, jsx_runtime_1.jsx)("strong", { children: "TODO:" }), " Render in xyflow with proper styling"] })] }));
12
+ };
13
+ exports.GenericEdge = GenericEdge;
14
+ //# sourceMappingURL=GenericEdge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericEdge.js","sourceRoot":"","sources":["../../src/edges/GenericEdge.tsx"],"names":[],"mappings":";;;;AAiBA;;;GAGG;AACI,MAAM,WAAW,GAA+B,CAAC,EACtD,EAAE,EACF,cAAc,EACd,aAAa,GACd,EAAE,EAAE;IACH,MAAM,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC;IAEvE,OAAO,CACL,4CAEE,iCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,uBAC9B,EAAE,QAAI,cAAc,CAAC,KAAK,SAC7B,EACN,iCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,aAC7B,uDAAsB,6CAClB,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,WAAW,eAkBtB"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Hook for processing path-based events and mapping them to animations
3
+ *
4
+ * Handles ComponentActivityEvent and ComponentActionEvent from
5
+ * PathBasedEventProcessor (Milestone 1 & 2)
6
+ */
7
+ import type { PathBasedEvent } from '@principal-ai/principal-view-core';
8
+ import { type NodeAnimation, type EdgeAnimation } from '../utils/animationMapping';
9
+ /**
10
+ * Animation update callbacks
11
+ */
12
+ export interface AnimationCallbacks {
13
+ onNodeAnimation: (nodeId: string, animation: NodeAnimation & {
14
+ timestamp: number;
15
+ }) => void;
16
+ onEdgeAnimation: (edgeId: string, animation: EdgeAnimation & {
17
+ timestamp: number;
18
+ }) => void;
19
+ }
20
+ /**
21
+ * Hook options
22
+ */
23
+ export interface UsePathBasedEventsOptions {
24
+ /** Path-based events to process */
25
+ events: PathBasedEvent[];
26
+ /** Callbacks for triggering animations */
27
+ callbacks: AnimationCallbacks;
28
+ /** Optional callback when event is processed */
29
+ onEventProcessed?: (event: PathBasedEvent) => void;
30
+ /** Minimum log level to trigger animations (default: 'info') */
31
+ minLogLevel?: 'debug' | 'info' | 'warn' | 'error';
32
+ }
33
+ /**
34
+ * Process path-based events and trigger appropriate animations
35
+ */
36
+ export declare function usePathBasedEvents({ events, callbacks, onEventProcessed, minLogLevel }: UsePathBasedEventsOptions): void;
37
+ /**
38
+ * Process a batch of path-based events
39
+ * Useful for processing historical logs or bulk updates
40
+ */
41
+ export declare function processBatchEvents(events: PathBasedEvent[], callbacks: AnimationCallbacks, minLogLevel?: 'debug' | 'info' | 'warn' | 'error'): void;
42
+ //# sourceMappingURL=usePathBasedEvents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePathBasedEvents.d.ts","sourceRoot":"","sources":["../../src/hooks/usePathBasedEvents.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAIV,cAAc,EACf,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5F,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CAC7F;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,MAAM,EAAE,cAAc,EAAE,CAAC;IAEzB,0CAA0C;IAC1C,SAAS,EAAE,kBAAkB,CAAC;IAE9B,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAEnD,gEAAgE;IAChE,WAAW,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,WAAoB,EACrB,EAAE,yBAAyB,GAAG,IAAI,CA2ElC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EAAE,EACxB,SAAS,EAAE,kBAAkB,EAC7B,WAAW,GAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAgB,GACxD,IAAI,CAyCN"}
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ /**
3
+ * Hook for processing path-based events and mapping them to animations
4
+ *
5
+ * Handles ComponentActivityEvent and ComponentActionEvent from
6
+ * PathBasedEventProcessor (Milestone 1 & 2)
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.usePathBasedEvents = usePathBasedEvents;
10
+ exports.processBatchEvents = processBatchEvents;
11
+ const react_1 = require("react");
12
+ const animationMapping_1 = require("../utils/animationMapping");
13
+ /**
14
+ * Process path-based events and trigger appropriate animations
15
+ */
16
+ function usePathBasedEvents({ events, callbacks, onEventProcessed, minLogLevel = 'info' }) {
17
+ const { onNodeAnimation, onEdgeAnimation } = callbacks;
18
+ // Process component activity events (Milestone 1)
19
+ const processActivityEvent = (0, react_1.useCallback)((event) => {
20
+ // Map log level to animation
21
+ const animation = (0, animationMapping_1.logLevelToNodeAnimation)(event.level);
22
+ // Trigger node animation
23
+ onNodeAnimation(event.componentId, {
24
+ ...animation,
25
+ timestamp: event.timestamp
26
+ });
27
+ onEventProcessed?.(event);
28
+ }, [onNodeAnimation, onEventProcessed]);
29
+ // Process component action events (Milestone 2)
30
+ const processActionEvent = (0, react_1.useCallback)((event) => {
31
+ // Map action/state to animation
32
+ const animation = (0, animationMapping_1.actionToNodeAnimation)(event.action, event.state);
33
+ // Trigger node animation
34
+ onNodeAnimation(event.componentId, {
35
+ ...animation,
36
+ timestamp: event.timestamp
37
+ });
38
+ onEventProcessed?.(event);
39
+ }, [onNodeAnimation, onEventProcessed]);
40
+ // Process edge animation events (Milestone 2)
41
+ const processEdgeAnimationEvent = (0, react_1.useCallback)((event) => {
42
+ const animation = (0, animationMapping_1.actionToEdgeAnimation)(event.triggeredBy?.action || 'unknown', {
43
+ type: event.animation,
44
+ duration: event.duration,
45
+ direction: event.direction
46
+ });
47
+ onEdgeAnimation(event.edgeId, {
48
+ ...animation,
49
+ timestamp: event.timestamp
50
+ });
51
+ onEventProcessed?.(event);
52
+ }, [onEdgeAnimation, onEventProcessed]);
53
+ // Process events when they change
54
+ (0, react_1.useEffect)(() => {
55
+ if (events.length === 0)
56
+ return;
57
+ // Process the latest event
58
+ const latestEvent = events[events.length - 1];
59
+ switch (latestEvent.type) {
60
+ case 'component-activity':
61
+ // Milestone 1: Component activity from log
62
+ // Check if log level is high enough to trigger animation
63
+ const levels = ['debug', 'info', 'warn', 'error'];
64
+ if (levels.indexOf(latestEvent.level) >= levels.indexOf(minLogLevel)) {
65
+ processActivityEvent(latestEvent);
66
+ }
67
+ break;
68
+ case 'component-action':
69
+ // Milestone 2: Specific action from pattern match
70
+ processActionEvent(latestEvent);
71
+ break;
72
+ case 'edge-animation':
73
+ // Milestone 2: Edge activation from action trigger
74
+ processEdgeAnimationEvent(latestEvent);
75
+ break;
76
+ }
77
+ }, [events, processActivityEvent, processActionEvent, processEdgeAnimationEvent, minLogLevel]);
78
+ }
79
+ /**
80
+ * Process a batch of path-based events
81
+ * Useful for processing historical logs or bulk updates
82
+ */
83
+ function processBatchEvents(events, callbacks, minLogLevel = 'info') {
84
+ const levels = ['debug', 'info', 'warn', 'error'];
85
+ const minLevelIndex = levels.indexOf(minLogLevel);
86
+ for (const event of events) {
87
+ switch (event.type) {
88
+ case 'component-activity':
89
+ if (levels.indexOf(event.level) >= minLevelIndex) {
90
+ const animation = (0, animationMapping_1.logLevelToNodeAnimation)(event.level);
91
+ callbacks.onNodeAnimation(event.componentId, {
92
+ ...animation,
93
+ timestamp: event.timestamp
94
+ });
95
+ }
96
+ break;
97
+ case 'component-action':
98
+ {
99
+ const animation = (0, animationMapping_1.actionToNodeAnimation)(event.action, event.state);
100
+ callbacks.onNodeAnimation(event.componentId, {
101
+ ...animation,
102
+ timestamp: event.timestamp
103
+ });
104
+ }
105
+ break;
106
+ case 'edge-animation':
107
+ {
108
+ const animation = (0, animationMapping_1.actionToEdgeAnimation)(event.triggeredBy?.action || 'unknown', {
109
+ type: event.animation,
110
+ duration: event.duration,
111
+ direction: event.direction
112
+ });
113
+ callbacks.onEdgeAnimation(event.edgeId, {
114
+ ...animation,
115
+ timestamp: event.timestamp
116
+ });
117
+ }
118
+ break;
119
+ }
120
+ }
121
+ }
122
+ //# sourceMappingURL=usePathBasedEvents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePathBasedEvents.js","sourceRoot":"","sources":["../../src/hooks/usePathBasedEvents.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA6CH,gDAgFC;AAMD,gDA6CC;AA9KD,iCAA+C;AAO/C,gEAMmC;AA2BnC;;GAEG;AACH,SAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,WAAW,GAAG,MAAM,EACM;IAC1B,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC;IAEvD,kDAAkD;IAClD,MAAM,oBAAoB,GAAG,IAAA,mBAAW,EAAC,CAAC,KAA6B,EAAE,EAAE;QACzE,6BAA6B;QAC7B,MAAM,SAAS,GAAG,IAAA,0CA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gBACvB,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,aAAa,EAAE,CAAC;oBACjD,MAAM,SAAS,GAAG,IAAA,0CAAuB,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACvD,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE;wBAC3C,GAAG,SAAS;wBACZ,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,CAAC,CAAC;gBACL,CAAC;gBACD,MAAM;YAER,KAAK,kBAAkB;gBACrB,CAAC;oBACC,MAAM,SAAS,GAAG,IAAA,wCAAqB,EAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;oBACnE,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,EAAE;wBAC3C,GAAG,SAAS;wBACZ,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,CAAC,CAAC;gBACL,CAAC;gBACD,MAAM;YAER,KAAK,gBAAgB;gBACnB,CAAC;oBACC,MAAM,SAAS,GAAG,IAAA,wCAAqB,EAAC,KAAK,CAAC,WAAW,EAAE,MAAM,IAAI,SAAS,EAAE;wBAC9E,IAAI,EAAE,KAAK,CAAC,SAAS;wBACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ;wBACxB,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,CAAC,CAAC;oBACH,SAAS,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE;wBACtC,GAAG,SAAS;wBACZ,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,CAAC,CAAC;gBACL,CAAC;gBACD,MAAM;QACV,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @principal-ai/visual-validation-react
3
+ * React components for graph-based visual validation framework
4
+ *
5
+ * This library provides UI building blocks for creating graph visualization panels.
6
+ * The actual "panel" application should be built separately using these components.
7
+ */
8
+ export type { GraphConfiguration, GraphEvent, GraphMetrics, Violation, Warning, ValidationResult, EventStream, NodeTypeDefinition, EdgeTypeDefinition, ConnectionRule, NodeState, EdgeState, ConfigurationFile, ConfigurationLoadResult, ComponentLibrary, LibraryNodeComponent, LibraryEdgeComponent, } from '@principal-ai/principal-view-core';
9
+ export { GraphRenderer } from './components/GraphRenderer';
10
+ export type { GraphRendererProps, GraphRendererHandle, NodePositionChange, PendingChanges } from './components/GraphRenderer';
11
+ export { EventLog } from './components/EventLog';
12
+ export type { EventLogProps } from './components/EventLog';
13
+ export { MetricsDashboard } from './components/MetricsDashboard';
14
+ export type { MetricsDashboardProps } from './components/MetricsDashboard';
15
+ export { EdgeInfoPanel } from './components/EdgeInfoPanel';
16
+ export type { EdgeInfoPanelProps } from './components/EdgeInfoPanel';
17
+ export { NodeInfoPanel } from './components/NodeInfoPanel';
18
+ export type { NodeInfoPanelProps } from './components/NodeInfoPanel';
19
+ export { ConfigurationSelector } from './components/ConfigurationSelector';
20
+ export type { ConfigurationSelectorProps } from './components/ConfigurationSelector';
21
+ export { GenericNode } from './nodes/GenericNode';
22
+ export type { GenericNodeProps } from './nodes/GenericNode';
23
+ export { CustomNode } from './nodes/CustomNode';
24
+ export type { CustomNodeData } from './nodes/CustomNode';
25
+ export { GenericEdge } from './edges/GenericEdge';
26
+ export type { GenericEdgeProps } from './edges/GenericEdge';
27
+ export { CustomEdge } from './edges/CustomEdge';
28
+ export type { CustomEdgeData } from './edges/CustomEdge';
29
+ export { convertToXYFlowNodes, convertToXYFlowEdges, autoLayoutNodes } from './utils/graphConverter';
30
+ export type { EdgeStateWithHandles } from './utils/graphConverter';
31
+ export { Icon, resolveIcon } from './utils/iconResolver';
32
+ export type { IconProps } from './utils/iconResolver';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,kBAAkB,EAClB,UAAU,E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AE,MAAM,oBAAoB,CAAC;AAChD,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGzD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACrG,YAAY,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ /**
3
+ * @principal-ai/visual-validation-react
4
+ * React components for graph-based visual validation framework
5
+ *
6
+ * This library provides UI building blocks for creating graph visualization panels.
7
+ * The actual "panel" application should be built separately using these components.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.resolveIcon = exports.Icon = exports.autoLayoutNodes = exports.convertToXYFlowEdges = exports.convertToXYFlowNodes = exports.CustomEdge = exports.GenericEdge = exports.CustomNode = exports.GenericNode = exports.ConfigurationSelector = exports.NodeInfoPanel = exports.EdgeInfoPanel = exports.MetricsDashboard = exports.EventLog = exports.GraphRenderer = void 0;
11
+ // Export components
12
+ var GraphRenderer_1 = require("./components/GraphRenderer");
13
+ Object.defineProperty(exports, "GraphRenderer", { enumerable: true, get: function () { return GraphRenderer_1.GraphRenderer; } });
14
+ var EventLog_1 = require("./components/EventLog");
15
+ Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return EventLog_1.EventLog; } });
16
+ var MetricsDashboard_1 = require("./components/MetricsDashboard");
17
+ Object.defineProperty(exports, "MetricsDashboard", { enumerable: true, get: function () { return MetricsDashboard_1.MetricsDashboard; } });
18
+ var EdgeInfoPanel_1 = require("./components/EdgeInfoPanel");
19
+ Object.defineProperty(exports, "EdgeInfoPanel", { enumerable: true, get: function () { return EdgeInfoPanel_1.EdgeInfoPanel; } });
20
+ var NodeInfoPanel_1 = require("./components/NodeInfoPanel");
21
+ Object.defineProperty(exports, "NodeInfoPanel", { enumerable: true, get: function () { return NodeInfoPanel_1.NodeInfoPanel; } });
22
+ var ConfigurationSelector_1 = require("./components/ConfigurationSelector");
23
+ Object.defineProperty(exports, "ConfigurationSelector", { enumerable: true, get: function () { return ConfigurationSelector_1.ConfigurationSelector; } });
24
+ // Export node/edge renderers
25
+ var GenericNode_1 = require("./nodes/GenericNode");
26
+ Object.defineProperty(exports, "GenericNode", { enumerable: true, get: function () { return GenericNode_1.GenericNode; } });
27
+ var CustomNode_1 = require("./nodes/CustomNode");
28
+ Object.defineProperty(exports, "CustomNode", { enumerable: true, get: function () { return CustomNode_1.CustomNode; } });
29
+ var GenericEdge_1 = require("./edges/GenericEdge");
30
+ Object.defineProperty(exports, "GenericEdge", { enumerable: true, get: function () { return GenericEdge_1.GenericEdge; } });
31
+ var CustomEdge_1 = require("./edges/CustomEdge");
32
+ Object.defineProperty(exports, "CustomEdge", { enumerable: true, get: function () { return CustomEdge_1.CustomEdge; } });
33
+ // Export utilities
34
+ var graphConverter_1 = require("./utils/graphConverter");
35
+ Object.defineProperty(exports, "convertToXYFlowNodes", { enumerable: true, get: function () { return graphConverter_1.convertToXYFlowNodes; } });
36
+ Object.defineProperty(exports, "convertToXYFlowEdges", { enumerable: true, get: function () { return graphConverter_1.convertToXYFlowEdges; } });
37
+ Object.defineProperty(exports, "autoLayoutNodes", { enumerable: true, get: function () { return graphConverter_1.autoLayoutNodes; } });
38
+ var iconResolver_1 = require("./utils/iconResolver");
39
+ Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return iconResolver_1.Icon; } });
40
+ Object.defineProperty(exports, "resolveIcon", { enumerable: true, get: function () { return iconResolver_1.resolveIcon; } });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAwBH,oBAAoB;AACpB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AAGtB,kDAAiD;AAAxC,oGAAA,QAAQ,OAAA;AAGjB,kEAAiE;AAAxD,oHAAA,gBAAgB,OAAA;AAGzB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AAGtB,4DAA2D;AAAlD,8GAAA,aAAa,OAAA;AAGtB,4EAA2E;AAAlE,8HAAA,qBAAqB,OAAA;AAG9B,6BAA6B;AAC7B,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAGpB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AAGnB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AAGpB,iDAAgD;AAAvC,wGAAA,UAAU,OAAA;AAGnB,mBAAmB;AACnB,yDAAqG;AAA5F,sHAAA,oBAAoB,OAAA;AAAE,sHAAA,oBAAoB,OAAA;AAAE,iHAAA,eAAe,OAAA;AAEpE,qDAAyD;AAAhD,oGAAA,IAAI,OAAA;AAAE,2GAAA,WAAW,OAAA"}
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import type { NodeProps } from '@xyflow/react';
3
+ import type { NodeTypeDefinition } from '@principal-ai/principal-view-core';
4
+ export interface CustomNodeData extends Record<string, unknown> {
5
+ label: string;
6
+ typeDefinition: NodeTypeDefinition;
7
+ state?: string;
8
+ hasViolations?: boolean;
9
+ data: Record<string, unknown>;
10
+ animationType?: 'pulse' | 'flash' | 'shake' | 'entry' | null;
11
+ animationDuration?: number;
12
+ editable?: boolean;
13
+ }
14
+ /**
15
+ * Custom node component for xyflow that renders based on NodeTypeDefinition
16
+ */
17
+ export declare const CustomNode: React.FC<NodeProps<any>>;
18
+ //# sourceMappingURL=CustomNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomNode.d.ts","sourceRoot":"","sources":["../../src/nodes/CustomNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAG5E,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,kBAAkB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9B,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,IAAI,CAAC;IAC7D,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AAEH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAwZ/C,CAAC"}