@principal-ai/principal-view-react 0.7.15 → 0.7.17
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.
- package/README.md +9 -24
- package/dist/components/ConfigurationSelector.d.ts +1 -1
- package/dist/components/ConfigurationSelector.d.ts.map +1 -1
- package/dist/components/ConfigurationSelector.js +6 -10
- package/dist/components/ConfigurationSelector.js.map +1 -1
- package/dist/components/EdgeInfoPanel.d.ts +1 -1
- package/dist/components/EdgeInfoPanel.d.ts.map +1 -1
- package/dist/components/EdgeInfoPanel.js +14 -18
- package/dist/components/EdgeInfoPanel.js.map +1 -1
- package/dist/components/GraphRenderer.d.ts +1 -1
- package/dist/components/GraphRenderer.d.ts.map +1 -1
- package/dist/components/GraphRenderer.js +89 -92
- package/dist/components/GraphRenderer.js.map +1 -1
- package/dist/components/NarrativeRenderer.d.ts +19 -0
- package/dist/components/NarrativeRenderer.d.ts.map +1 -0
- package/dist/components/NarrativeRenderer.js +103 -0
- package/dist/components/NarrativeRenderer.js.map +1 -0
- package/dist/components/NodeInfoPanel.d.ts +1 -1
- package/dist/components/NodeInfoPanel.d.ts.map +1 -1
- package/dist/components/NodeInfoPanel.js +33 -37
- package/dist/components/NodeInfoPanel.js.map +1 -1
- package/dist/components/NodeTooltip.js +15 -19
- package/dist/components/NodeTooltip.js.map +1 -1
- package/dist/components/SelectionSidebar.d.ts +1 -1
- package/dist/components/SelectionSidebar.d.ts.map +1 -1
- package/dist/components/SelectionSidebar.js +26 -30
- package/dist/components/SelectionSidebar.js.map +1 -1
- package/dist/components/TestEventPanel.d.ts +6 -0
- package/dist/components/TestEventPanel.d.ts.map +1 -1
- package/dist/components/TestEventPanel.js +157 -161
- package/dist/components/TestEventPanel.js.map +1 -1
- package/dist/edges/CustomEdge.d.ts +1 -1
- package/dist/edges/CustomEdge.d.ts.map +1 -1
- package/dist/edges/CustomEdge.js +18 -22
- package/dist/edges/CustomEdge.js.map +1 -1
- package/dist/edges/GenericEdge.d.ts +1 -1
- package/dist/edges/GenericEdge.d.ts.map +1 -1
- package/dist/edges/GenericEdge.js +3 -7
- package/dist/edges/GenericEdge.js.map +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts +1 -1
- package/dist/hooks/usePathBasedEvents.d.ts.map +1 -1
- package/dist/hooks/usePathBasedEvents.js +14 -18
- package/dist/hooks/usePathBasedEvents.js.map +1 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -33
- package/dist/index.js.map +1 -1
- package/dist/nodes/CustomNode.d.ts +1 -1
- package/dist/nodes/CustomNode.d.ts.map +1 -1
- package/dist/nodes/CustomNode.js +22 -26
- package/dist/nodes/CustomNode.js.map +1 -1
- package/dist/nodes/GenericNode.d.ts +1 -1
- package/dist/nodes/GenericNode.d.ts.map +1 -1
- package/dist/nodes/GenericNode.js +4 -8
- package/dist/nodes/GenericNode.js.map +1 -1
- package/dist/utils/animationMapping.d.ts +1 -1
- package/dist/utils/animationMapping.d.ts.map +1 -1
- package/dist/utils/animationMapping.js +6 -13
- package/dist/utils/animationMapping.js.map +1 -1
- package/dist/utils/graphConverter.d.ts +1 -1
- package/dist/utils/graphConverter.d.ts.map +1 -1
- package/dist/utils/graphConverter.js +4 -8
- package/dist/utils/graphConverter.js.map +1 -1
- package/dist/utils/iconResolver.js +7 -45
- package/dist/utils/iconResolver.js.map +1 -1
- package/dist/utils/narrative-converter.d.ts +45 -0
- package/dist/utils/narrative-converter.d.ts.map +1 -0
- package/dist/utils/narrative-converter.js +113 -0
- package/dist/utils/narrative-converter.js.map +1 -0
- package/dist/utils/narrative-loader.d.ts +53 -0
- package/dist/utils/narrative-loader.d.ts.map +1 -0
- package/dist/utils/narrative-loader.js +163 -0
- package/dist/utils/narrative-loader.js.map +1 -0
- package/package.json +22 -25
- package/src/components/ConfigurationSelector.tsx +1 -1
- package/src/components/EdgeInfoPanel.tsx +1 -1
- package/src/components/GraphRenderer.test.tsx +1 -1
- package/src/components/GraphRenderer.tsx +2 -2
- package/src/components/NarrativeRenderer.tsx +171 -0
- package/src/components/NodeInfoPanel.tsx +1 -1
- package/src/components/NodeTooltip.tsx +3 -3
- package/src/components/PendingChanges.test.tsx +1 -1
- package/src/components/SelectionSidebar.tsx +1 -1
- package/src/components/TestEventPanel.tsx +140 -117
- package/src/edges/CustomEdge.tsx +1 -1
- package/src/edges/GenericEdge.tsx +1 -1
- package/src/hooks/usePathBasedEvents.ts +1 -1
- package/src/index.ts +1 -7
- package/src/nodes/CustomNode.tsx +1 -1
- package/src/nodes/GenericNode.tsx +1 -1
- package/src/stories/AnimationWorkshop.stories.tsx +1 -1
- package/src/stories/CanvasEdgeTypes.stories.tsx +1 -1
- package/src/stories/CanvasNodeTypes.stories.tsx +1 -1
- package/src/stories/ColorPriority.stories.tsx +1 -1
- package/src/stories/EventDrivenAnimations.stories.tsx +1 -1
- package/src/stories/GraphRenderer.stories.tsx +1 -1
- package/src/stories/Introduction.mdx +4 -21
- package/src/stories/MultiConfig.stories.tsx +1 -1
- package/src/stories/MultiDirectionalConnections.stories.tsx +1 -1
- package/src/stories/NodeFieldsAudit.stories.tsx +1 -1
- package/src/stories/NodeShapes.stories.tsx +1 -1
- package/src/stories/OtelComponents.stories.tsx +1 -1
- package/src/stories/RealTestExecution.stories.tsx +111 -1
- package/src/stories/TraceViewer.stories.tsx +1 -1
- package/src/stories/ValidatedExecution.stories.tsx +1 -1
- package/src/stories/data/graph-converter-test-execution.json +204 -326
- package/src/stories/data/graph-converter-test.narrative.json +106 -0
- package/src/stories/data/graph-converter-validated-execution.json +6 -6
- package/src/utils/animationMapping.ts +1 -1
- package/src/utils/graphConverter.ts +1 -1
- package/src/utils/narrative-converter.ts +147 -0
- package/src/utils/narrative-loader.ts +172 -0
- package/dist/components/EventLog.d.ts +0 -20
- package/dist/components/EventLog.d.ts.map +0 -1
- package/dist/components/EventLog.js +0 -13
- package/dist/components/EventLog.js.map +0 -1
- package/dist/components/EventLog.test.d.ts +0 -2
- package/dist/components/EventLog.test.d.ts.map +0 -1
- package/dist/components/EventLog.test.js +0 -73
- package/dist/components/EventLog.test.js.map +0 -1
- package/dist/components/GraphRenderer.test.d.ts +0 -2
- package/dist/components/GraphRenderer.test.d.ts.map +0 -1
- package/dist/components/GraphRenderer.test.js +0 -88
- package/dist/components/GraphRenderer.test.js.map +0 -1
- package/dist/components/LayerPanel.d.ts +0 -31
- package/dist/components/LayerPanel.d.ts.map +0 -1
- package/dist/components/LayerPanel.js +0 -207
- package/dist/components/LayerPanel.js.map +0 -1
- package/dist/components/MetricsDashboard.d.ts +0 -14
- package/dist/components/MetricsDashboard.d.ts.map +0 -1
- package/dist/components/MetricsDashboard.js +0 -13
- package/dist/components/MetricsDashboard.js.map +0 -1
- package/src/components/EventLog.test.tsx +0 -85
- package/src/components/EventLog.tsx +0 -51
- package/src/components/MetricsDashboard.tsx +0 -40
- package/src/stories/EventLog.stories.tsx +0 -161
- package/src/stories/IndustryThemes.stories.tsx +0 -483
- package/src/stories/MetricsDashboard.stories.tsx +0 -227
|
@@ -2,9 +2,11 @@ import React, { useState } from 'react';
|
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
3
|
import { GraphRenderer } from '../components/GraphRenderer';
|
|
4
4
|
import { TestEventPanel } from '../components/TestEventPanel';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ViewMode } from '../components/TestEventPanel';
|
|
6
|
+
import type { ExtendedCanvas, GraphEvent } from '@principal-ai/principal-view-core/browser';
|
|
6
7
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
7
8
|
import testSpans from './data/graph-converter-test-execution.json';
|
|
9
|
+
import narrativeTemplate from './data/graph-converter-test.narrative.json';
|
|
8
10
|
|
|
9
11
|
const meta = {
|
|
10
12
|
title: 'Features/Real Test Execution',
|
|
@@ -292,3 +294,111 @@ export const EventPanelOnly: StoryObj = {
|
|
|
292
294
|
);
|
|
293
295
|
},
|
|
294
296
|
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Event panel with narrative view toggle
|
|
300
|
+
*
|
|
301
|
+
* Demonstrates the new narrative view mode that transforms raw OTEL events into
|
|
302
|
+
* human-readable execution narratives. Toggle between "Raw Events" and "Narrative"
|
|
303
|
+
* to see both views.
|
|
304
|
+
*
|
|
305
|
+
* Features:
|
|
306
|
+
* - Human-readable narrative generated from template
|
|
307
|
+
* - Scenario-based rendering (test-passed vs test-failed)
|
|
308
|
+
* - Syntax highlighting for better readability
|
|
309
|
+
* - Optional metadata display
|
|
310
|
+
*/
|
|
311
|
+
export const WithNarrativeToggle: StoryObj = {
|
|
312
|
+
render: () => {
|
|
313
|
+
const [viewMode, setViewMode] = useState<ViewMode>('narrative');
|
|
314
|
+
const [currentSpanIndex, setCurrentSpanIndex] = useState(0);
|
|
315
|
+
const [showMetadata, setShowMetadata] = useState(false);
|
|
316
|
+
|
|
317
|
+
const testData = testSpans as any;
|
|
318
|
+
const spans = Array.isArray(testData) ? testData : testData.spans || testData;
|
|
319
|
+
const logs = testData.logs || [];
|
|
320
|
+
|
|
321
|
+
return (
|
|
322
|
+
<div style={{ width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column' }}>
|
|
323
|
+
{/* Controls */}
|
|
324
|
+
<div
|
|
325
|
+
style={{
|
|
326
|
+
padding: '12px 20px',
|
|
327
|
+
background: '#1a1a1a',
|
|
328
|
+
borderBottom: '1px solid #333',
|
|
329
|
+
display: 'flex',
|
|
330
|
+
gap: '12px',
|
|
331
|
+
alignItems: 'center',
|
|
332
|
+
}}
|
|
333
|
+
>
|
|
334
|
+
<label style={{ color: '#999', fontSize: '14px' }}>
|
|
335
|
+
<input
|
|
336
|
+
type="checkbox"
|
|
337
|
+
checked={showMetadata}
|
|
338
|
+
onChange={(e) => setShowMetadata(e.target.checked)}
|
|
339
|
+
style={{ marginRight: '6px' }}
|
|
340
|
+
/>
|
|
341
|
+
Show Metadata
|
|
342
|
+
</label>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
{/* Event Panel */}
|
|
346
|
+
<div style={{ flex: 1, overflow: 'hidden' }}>
|
|
347
|
+
<TestEventPanel
|
|
348
|
+
spans={spans}
|
|
349
|
+
logs={logs}
|
|
350
|
+
currentSpanIndex={currentSpanIndex}
|
|
351
|
+
currentEventIndex={999}
|
|
352
|
+
onSpanIndexChange={setCurrentSpanIndex}
|
|
353
|
+
viewMode={viewMode}
|
|
354
|
+
narrativeTemplate={narrativeTemplate as any}
|
|
355
|
+
onViewModeChange={setViewMode}
|
|
356
|
+
showNarrativeMetadata={showMetadata}
|
|
357
|
+
/>
|
|
358
|
+
</div>
|
|
359
|
+
</div>
|
|
360
|
+
);
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Split view with narrative on left, graph on right
|
|
366
|
+
*
|
|
367
|
+
* Shows how the narrative view integrates with the graph visualization,
|
|
368
|
+
* providing a complete picture of test execution.
|
|
369
|
+
*/
|
|
370
|
+
export const NarrativeWithGraph: StoryObj = {
|
|
371
|
+
render: () => {
|
|
372
|
+
const [viewMode, setViewMode] = useState<ViewMode>('narrative');
|
|
373
|
+
const [currentSpanIndex, setCurrentSpanIndex] = useState(0);
|
|
374
|
+
const [events] = useState<GraphEvent[]>([]);
|
|
375
|
+
|
|
376
|
+
const testData = testSpans as any;
|
|
377
|
+
const spans = Array.isArray(testData) ? testData : testData.spans || testData;
|
|
378
|
+
const logs = testData.logs || [];
|
|
379
|
+
|
|
380
|
+
return (
|
|
381
|
+
<div style={{ display: 'flex', width: '100vw', height: '100vh' }}>
|
|
382
|
+
{/* Event Panel - Left Side */}
|
|
383
|
+
<div style={{ flex: '0 0 50%', height: '100%', borderRight: '1px solid #333', overflow: 'hidden' }}>
|
|
384
|
+
<TestEventPanel
|
|
385
|
+
spans={spans}
|
|
386
|
+
logs={logs}
|
|
387
|
+
currentSpanIndex={currentSpanIndex}
|
|
388
|
+
currentEventIndex={999}
|
|
389
|
+
onSpanIndexChange={setCurrentSpanIndex}
|
|
390
|
+
viewMode={viewMode}
|
|
391
|
+
narrativeTemplate={narrativeTemplate as any}
|
|
392
|
+
onViewModeChange={setViewMode}
|
|
393
|
+
showNarrativeMetadata={true}
|
|
394
|
+
/>
|
|
395
|
+
</div>
|
|
396
|
+
|
|
397
|
+
{/* Graph Visualization - Right Side */}
|
|
398
|
+
<div style={{ flex: '0 0 50%', height: '100%', position: 'relative' }}>
|
|
399
|
+
<GraphRenderer canvas={testExecutionCanvas} showControls={true} events={events} />
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
);
|
|
403
|
+
},
|
|
404
|
+
};
|
|
@@ -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 } from '@principal-ai/principal-view-core/browser';
|
|
5
5
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
6
6
|
|
|
7
7
|
// Import captured trace canvas data
|
|
@@ -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 { TestEventPanel } from '../components/TestEventPanel';
|
|
5
|
-
import type { ExtendedCanvas } from '@principal-ai/principal-view-core';
|
|
5
|
+
import type { ExtendedCanvas } from '@principal-ai/principal-view-core/browser';
|
|
6
6
|
import { ThemeProvider, defaultEditorTheme } from '@principal-ade/industry-theme';
|
|
7
7
|
import executionCanvas from '../../../../.principal-views/graph-converter-execution.otel.canvas';
|
|
8
8
|
import validatedSpans from './data/graph-converter-validated-execution.json';
|