@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,298 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomNode = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@xyflow/react");
6
+ const iconResolver_1 = require("../utils/iconResolver");
7
+ /**
8
+ * Custom node component for xyflow that renders based on NodeTypeDefinition
9
+ */
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ const CustomNode = ({ data, selected }) => {
12
+ const nodeProps = data;
13
+ const { typeDefinition, state, hasViolations, data: nodeData, animationType, animationDuration = 1000, editable = false, } = nodeProps;
14
+ // Guard against missing typeDefinition
15
+ if (!typeDefinition) {
16
+ return ((0, jsx_runtime_1.jsx)("div", { style: { padding: '10px', border: '2px solid red', borderRadius: '4px' }, children: (0, jsx_runtime_1.jsx)("div", { style: { fontSize: '12px', color: 'red' }, children: "Error: Missing node type definition" }) }));
17
+ }
18
+ // Get fill color based on state or default
19
+ // Priority: state color > node data color > type definition color > default
20
+ const nodeDataColor = nodeData.color;
21
+ const baseColor = nodeDataColor || typeDefinition.color || '#888';
22
+ const stateColor = state && typeDefinition.states?.[state]?.color;
23
+ const fillColor = stateColor || baseColor;
24
+ // Get stroke color - priority: node data stroke > type definition stroke > fill color
25
+ const nodeDataStroke = nodeData.stroke;
26
+ const strokeColor = nodeDataStroke || typeDefinition.stroke || fillColor;
27
+ // Use fillColor as the primary "color" for backwards compatibility
28
+ const color = fillColor;
29
+ // Get label from data schema
30
+ const labelField = Object.entries(typeDefinition.dataSchema).find(([, schema]) => schema.displayInLabel)?.[0];
31
+ const displayLabel = labelField && nodeData[labelField] ? String(nodeData[labelField]) : nodeProps.label;
32
+ // Icon priority: node data override > state icon > type definition icon
33
+ const icon = nodeData.icon
34
+ || (state && typeDefinition.states?.[state]?.icon)
35
+ || typeDefinition.icon;
36
+ // Get animation class based on type
37
+ const getAnimationClass = () => {
38
+ switch (animationType) {
39
+ case 'pulse':
40
+ return 'node-pulse';
41
+ case 'flash':
42
+ return 'node-flash';
43
+ case 'shake':
44
+ return 'node-shake';
45
+ case 'entry':
46
+ return 'node-entry';
47
+ default:
48
+ return '';
49
+ }
50
+ };
51
+ const animationClass = getAnimationClass();
52
+ // Shape-specific styles
53
+ const getShapeStyles = () => {
54
+ const baseStyles = {
55
+ padding: '12px 16px',
56
+ backgroundColor: 'white',
57
+ color: '#000',
58
+ border: `2px solid ${hasViolations ? '#D0021B' : strokeColor}`,
59
+ fontSize: '12px',
60
+ fontWeight: 500,
61
+ minWidth: typeDefinition.size?.width || 80,
62
+ minHeight: typeDefinition.size?.height || 40,
63
+ display: 'flex',
64
+ flexDirection: 'column',
65
+ alignItems: 'center',
66
+ justifyContent: 'center',
67
+ gap: '4px',
68
+ boxShadow: selected ? `0 0 0 2px ${strokeColor}` : '0 2px 4px rgba(0,0,0,0.1)',
69
+ transition: 'all 0.2s ease',
70
+ animationDuration: animationType ? `${animationDuration}ms` : undefined,
71
+ };
72
+ switch (typeDefinition.shape) {
73
+ case 'circle':
74
+ return {
75
+ ...baseStyles,
76
+ borderRadius: '50%',
77
+ width: typeDefinition.size?.width || 80,
78
+ height: typeDefinition.size?.height || 80,
79
+ padding: '8px',
80
+ };
81
+ case 'hexagon':
82
+ // Hexagon uses wrapper approach for proper border - styles returned here are for inner fill
83
+ // The outer border wrapper is rendered separately in the JSX
84
+ return {
85
+ ...baseStyles,
86
+ border: 'none', // Border handled by wrapper
87
+ clipPath: 'polygon(20% 0%, 80% 0%, 100% 50%, 80% 100%, 20% 100%, 0% 50%)',
88
+ width: '100%',
89
+ height: '100%',
90
+ minWidth: 'unset',
91
+ minHeight: 'unset',
92
+ padding: '8px 20px',
93
+ boxShadow: 'none', // Shadow handled by wrapper
94
+ };
95
+ case 'diamond':
96
+ // Rotated square - fixed dimensions for proper diamond shape
97
+ const diamondSize = typeDefinition.size?.width || 70;
98
+ return {
99
+ ...baseStyles,
100
+ transform: 'rotate(45deg)',
101
+ width: diamondSize,
102
+ height: diamondSize,
103
+ padding: '8px',
104
+ };
105
+ case 'rectangle':
106
+ default:
107
+ return {
108
+ ...baseStyles,
109
+ borderRadius: '8px',
110
+ };
111
+ }
112
+ };
113
+ const isDiamond = typeDefinition.shape === 'diamond';
114
+ const isHexagon = typeDefinition.shape === 'hexagon';
115
+ // Hexagon border wrapper styles (outer shape that acts as border)
116
+ // Hexagon with gentle diagonals
117
+ const hexagonClipPath = 'polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%)';
118
+ const hexagonBorderWidth = 2;
119
+ const hexagonBorderStyle = isHexagon ? {
120
+ position: 'relative',
121
+ clipPath: hexagonClipPath,
122
+ backgroundColor: hasViolations ? '#D0021B' : strokeColor,
123
+ width: typeDefinition.size?.width || 120,
124
+ height: typeDefinition.size?.height || 120,
125
+ boxShadow: selected ? `0 0 0 2px ${strokeColor}` : '0 2px 4px rgba(0,0,0,0.1)',
126
+ transition: 'all 0.2s ease',
127
+ } : {};
128
+ // Hexagon inner fill styles (white background inset from border)
129
+ const hexagonInnerStyle = isHexagon ? {
130
+ position: 'absolute',
131
+ top: hexagonBorderWidth,
132
+ left: hexagonBorderWidth,
133
+ right: hexagonBorderWidth,
134
+ bottom: hexagonBorderWidth,
135
+ clipPath: hexagonClipPath,
136
+ backgroundColor: 'white',
137
+ color: '#000',
138
+ display: 'flex',
139
+ flexDirection: 'column',
140
+ alignItems: 'center',
141
+ justifyContent: 'center',
142
+ fontSize: '12px',
143
+ fontWeight: 500,
144
+ gap: '4px',
145
+ } : {};
146
+ // Handle styles - larger and more visible in edit mode
147
+ const baseHandleStyle = editable ? {
148
+ background: color,
149
+ width: 12,
150
+ height: 12,
151
+ border: '2px solid white',
152
+ boxShadow: '0 0 0 1px ' + color,
153
+ } : {
154
+ background: color,
155
+ width: 8,
156
+ height: 8,
157
+ };
158
+ // Diamond handles need to be offset to reach the tips of the rotated shape
159
+ // A 45° rotated square has tips at ~41% beyond the original edges
160
+ const diamondOffset = isDiamond ? '21%' : '0';
161
+ const getHandleStyle = (position) => {
162
+ if (!isDiamond && !isHexagon)
163
+ return baseHandleStyle;
164
+ const offsetStyle = { ...baseHandleStyle };
165
+ if (isDiamond) {
166
+ switch (position) {
167
+ case 'top':
168
+ offsetStyle.top = `-${diamondOffset}`;
169
+ break;
170
+ case 'bottom':
171
+ offsetStyle.bottom = `-${diamondOffset}`;
172
+ break;
173
+ case 'left':
174
+ offsetStyle.left = `-${diamondOffset}`;
175
+ break;
176
+ case 'right':
177
+ offsetStyle.right = `-${diamondOffset}`;
178
+ break;
179
+ }
180
+ }
181
+ if (isHexagon) {
182
+ // Bring handles above the hexagon layers
183
+ offsetStyle.zIndex = 10;
184
+ }
185
+ return offsetStyle;
186
+ };
187
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Top, id: "top", style: getHandleStyle('top') }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Left, id: "left", style: getHandleStyle('left') }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "target", position: react_1.Position.Right, id: "right", style: getHandleStyle('right') }), isHexagon ? ((0, jsx_runtime_1.jsx)("div", { style: hexagonBorderStyle, className: animationClass, children: (0, jsx_runtime_1.jsxs)("div", { style: hexagonInnerStyle, children: [icon && (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, children: (0, iconResolver_1.resolveIcon)(icon, 20) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center', wordBreak: 'break-word' }, children: displayLabel }), state && ((0, jsx_runtime_1.jsx)("div", { style: {
188
+ fontSize: '10px',
189
+ backgroundColor: color,
190
+ color: 'white',
191
+ padding: '2px 6px',
192
+ borderRadius: '4px',
193
+ textAlign: 'center',
194
+ }, children: typeDefinition.states?.[state]?.label || state })), hasViolations && ((0, jsx_runtime_1.jsx)("div", { style: {
195
+ fontSize: '10px',
196
+ color: '#D0021B',
197
+ fontWeight: 'bold',
198
+ }, children: "\u26A0\uFE0F" }))] }) })) : ((0, jsx_runtime_1.jsx)("div", { style: getShapeStyles(), className: animationClass, children: (0, jsx_runtime_1.jsxs)("div", { style: isDiamond ? { transform: 'rotate(-45deg)' } : {}, children: [icon && (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, children: (0, iconResolver_1.resolveIcon)(icon, 20) }), (0, jsx_runtime_1.jsx)("div", { style: { textAlign: 'center', wordBreak: 'break-word' }, children: displayLabel }), state && ((0, jsx_runtime_1.jsx)("div", { style: {
199
+ fontSize: '10px',
200
+ backgroundColor: color,
201
+ color: 'white',
202
+ padding: '2px 6px',
203
+ borderRadius: '4px',
204
+ textAlign: 'center',
205
+ }, children: typeDefinition.states?.[state]?.label || state })), hasViolations && ((0, jsx_runtime_1.jsx)("div", { style: {
206
+ fontSize: '10px',
207
+ color: '#D0021B',
208
+ fontWeight: 'bold',
209
+ }, children: "\u26A0\uFE0F" }))] }) })), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "source", position: react_1.Position.Bottom, id: "bottom", style: getHandleStyle('bottom') }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "source", position: react_1.Position.Left, id: "left-out", style: getHandleStyle('left') }), (0, jsx_runtime_1.jsx)(react_1.Handle, { type: "source", position: react_1.Position.Right, id: "right-out", style: getHandleStyle('right') }), (0, jsx_runtime_1.jsx)("style", { children: `
210
+ /* Processing pulse - continuous breathing effect */
211
+ .node-pulse {
212
+ animation: node-pulse ease-in-out infinite;
213
+ }
214
+
215
+ @keyframes node-pulse {
216
+ 0%, 100% {
217
+ transform: scale(1);
218
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
219
+ }
220
+ 50% {
221
+ transform: scale(1.05);
222
+ box-shadow: 0 4px 12px rgba(0,0,0,0.2), 0 0 0 4px rgba(59, 130, 246, 0.3);
223
+ }
224
+ }
225
+
226
+ /* Success flash - brief green glow */
227
+ .node-flash {
228
+ animation: node-flash ease-out forwards;
229
+ }
230
+
231
+ @keyframes node-flash {
232
+ 0% {
233
+ box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.8);
234
+ background-color: rgba(34, 197, 94, 0.1);
235
+ }
236
+ 50% {
237
+ box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
238
+ background-color: rgba(34, 197, 94, 0.2);
239
+ }
240
+ 100% {
241
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
242
+ background-color: white;
243
+ }
244
+ }
245
+
246
+ /* Error shake - vibrate effect */
247
+ .node-shake {
248
+ animation: node-shake ease-in-out;
249
+ }
250
+
251
+ @keyframes node-shake {
252
+ 0%, 100% {
253
+ transform: translateX(0);
254
+ }
255
+ 10%, 30%, 50%, 70%, 90% {
256
+ transform: translateX(-4px);
257
+ }
258
+ 20%, 40%, 60%, 80% {
259
+ transform: translateX(4px);
260
+ }
261
+ }
262
+
263
+ /* Entry animation - scale up and fade in */
264
+ .node-entry {
265
+ animation: node-entry ease-out forwards;
266
+ }
267
+
268
+ @keyframes node-entry {
269
+ 0% {
270
+ opacity: 0;
271
+ transform: scale(0.8);
272
+ }
273
+ 100% {
274
+ opacity: 1;
275
+ transform: scale(1);
276
+ }
277
+ }
278
+
279
+ /* Special handling for diamond shape with shake */
280
+ .node-shake[style*="rotate(45deg)"] {
281
+ animation: node-shake-diamond ease-in-out;
282
+ }
283
+
284
+ @keyframes node-shake-diamond {
285
+ 0%, 100% {
286
+ transform: rotate(45deg) translateX(0);
287
+ }
288
+ 10%, 30%, 50%, 70%, 90% {
289
+ transform: rotate(45deg) translateX(-4px);
290
+ }
291
+ 20%, 40%, 60%, 80% {
292
+ transform: rotate(45deg) translateX(4px);
293
+ }
294
+ }
295
+ ` })] }));
296
+ };
297
+ exports.CustomNode = CustomNode;
298
+ //# sourceMappingURL=CustomNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomNode.js","sourceRoot":"","sources":["../../src/nodes/CustomNode.tsx"],"names":[],"mappings":";;;;AACA,yCAAiD;AAGjD,wDAAoD;AAepD;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAA6B,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;IACzE,MAAM,SAAS,GAAG,IAAsB,CAAC;IACzC,MAAM,EACJ,cAAc,EACd,KAAK,EACL,aAAa,EACb,IAAI,EAAE,QAAQ,EACd,aAAa,EACb,iBAAiB,GAAG,IAAI,EACxB,QAAQ,GAAG,KAAK,GACjB,GAAG,SAAS,CAAC;IAEd,uCAAuC;IACvC,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,CACL,gCAAK,KAAK,EAAE,E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AAI,CACR,gCAAK,KAAK,EAAE;gCACV,QAAQ,EAAE,MAAM;gCAChB,eAAe,EAAE,KAAK;gCACtB,KAAK,EAAE,OAAO;gCACd,OAAO,EAAE,SAAS;gCAClB,YAAY,EAAE,KAAK;gCACnB,SAAS,EAAE,QAAQ;6BACpB,YACE,cAAc,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,IAAI,KAAK,GAC3C,CACP,EACA,aAAa,IAAI,CAChB,gCAAK,KAAK,EAAE;gCACV,QAAQ,EAAE,MAAM;gCAChB,KAAK,EAAE,SAAS;gCAChB,UAAU,EAAE,MAAM;6BACnB,6BAEK,CACP,IACG,GACF,CACP,EAGD,uBAAC,cAAM,IACL,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,gBAAQ,CAAC,MAAM,EACzB,EAAE,EAAC,QAAQ,EACX,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,GAC/B,EACF,uBAAC,cAAM,IACL,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,gBAAQ,CAAC,IAAI,EACvB,EAAE,EAAC,UAAU,EACb,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,GAC7B,EACF,uBAAC,cAAM,IACL,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,gBAAQ,CAAC,KAAK,EACxB,EAAE,EAAC,WAAW,EACd,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,GAC9B,EAGF,4CAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsFP,GAAS,IACT,CACJ,CAAC;AACJ,CAAC,CAAC;AAxZW,QAAA,UAAU,cAwZrB"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { NodeTypeDefinition } from '@principal-ai/principal-view-core';
3
+ export interface GenericNodeProps {
4
+ /** Node ID */
5
+ id: string;
6
+ /** Node type definition from configuration */
7
+ typeDefinition: NodeTypeDefinition;
8
+ /** Node data */
9
+ data: Record<string, unknown>;
10
+ /** Current state (if applicable) */
11
+ state?: string;
12
+ /** Whether this node has violations */
13
+ hasViolations?: boolean;
14
+ }
15
+ /**
16
+ * Generic node renderer that adapts based on NodeTypeDefinition
17
+ * TODO: Implement different shapes, icons, and states
18
+ */
19
+ export declare const GenericNode: React.FC<GenericNodeProps>;
20
+ //# sourceMappingURL=GenericNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericNode.d.ts","sourceRoot":"","sources":["../../src/nodes/GenericNode.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,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9B,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6BlD,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GenericNode = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * Generic node renderer that adapts based on NodeTypeDefinition
7
+ * TODO: Implement different shapes, icons, and states
8
+ */
9
+ const GenericNode = ({ id, typeDefinition, state, hasViolations, }) => {
10
+ // Get color based on state or default
11
+ const color = state && typeDefinition.states?.[state]?.color
12
+ ? typeDefinition.states[state].color
13
+ : typeDefinition.color || '#888';
14
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
15
+ padding: '10px',
16
+ border: `2px solid ${hasViolations ? 'red' : color}`,
17
+ borderRadius: typeDefinition.shape === 'circle' ? '50%' : '4px',
18
+ backgroundColor: 'white',
19
+ minWidth: '60px',
20
+ textAlign: 'center',
21
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { fontSize: '12px', fontWeight: 'bold' }, children: id }), state && (0, jsx_runtime_1.jsx)("div", { style: { fontSize: '10px', color: '#666' }, children: state }), (0, jsx_runtime_1.jsxs)("div", { style: { fontSize: '10px' }, children: [(0, jsx_runtime_1.jsx)("strong", { children: "TODO:" }), " Render shapes, icons"] })] }));
22
+ };
23
+ exports.GenericNode = GenericNode;
24
+ //# sourceMappingURL=GenericNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericNode.js","sourceRoot":"","sources":["../../src/nodes/GenericNode.tsx"],"names":[],"mappings":";;;;AAoBA;;;GAGG;AACI,MAAM,WAAW,GAA+B,CAAC,EACtD,EAAE,EACF,cAAc,EACd,KAAK,EACL,aAAa,GACd,EAAE,EAAE;IACH,sCAAsC;IACtC,MAAM,KAAK,GAAG,KAAK,IAAI,cAAc,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK;QAC1D,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK;QACpC,CAAC,CAAC,cAAc,CAAC,KAAK,IAAI,MAAM,CAAC;IAEnC,OAAO,CACL,iCACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,aAAa,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE;YACpD,YAAY,EAAE,cAAc,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;YAC/D,eAAe,EAAE,OAAO;YACxB,QAAQ,EAAE,MAAM;YAChB,SAAS,EAAE,QAAQ;SACpB,aAED,gCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAG,EAAE,GAAO,EAC/D,KAAK,IAAI,gCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,YAAG,KAAK,GAAO,EACxE,iCAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,aAC9B,uDAAsB,6BAClB,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AA7BW,QAAA,WAAW,eA6BtB"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Animation mapping utilities
3
+ *
4
+ * Maps log levels and component events to appropriate animations
5
+ * for Milestone 1 default visualization behavior
6
+ */
7
+ import type { LogLevel } from '@principal-ai/principal-view-core';
8
+ /**
9
+ * Node animation configuration
10
+ */
11
+ export interface NodeAnimation {
12
+ type: 'pulse' | 'flash' | 'shake' | 'entry';
13
+ duration: number;
14
+ intensity?: number;
15
+ color?: string;
16
+ }
17
+ /**
18
+ * Edge animation configuration
19
+ */
20
+ export interface EdgeAnimation {
21
+ type: 'flow' | 'particle' | 'pulse' | 'glow';
22
+ duration: number;
23
+ direction?: 'forward' | 'backward' | 'bidirectional';
24
+ color?: string;
25
+ }
26
+ /**
27
+ * Map log level to node animation
28
+ *
29
+ * Default behavior for Milestone 1:
30
+ * - debug: subtle pulse (low intensity)
31
+ * - info: standard pulse (medium intensity)
32
+ * - warn: amber pulse (high intensity)
33
+ * - error: red flash + shake
34
+ */
35
+ export declare function logLevelToNodeAnimation(level: LogLevel): NodeAnimation;
36
+ /**
37
+ * Map component action to node animation (Milestone 2)
38
+ */
39
+ export declare function actionToNodeAnimation(_action: string, state?: string): NodeAnimation;
40
+ /**
41
+ * Get animation config for edge based on action (Milestone 2)
42
+ */
43
+ export declare function actionToEdgeAnimation(_action: string, edgeConfig?: EdgeAnimation): EdgeAnimation;
44
+ /**
45
+ * Check if log level should trigger animation
46
+ */
47
+ export declare function shouldAnimate(level: LogLevel, minLevel?: LogLevel): boolean;
48
+ /**
49
+ * Calculate animation intensity based on frequency
50
+ * Used to adjust animation intensity when multiple logs occur rapidly
51
+ */
52
+ export declare function calculateIntensity(baseIntensity: number, eventCount: number, _timeWindow?: number): number;
53
+ //# sourceMappingURL=animationMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animationMapping.d.ts","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,QAAQ,GAAG,aAAa,CAkCtE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,aAAa,CAiDf;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,aAAa,GACzB,aAAa,CAOf;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAE,QAAiB,GAAG,OAAO,CAMnF;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,MAAa,GACzB,MAAM,CAIR"}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ /**
3
+ * Animation mapping utilities
4
+ *
5
+ * Maps log levels and component events to appropriate animations
6
+ * for Milestone 1 default visualization behavior
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.logLevelToNodeAnimation = logLevelToNodeAnimation;
10
+ exports.actionToNodeAnimation = actionToNodeAnimation;
11
+ exports.actionToEdgeAnimation = actionToEdgeAnimation;
12
+ exports.shouldAnimate = shouldAnimate;
13
+ exports.calculateIntensity = calculateIntensity;
14
+ /**
15
+ * Map log level to node animation
16
+ *
17
+ * Default behavior for Milestone 1:
18
+ * - debug: subtle pulse (low intensity)
19
+ * - info: standard pulse (medium intensity)
20
+ * - warn: amber pulse (high intensity)
21
+ * - error: red flash + shake
22
+ */
23
+ function logLevelToNodeAnimation(level) {
24
+ switch (level) {
25
+ case 'debug':
26
+ return {
27
+ type: 'pulse',
28
+ duration: 800,
29
+ intensity: 0.3,
30
+ color: '#94a3b8' // slate-400
31
+ };
32
+ case 'info':
33
+ return {
34
+ type: 'pulse',
35
+ duration: 1000,
36
+ intensity: 0.5,
37
+ color: '#3b82f6' // blue-500
38
+ };
39
+ case 'warn':
40
+ return {
41
+ type: 'pulse',
42
+ duration: 1200,
43
+ intensity: 1.0,
44
+ color: '#f59e0b' // amber-500
45
+ };
46
+ case 'error':
47
+ return {
48
+ type: 'flash', // More dramatic animation for errors
49
+ duration: 1500,
50
+ intensity: 1.0,
51
+ color: '#ef4444' // red-500
52
+ };
53
+ }
54
+ }
55
+ /**
56
+ * Map component action to node animation (Milestone 2)
57
+ */
58
+ function actionToNodeAnimation(_action, state) {
59
+ // Default mapping - can be overridden by configuration
60
+ switch (state) {
61
+ case 'acquired':
62
+ case 'active':
63
+ case 'processing':
64
+ return {
65
+ type: 'pulse',
66
+ duration: 1000,
67
+ intensity: 0.8,
68
+ color: '#22c55e' // green-500
69
+ };
70
+ case 'waiting':
71
+ case 'pending':
72
+ return {
73
+ type: 'pulse',
74
+ duration: 1500,
75
+ intensity: 0.5,
76
+ color: '#eab308' // yellow-500
77
+ };
78
+ case 'error':
79
+ case 'failed':
80
+ return {
81
+ type: 'shake',
82
+ duration: 600,
83
+ intensity: 1.0,
84
+ color: '#ef4444' // red-500
85
+ };
86
+ case 'completed':
87
+ case 'success':
88
+ return {
89
+ type: 'flash',
90
+ duration: 800,
91
+ intensity: 0.7,
92
+ color: '#22c55e' // green-500
93
+ };
94
+ default:
95
+ // Generic action animation
96
+ return {
97
+ type: 'pulse',
98
+ duration: 1000,
99
+ intensity: 0.6,
100
+ color: '#3b82f6' // blue-500
101
+ };
102
+ }
103
+ }
104
+ /**
105
+ * Get animation config for edge based on action (Milestone 2)
106
+ */
107
+ function actionToEdgeAnimation(_action, edgeConfig) {
108
+ // Use edge config if provided, otherwise default
109
+ return edgeConfig || {
110
+ type: 'flow',
111
+ duration: 2000,
112
+ direction: 'forward'
113
+ };
114
+ }
115
+ /**
116
+ * Check if log level should trigger animation
117
+ */
118
+ function shouldAnimate(level, minLevel = 'info') {
119
+ const levels = ['debug', 'info', 'warn', 'error'];
120
+ const minIndex = levels.indexOf(minLevel);
121
+ const currentIndex = levels.indexOf(level);
122
+ return currentIndex >= minIndex;
123
+ }
124
+ /**
125
+ * Calculate animation intensity based on frequency
126
+ * Used to adjust animation intensity when multiple logs occur rapidly
127
+ */
128
+ function calculateIntensity(baseIntensity, eventCount, _timeWindow = 1000) {
129
+ // Reduce intensity if too many events in time window
130
+ const scaleFactor = Math.min(1.0, 5.0 / eventCount);
131
+ return Math.max(0.2, baseIntensity * scaleFactor);
132
+ }
133
+ //# sourceMappingURL=animationMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animationMapping.js","sourceRoot":"","sources":["../../src/utils/animationMapping.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAiCH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AG,CAAC,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC,CAAC;IACpD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,GAAG,WAAW,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type Node, type Edge } from '@xyflow/react';
2
+ import type { NodeState, EdgeState, GraphConfiguration, Violation } from '@principal-ai/principal-view-core';
3
+ import type { CustomNodeData } from '../nodes/CustomNode';
4
+ import type { CustomEdgeData } from '../edges/CustomEdge';
5
+ /**
6
+ * Convert our NodeState to xyflow Node format
7
+ */
8
+ export declare function convertToXYFlowNodes(nodes: NodeState[], configuration: GraphConfiguration, violations?: Violation[]): Node<CustomNodeData>[];
9
+ /** Extended edge state with optional handle information for ReactFlow */
10
+ export interface EdgeStateWithHandles extends EdgeState {
11
+ sourceHandle?: string;
12
+ targetHandle?: string;
13
+ }
14
+ /**
15
+ * Convert our EdgeState to xyflow Edge format
16
+ */
17
+ export declare function convertToXYFlowEdges(edges: (EdgeState | EdgeStateWithHandles)[], configuration: GraphConfiguration, violations?: Violation[]): Edge<CustomEdgeData>[];
18
+ /**
19
+ * Auto-layout nodes if they don't have positions
20
+ */
21
+ export declare function autoLayoutNodes<T extends Record<string, unknown>>(nodes: Node<T>[], edges: Edge[], layoutType?: 'hierarchical' | 'force-directed' | 'circular' | 'manual'): Node<T>[];
22
+ //# sourceMappingURL=graphConverter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphConverter.d.ts","sourceRoot":"","sources":["../../src/utils/graphConverter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC7G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CAwBxB;AAED,yEAAyE;AACzE,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,CAAC,SAAS,GAAG,oBAAoB,CAAC,EAAE,EAC3C,aAAa,EAAE,kBAAkB,EACjC,UAAU,GAAE,SAAS,EAAO,GAC3B,IAAI,CAAC,cAAc,CAAC,EAAE,CAoCxB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/D,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAChB,KAAK,EAAE,IAAI,EAAE,EACb,UAAU,GAAE,cAAc,GAAG,gBAAgB,GAAG,UAAU,GAAG,QAAyB,GACrF,IAAI,CAAC,CAAC,CAAC,EAAE,CAmBX"}