@principal-ai/subsystems-react 0.17.0
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 +93 -0
- package/dist/components/ConfigurationSelector.d.ts +35 -0
- package/dist/components/ConfigurationSelector.d.ts.map +1 -0
- package/dist/components/ConfigurationSelector.js +63 -0
- package/dist/components/ConfigurationSelector.js.map +1 -0
- package/dist/components/GraphRenderer.d.ts +295 -0
- package/dist/components/GraphRenderer.d.ts.map +1 -0
- package/dist/components/GraphRenderer.js +2008 -0
- package/dist/components/GraphRenderer.js.map +1 -0
- package/dist/components/MultiCanvasRenderer.d.ts +75 -0
- package/dist/components/MultiCanvasRenderer.d.ts.map +1 -0
- package/dist/components/MultiCanvasRenderer.js +203 -0
- package/dist/components/MultiCanvasRenderer.js.map +1 -0
- package/dist/components/NodeTooltip.d.ts +24 -0
- package/dist/components/NodeTooltip.d.ts.map +1 -0
- package/dist/components/NodeTooltip.js +160 -0
- package/dist/components/NodeTooltip.js.map +1 -0
- package/dist/components/SelectionSidebar.d.ts +18 -0
- package/dist/components/SelectionSidebar.d.ts.map +1 -0
- package/dist/components/SelectionSidebar.js +190 -0
- package/dist/components/SelectionSidebar.js.map +1 -0
- package/dist/components/SequenceDiagramRenderer.d.ts +77 -0
- package/dist/components/SequenceDiagramRenderer.d.ts.map +1 -0
- package/dist/components/SequenceDiagramRenderer.js +604 -0
- package/dist/components/SequenceDiagramRenderer.js.map +1 -0
- package/dist/components/WorkflowSequenceDiagram.d.ts +63 -0
- package/dist/components/WorkflowSequenceDiagram.d.ts.map +1 -0
- package/dist/components/WorkflowSequenceDiagram.js +147 -0
- package/dist/components/WorkflowSequenceDiagram.js.map +1 -0
- package/dist/components/dashboard/DashboardRenderer.d.ts +10 -0
- package/dist/components/dashboard/DashboardRenderer.d.ts.map +1 -0
- package/dist/components/dashboard/DashboardRenderer.js +179 -0
- package/dist/components/dashboard/DashboardRenderer.js.map +1 -0
- package/dist/components/dashboard/MetricPanel.d.ts +10 -0
- package/dist/components/dashboard/MetricPanel.d.ts.map +1 -0
- package/dist/components/dashboard/MetricPanel.js +103 -0
- package/dist/components/dashboard/MetricPanel.js.map +1 -0
- package/dist/components/dashboard/MockDataProvider.d.ts +30 -0
- package/dist/components/dashboard/MockDataProvider.d.ts.map +1 -0
- package/dist/components/dashboard/MockDataProvider.js +270 -0
- package/dist/components/dashboard/MockDataProvider.js.map +1 -0
- package/dist/components/dashboard/components/BarChart.d.ts +10 -0
- package/dist/components/dashboard/components/BarChart.d.ts.map +1 -0
- package/dist/components/dashboard/components/BarChart.js +167 -0
- package/dist/components/dashboard/components/BarChart.js.map +1 -0
- package/dist/components/dashboard/components/LineChart.d.ts +10 -0
- package/dist/components/dashboard/components/LineChart.d.ts.map +1 -0
- package/dist/components/dashboard/components/LineChart.js +141 -0
- package/dist/components/dashboard/components/LineChart.js.map +1 -0
- package/dist/components/dashboard/components/MetricCard.d.ts +9 -0
- package/dist/components/dashboard/components/MetricCard.d.ts.map +1 -0
- package/dist/components/dashboard/components/MetricCard.js +163 -0
- package/dist/components/dashboard/components/MetricCard.js.map +1 -0
- package/dist/components/dashboard/components/SourceLink.d.ts +9 -0
- package/dist/components/dashboard/components/SourceLink.d.ts.map +1 -0
- package/dist/components/dashboard/components/SourceLink.js +39 -0
- package/dist/components/dashboard/components/SourceLink.js.map +1 -0
- package/dist/components/dashboard/components/TimeRangeSelector.d.ts +9 -0
- package/dist/components/dashboard/components/TimeRangeSelector.d.ts.map +1 -0
- package/dist/components/dashboard/components/TimeRangeSelector.js +167 -0
- package/dist/components/dashboard/components/TimeRangeSelector.js.map +1 -0
- package/dist/components/dashboard/components/index.d.ts +6 -0
- package/dist/components/dashboard/components/index.d.ts.map +1 -0
- package/dist/components/dashboard/components/index.js +6 -0
- package/dist/components/dashboard/components/index.js.map +1 -0
- package/dist/components/dashboard/index.d.ts +6 -0
- package/dist/components/dashboard/index.d.ts.map +1 -0
- package/dist/components/dashboard/index.js +8 -0
- package/dist/components/dashboard/index.js.map +1 -0
- package/dist/components/dashboard/types.d.ts +74 -0
- package/dist/components/dashboard/types.d.ts.map +1 -0
- package/dist/components/dashboard/types.js +8 -0
- package/dist/components/dashboard/types.js.map +1 -0
- package/dist/components/session-events/SessionEventFeed.d.ts +34 -0
- package/dist/components/session-events/SessionEventFeed.d.ts.map +1 -0
- package/dist/components/session-events/SessionEventFeed.js +1196 -0
- package/dist/components/session-events/SessionEventFeed.js.map +1 -0
- package/dist/components/session-events/index.d.ts +7 -0
- package/dist/components/session-events/index.d.ts.map +1 -0
- package/dist/components/session-events/index.js +6 -0
- package/dist/components/session-events/index.js.map +1 -0
- package/dist/components/state-view/PipelineView.d.ts +14 -0
- package/dist/components/state-view/PipelineView.d.ts.map +1 -0
- package/dist/components/state-view/PipelineView.js +195 -0
- package/dist/components/state-view/PipelineView.js.map +1 -0
- package/dist/components/state-view/index.d.ts +14 -0
- package/dist/components/state-view/index.d.ts.map +1 -0
- package/dist/components/state-view/index.js +12 -0
- package/dist/components/state-view/index.js.map +1 -0
- package/dist/components/state-view/types.d.ts +188 -0
- package/dist/components/state-view/types.d.ts.map +1 -0
- package/dist/components/state-view/types.js +10 -0
- package/dist/components/state-view/types.js.map +1 -0
- package/dist/components/state-view/useStateView.d.ts +32 -0
- package/dist/components/state-view/useStateView.d.ts.map +1 -0
- package/dist/components/state-view/useStateView.js +129 -0
- package/dist/components/state-view/useStateView.js.map +1 -0
- package/dist/contexts/GraphEditContext.d.ts +20 -0
- package/dist/contexts/GraphEditContext.d.ts.map +1 -0
- package/dist/contexts/GraphEditContext.js +8 -0
- package/dist/contexts/GraphEditContext.js.map +1 -0
- package/dist/contexts/TooltipPortalContext.d.ts +8 -0
- package/dist/contexts/TooltipPortalContext.d.ts.map +1 -0
- package/dist/contexts/TooltipPortalContext.js +8 -0
- package/dist/contexts/TooltipPortalContext.js.map +1 -0
- package/dist/edges/CustomEdge.d.ts +24 -0
- package/dist/edges/CustomEdge.d.ts.map +1 -0
- package/dist/edges/CustomEdge.js +222 -0
- package/dist/edges/CustomEdge.js.map +1 -0
- package/dist/edges/GenericEdge.d.ts +18 -0
- package/dist/edges/GenericEdge.d.ts.map +1 -0
- package/dist/edges/GenericEdge.js +10 -0
- package/dist/edges/GenericEdge.js.map +1 -0
- package/dist/graphify/anchor.d.ts +28 -0
- package/dist/graphify/anchor.d.ts.map +1 -0
- package/dist/graphify/anchor.js +132 -0
- package/dist/graphify/anchor.js.map +1 -0
- package/dist/graphify/consolidated.d.ts +210 -0
- package/dist/graphify/consolidated.d.ts.map +1 -0
- package/dist/graphify/consolidated.js +11 -0
- package/dist/graphify/consolidated.js.map +1 -0
- package/dist/graphify/ids.d.ts +19 -0
- package/dist/graphify/ids.d.ts.map +1 -0
- package/dist/graphify/ids.js +46 -0
- package/dist/graphify/ids.js.map +1 -0
- package/dist/graphify/index.d.ts +18 -0
- package/dist/graphify/index.d.ts.map +1 -0
- package/dist/graphify/index.js +12 -0
- package/dist/graphify/index.js.map +1 -0
- package/dist/graphify/kind.d.ts +23 -0
- package/dist/graphify/kind.d.ts.map +1 -0
- package/dist/graphify/kind.js +77 -0
- package/dist/graphify/kind.js.map +1 -0
- package/dist/graphify/resolve.d.ts +48 -0
- package/dist/graphify/resolve.d.ts.map +1 -0
- package/dist/graphify/resolve.js +83 -0
- package/dist/graphify/resolve.js.map +1 -0
- package/dist/graphify/signature.d.ts +87 -0
- package/dist/graphify/signature.d.ts.map +1 -0
- package/dist/graphify/signature.js +276 -0
- package/dist/graphify/signature.js.map +1 -0
- package/dist/graphify/types.d.ts +141 -0
- package/dist/graphify/types.d.ts.map +1 -0
- package/dist/graphify/types.js +8 -0
- package/dist/graphify/types.js.map +1 -0
- package/dist/hooks/useElkLayout.d.ts +66 -0
- package/dist/hooks/useElkLayout.d.ts.map +1 -0
- package/dist/hooks/useElkLayout.js +136 -0
- package/dist/hooks/useElkLayout.js.map +1 -0
- package/dist/hooks/usePathBasedEvents.d.ts +42 -0
- package/dist/hooks/usePathBasedEvents.d.ts.map +1 -0
- package/dist/hooks/usePathBasedEvents.js +119 -0
- package/dist/hooks/usePathBasedEvents.js.map +1 -0
- package/dist/hooks/useSequenceLayout.d.ts +186 -0
- package/dist/hooks/useSequenceLayout.d.ts.map +1 -0
- package/dist/hooks/useSequenceLayout.js +327 -0
- package/dist/hooks/useSequenceLayout.js.map +1 -0
- package/dist/hooks/useUndoRedo.d.ts +80 -0
- package/dist/hooks/useUndoRedo.d.ts.map +1 -0
- package/dist/hooks/useUndoRedo.js +70 -0
- package/dist/hooks/useUndoRedo.js.map +1 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/CustomNode.d.ts +28 -0
- package/dist/nodes/CustomNode.d.ts.map +1 -0
- package/dist/nodes/CustomNode.js +820 -0
- package/dist/nodes/CustomNode.js.map +1 -0
- package/dist/nodes/GenericNode.d.ts +20 -0
- package/dist/nodes/GenericNode.d.ts.map +1 -0
- package/dist/nodes/GenericNode.js +20 -0
- package/dist/nodes/GenericNode.js.map +1 -0
- package/dist/nodes/otel/OtelBoundaryNode.d.ts +55 -0
- package/dist/nodes/otel/OtelBoundaryNode.d.ts.map +1 -0
- package/dist/nodes/otel/OtelBoundaryNode.js +81 -0
- package/dist/nodes/otel/OtelBoundaryNode.js.map +1 -0
- package/dist/nodes/otel/OtelEventNode.d.ts +59 -0
- package/dist/nodes/otel/OtelEventNode.d.ts.map +1 -0
- package/dist/nodes/otel/OtelEventNode.js +82 -0
- package/dist/nodes/otel/OtelEventNode.js.map +1 -0
- package/dist/nodes/otel/OtelResourceNode.d.ts +53 -0
- package/dist/nodes/otel/OtelResourceNode.d.ts.map +1 -0
- package/dist/nodes/otel/OtelResourceNode.js +105 -0
- package/dist/nodes/otel/OtelResourceNode.js.map +1 -0
- package/dist/nodes/otel/OtelScopeNode.d.ts +53 -0
- package/dist/nodes/otel/OtelScopeNode.d.ts.map +1 -0
- package/dist/nodes/otel/OtelScopeNode.js +81 -0
- package/dist/nodes/otel/OtelScopeNode.js.map +1 -0
- package/dist/nodes/otel/OtelSpanConventionNode.d.ts +61 -0
- package/dist/nodes/otel/OtelSpanConventionNode.d.ts.map +1 -0
- package/dist/nodes/otel/OtelSpanConventionNode.js +131 -0
- package/dist/nodes/otel/OtelSpanConventionNode.js.map +1 -0
- package/dist/nodes/otel/index.d.ts +17 -0
- package/dist/nodes/otel/index.d.ts.map +1 -0
- package/dist/nodes/otel/index.js +13 -0
- package/dist/nodes/otel/index.js.map +1 -0
- package/dist/nodes/otel/shared/NodeBadges.d.ts +10 -0
- package/dist/nodes/otel/shared/NodeBadges.d.ts.map +1 -0
- package/dist/nodes/otel/shared/NodeBadges.js +178 -0
- package/dist/nodes/otel/shared/NodeBadges.js.map +1 -0
- package/dist/nodes/otel/shared/NodeContent.d.ts +10 -0
- package/dist/nodes/otel/shared/NodeContent.d.ts.map +1 -0
- package/dist/nodes/otel/shared/NodeContent.js +96 -0
- package/dist/nodes/otel/shared/NodeContent.js.map +1 -0
- package/dist/nodes/otel/shared/index.d.ts +8 -0
- package/dist/nodes/otel/shared/index.d.ts.map +1 -0
- package/dist/nodes/otel/shared/index.js +8 -0
- package/dist/nodes/otel/shared/index.js.map +1 -0
- package/dist/nodes/otel/shared/types.d.ts +129 -0
- package/dist/nodes/otel/shared/types.d.ts.map +1 -0
- package/dist/nodes/otel/shared/types.js +5 -0
- package/dist/nodes/otel/shared/types.js.map +1 -0
- package/dist/nodes/otel/shared/useNodeBehavior.d.ts +42 -0
- package/dist/nodes/otel/shared/useNodeBehavior.d.ts.map +1 -0
- package/dist/nodes/otel/shared/useNodeBehavior.js +61 -0
- package/dist/nodes/otel/shared/useNodeBehavior.js.map +1 -0
- package/dist/pierre/PierreFileView.d.ts +17 -0
- package/dist/pierre/PierreFileView.d.ts.map +1 -0
- package/dist/pierre/PierreFileView.js +46 -0
- package/dist/pierre/PierreFileView.js.map +1 -0
- package/dist/pierre/PierreSnippetView.d.ts +28 -0
- package/dist/pierre/PierreSnippetView.d.ts.map +1 -0
- package/dist/pierre/PierreSnippetView.js +105 -0
- package/dist/pierre/PierreSnippetView.js.map +1 -0
- package/dist/pierre/PierreThroughlineCodeView.d.ts +22 -0
- package/dist/pierre/PierreThroughlineCodeView.d.ts.map +1 -0
- package/dist/pierre/PierreThroughlineCodeView.js +206 -0
- package/dist/pierre/PierreThroughlineCodeView.js.map +1 -0
- package/dist/pierre/constructColors.d.ts +24 -0
- package/dist/pierre/constructColors.d.ts.map +1 -0
- package/dist/pierre/constructColors.js +91 -0
- package/dist/pierre/constructColors.js.map +1 -0
- package/dist/pierre/index.d.ts +12 -0
- package/dist/pierre/index.d.ts.map +1 -0
- package/dist/pierre/index.js +7 -0
- package/dist/pierre/index.js.map +1 -0
- package/dist/pierre/pierreBackground.d.ts +15 -0
- package/dist/pierre/pierreBackground.d.ts.map +1 -0
- package/dist/pierre/pierreBackground.js +31 -0
- package/dist/pierre/pierreBackground.js.map +1 -0
- package/dist/pierre/pierreFileLang.d.ts +27 -0
- package/dist/pierre/pierreFileLang.d.ts.map +1 -0
- package/dist/pierre/pierreFileLang.js +52 -0
- package/dist/pierre/pierreFileLang.js.map +1 -0
- package/dist/pierre/pierreSyntaxTheme.d.ts +11 -0
- package/dist/pierre/pierreSyntaxTheme.d.ts.map +1 -0
- package/dist/pierre/pierreSyntaxTheme.js +20 -0
- package/dist/pierre/pierreSyntaxTheme.js.map +1 -0
- package/dist/pierre/scrollAnchor.d.ts +5 -0
- package/dist/pierre/scrollAnchor.d.ts.map +1 -0
- package/dist/pierre/scrollAnchor.js +9 -0
- package/dist/pierre/scrollAnchor.js.map +1 -0
- package/dist/pierre/sliceSnippet.d.ts +10 -0
- package/dist/pierre/sliceSnippet.d.ts.map +1 -0
- package/dist/pierre/sliceSnippet.js +16 -0
- package/dist/pierre/sliceSnippet.js.map +1 -0
- package/dist/pierre/syntaxTokens.d.ts +11 -0
- package/dist/pierre/syntaxTokens.d.ts.map +1 -0
- package/dist/pierre/syntaxTokens.js +51 -0
- package/dist/pierre/syntaxTokens.js.map +1 -0
- package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts +8 -0
- package/dist/stories/Subsystem/ComponentGraph/fixtures.d.ts.map +1 -0
- package/dist/stories/Subsystem/ComponentGraph/fixtures.js +116 -0
- package/dist/stories/Subsystem/ComponentGraph/fixtures.js.map +1 -0
- package/dist/subsystem/ComponentDeclaration.d.ts +87 -0
- package/dist/subsystem/ComponentDeclaration.d.ts.map +1 -0
- package/dist/subsystem/ComponentDeclaration.js +374 -0
- package/dist/subsystem/ComponentDeclaration.js.map +1 -0
- package/dist/subsystem/FileDrawer.d.ts +17 -0
- package/dist/subsystem/FileDrawer.d.ts.map +1 -0
- package/dist/subsystem/FileDrawer.js +72 -0
- package/dist/subsystem/FileDrawer.js.map +1 -0
- package/dist/subsystem/GraphLayoutCover.d.ts +20 -0
- package/dist/subsystem/GraphLayoutCover.d.ts.map +1 -0
- package/dist/subsystem/GraphLayoutCover.js +42 -0
- package/dist/subsystem/GraphLayoutCover.js.map +1 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts +96 -0
- package/dist/subsystem/SubsystemComponentGraph.d.ts.map +1 -0
- package/dist/subsystem/SubsystemComponentGraph.js +1059 -0
- package/dist/subsystem/SubsystemComponentGraph.js.map +1 -0
- package/dist/subsystem/SubsystemFileTree.d.ts +24 -0
- package/dist/subsystem/SubsystemFileTree.d.ts.map +1 -0
- package/dist/subsystem/SubsystemFileTree.js +150 -0
- package/dist/subsystem/SubsystemFileTree.js.map +1 -0
- package/dist/subsystem/declarationRef.d.ts +39 -0
- package/dist/subsystem/declarationRef.d.ts.map +1 -0
- package/dist/subsystem/declarationRef.js +32 -0
- package/dist/subsystem/declarationRef.js.map +1 -0
- package/dist/subsystem/formatDeclaration.d.ts +11 -0
- package/dist/subsystem/formatDeclaration.d.ts.map +1 -0
- package/dist/subsystem/formatDeclaration.js +146 -0
- package/dist/subsystem/formatDeclaration.js.map +1 -0
- package/dist/subsystem/model.d.ts +353 -0
- package/dist/subsystem/model.d.ts.map +1 -0
- package/dist/subsystem/model.js +503 -0
- package/dist/subsystem/model.js.map +1 -0
- package/dist/subsystem/nodes.d.ts +69 -0
- package/dist/subsystem/nodes.d.ts.map +1 -0
- package/dist/subsystem/nodes.js +289 -0
- package/dist/subsystem/nodes.js.map +1 -0
- package/dist/subsystem/paths.d.ts +63 -0
- package/dist/subsystem/paths.d.ts.map +1 -0
- package/dist/subsystem/paths.js +86 -0
- package/dist/subsystem/paths.js.map +1 -0
- package/dist/subsystem/tokenizeComponent.d.ts +20 -0
- package/dist/subsystem/tokenizeComponent.d.ts.map +1 -0
- package/dist/subsystem/tokenizeComponent.js +56 -0
- package/dist/subsystem/tokenizeComponent.js.map +1 -0
- package/dist/subsystem/tokenizeFormatted.d.ts +12 -0
- package/dist/subsystem/tokenizeFormatted.d.ts.map +1 -0
- package/dist/subsystem/tokenizeFormatted.js +13 -0
- package/dist/subsystem/tokenizeFormatted.js.map +1 -0
- package/dist/utils/animationMapping.d.ts +53 -0
- package/dist/utils/animationMapping.d.ts.map +1 -0
- package/dist/utils/animationMapping.js +126 -0
- package/dist/utils/animationMapping.js.map +1 -0
- package/dist/utils/canvasBounds.d.ts +50 -0
- package/dist/utils/canvasBounds.d.ts.map +1 -0
- package/dist/utils/canvasBounds.js +88 -0
- package/dist/utils/canvasBounds.js.map +1 -0
- package/dist/utils/elkLayout.d.ts +137 -0
- package/dist/utils/elkLayout.d.ts.map +1 -0
- package/dist/utils/elkLayout.js +596 -0
- package/dist/utils/elkLayout.js.map +1 -0
- package/dist/utils/graphConverter.d.ts +18 -0
- package/dist/utils/graphConverter.d.ts.map +1 -0
- package/dist/utils/graphConverter.js +114 -0
- package/dist/utils/graphConverter.js.map +1 -0
- package/dist/utils/iconResolver.d.ts +29 -0
- package/dist/utils/iconResolver.d.ts.map +1 -0
- package/dist/utils/iconResolver.js +30 -0
- package/dist/utils/iconResolver.js.map +1 -0
- package/dist/utils/orientationUtils.d.ts +19 -0
- package/dist/utils/orientationUtils.d.ts.map +1 -0
- package/dist/utils/orientationUtils.js +62 -0
- package/dist/utils/orientationUtils.js.map +1 -0
- package/package.json +80 -0
- package/src/components/ConfigurationSelector.tsx +133 -0
- package/src/components/GraphRenderer.tsx +3195 -0
- package/src/components/MultiCanvasRenderer.tsx +295 -0
- package/src/components/NodeTooltip.tsx +279 -0
- package/src/components/PendingChanges.test.tsx +375 -0
- package/src/components/SelectionSidebar.tsx +352 -0
- package/src/components/SequenceDiagramRenderer.tsx +1156 -0
- package/src/components/WorkflowSequenceDiagram.tsx +270 -0
- package/src/components/dashboard/DashboardRenderer.tsx +317 -0
- package/src/components/dashboard/MetricPanel.tsx +254 -0
- package/src/components/dashboard/MockDataProvider.ts +330 -0
- package/src/components/dashboard/components/BarChart.tsx +299 -0
- package/src/components/dashboard/components/LineChart.tsx +279 -0
- package/src/components/dashboard/components/MetricCard.tsx +270 -0
- package/src/components/dashboard/components/SourceLink.tsx +63 -0
- package/src/components/dashboard/components/TimeRangeSelector.tsx +280 -0
- package/src/components/dashboard/components/index.ts +5 -0
- package/src/components/dashboard/index.ts +47 -0
- package/src/components/dashboard/types.ts +126 -0
- package/src/components/session-events/SessionEventFeed.tsx +1797 -0
- package/src/components/session-events/index.ts +13 -0
- package/src/components/state-view/PipelineView.tsx +347 -0
- package/src/components/state-view/index.ts +14 -0
- package/src/components/state-view/types.ts +261 -0
- package/src/components/state-view/useStateView.ts +205 -0
- package/src/contexts/GraphEditContext.tsx +27 -0
- package/src/contexts/TooltipPortalContext.ts +8 -0
- package/src/edges/CustomEdge.tsx +402 -0
- package/src/edges/GenericEdge.tsx +36 -0
- package/src/graphify/anchor.test.ts +124 -0
- package/src/graphify/anchor.ts +160 -0
- package/src/graphify/consolidated.ts +246 -0
- package/src/graphify/ids.ts +48 -0
- package/src/graphify/index.ts +72 -0
- package/src/graphify/kind.test.ts +108 -0
- package/src/graphify/kind.ts +120 -0
- package/src/graphify/resolve.test.ts +89 -0
- package/src/graphify/resolve.ts +115 -0
- package/src/graphify/signature.test.ts +278 -0
- package/src/graphify/signature.ts +354 -0
- package/src/graphify/types.ts +164 -0
- package/src/hooks/useElkLayout.test.ts +134 -0
- package/src/hooks/useElkLayout.ts +191 -0
- package/src/hooks/usePathBasedEvents.ts +192 -0
- package/src/hooks/useSequenceLayout.ts +543 -0
- package/src/hooks/useUndoRedo.ts +144 -0
- package/src/index.ts +341 -0
- package/src/nodes/CustomNode.tsx +1231 -0
- package/src/nodes/GenericNode.tsx +55 -0
- package/src/nodes/otel/OtelBoundaryNode.tsx +224 -0
- package/src/nodes/otel/OtelEventNode.tsx +225 -0
- package/src/nodes/otel/OtelResourceNode.tsx +251 -0
- package/src/nodes/otel/OtelScopeNode.tsx +221 -0
- package/src/nodes/otel/OtelSpanConventionNode.tsx +295 -0
- package/src/nodes/otel/index.ts +23 -0
- package/src/nodes/otel/shared/NodeBadges.tsx +295 -0
- package/src/nodes/otel/shared/NodeContent.tsx +204 -0
- package/src/nodes/otel/shared/index.ts +8 -0
- package/src/nodes/otel/shared/types.ts +138 -0
- package/src/nodes/otel/shared/useNodeBehavior.ts +114 -0
- package/src/pierre/PierreFileView.tsx +81 -0
- package/src/pierre/PierreSnippetView.tsx +184 -0
- package/src/pierre/PierreThroughlineCodeView.tsx +304 -0
- package/src/pierre/constructColors.test.ts +52 -0
- package/src/pierre/constructColors.ts +112 -0
- package/src/pierre/index.ts +18 -0
- package/src/pierre/pierreBackground.ts +33 -0
- package/src/pierre/pierreFileLang.test.ts +26 -0
- package/src/pierre/pierreFileLang.ts +55 -0
- package/src/pierre/pierreSyntaxTheme.ts +23 -0
- package/src/pierre/scrollAnchor.test.ts +13 -0
- package/src/pierre/scrollAnchor.ts +11 -0
- package/src/pierre/sliceSnippet.test.ts +21 -0
- package/src/pierre/sliceSnippet.ts +31 -0
- package/src/pierre/syntaxTokens.test.ts +35 -0
- package/src/pierre/syntaxTokens.ts +60 -0
- package/src/stories/Audit/BoundaryNodes.stories.tsx +385 -0
- package/src/stories/Audit/CanvasEdgeTypes.stories.tsx +1448 -0
- package/src/stories/Audit/CanvasNodeTypes.stories.tsx +1049 -0
- package/src/stories/Audit/ColorPriority.stories.tsx +895 -0
- package/src/stories/Audit/DiamondBadges.stories.tsx +629 -0
- package/src/stories/Audit/NodeDimensionsTesting.stories.tsx +724 -0
- package/src/stories/Audit/NodeFieldsAudit.stories.tsx +996 -0
- package/src/stories/Audit/NodeFontSizeTesting.stories.tsx +715 -0
- package/src/stories/Audit/NodeShapes.stories.tsx +1208 -0
- package/src/stories/Audit/WideNodesTesting.stories.tsx +1045 -0
- package/src/stories/Components/DashboardRenderer.stories.tsx +263 -0
- package/src/stories/Components/GraphRenderer.stories.tsx +3236 -0
- package/src/stories/Components/MultiCanvasRenderer.stories.tsx +370 -0
- package/src/stories/Components/SequenceDiagram.stories.tsx +255 -0
- package/src/stories/Components/StateView.stories.tsx +417 -0
- package/src/stories/Components/TraceViewer.stories.tsx +442 -0
- package/src/stories/Components/WorkflowSequenceDiagram.stories.tsx +802 -0
- package/src/stories/Features/AnimationWorkshop.stories.tsx +727 -0
- package/src/stories/Features/ChangeTypeVisual.stories.tsx +67 -0
- package/src/stories/Features/EventDrivenAnimations.stories.tsx +513 -0
- package/src/stories/Features/MultiConfig.stories.tsx +539 -0
- package/src/stories/Introduction.mdx +34 -0
- package/src/stories/Layout/ElkEdgeRouting.stories.tsx +539 -0
- package/src/stories/Layout/GraphOrientation.stories.tsx +500 -0
- package/src/stories/Layout/MultiDirectionalConnections.stories.tsx +352 -0
- package/src/stories/Nodes/NodeDefinitionComparison.stories.tsx +560 -0
- package/src/stories/Nodes/NodeNameFallbacks.stories.tsx +491 -0
- package/src/stories/Nodes/NumericColors.stories.tsx +440 -0
- package/src/stories/OTEL/EventNameDisplay.stories.tsx +694 -0
- package/src/stories/OTEL/EventNameFallback.stories.tsx +578 -0
- package/src/stories/OTEL/OtelComponents.stories.tsx +422 -0
- package/src/stories/OTEL/OtelNodeTypesPrototype.stories.tsx +806 -0
- package/src/stories/OTEL/RawEventCards.stories.tsx +57 -0
- package/src/stories/OTEL/SpanBadges.stories.tsx +840 -0
- package/src/stories/OTEL/ValidationEventsCanvas.stories.tsx +209 -0
- package/src/stories/Pierre/CodeView.stories.tsx +219 -0
- package/src/stories/RealWorld/BacklogMdCanvases.stories.tsx +721 -0
- package/src/stories/RealWorld/FileCitySequence.stories.tsx +516 -0
- package/src/stories/RealWorld/RealCanvasFiles.stories.tsx +336 -0
- package/src/stories/Subsystem/ComponentDeclarationAudit.stories.tsx +321 -0
- package/src/stories/Subsystem/ComponentGraph/Appearance.stories.tsx +365 -0
- package/src/stories/Subsystem/ComponentGraph/Basics.stories.tsx +137 -0
- package/src/stories/Subsystem/ComponentGraph/Captures.stories.tsx +238 -0
- package/src/stories/Subsystem/ComponentGraph/DetailPanel.stories.tsx +315 -0
- package/src/stories/Subsystem/ComponentGraph/Flows.stories.tsx +239 -0
- package/src/stories/Subsystem/ComponentGraph/FrameworkStereotype.stories.tsx +216 -0
- package/src/stories/Subsystem/ComponentGraph/GraphTitle.stories.tsx +70 -0
- package/src/stories/Subsystem/ComponentGraph/Processes.stories.tsx +68 -0
- package/src/stories/Subsystem/ComponentGraph/Scenarios.stories.tsx +959 -0
- package/src/stories/Subsystem/ComponentGraph/Spotlights.stories.tsx +681 -0
- package/src/stories/Subsystem/ComponentGraph/fixtures.ts +129 -0
- package/src/stories/__traces__/test-run.canvas.json +241 -0
- package/src/stories/data/activity-feed-analytics.dashboard.json +300 -0
- package/src/stories/data/file-city-images-transformed.otel.canvas.json +295 -0
- package/src/stories/data/file-city-workflows.json +269 -0
- package/src/stories/data/graph-converter-test-execution.json +443 -0
- package/src/stories/data/graph-converter-test.workflow.json +105 -0
- package/src/stories/data/graph-converter-validated-execution.json +58 -0
- package/src/stories/data/opencode-session-raw-events.json +273396 -0
- package/src/subsystem/ComponentDeclaration.tsx +643 -0
- package/src/subsystem/FileDrawer.tsx +106 -0
- package/src/subsystem/GraphLayoutCover.tsx +69 -0
- package/src/subsystem/SubsystemComponentGraph.tsx +1644 -0
- package/src/subsystem/SubsystemFileTree.tsx +190 -0
- package/src/subsystem/declarationRef.test.ts +33 -0
- package/src/subsystem/declarationRef.ts +63 -0
- package/src/subsystem/formatDeclaration.ts +174 -0
- package/src/subsystem/model.test.ts +244 -0
- package/src/subsystem/model.ts +850 -0
- package/src/subsystem/nodes.test.ts +56 -0
- package/src/subsystem/nodes.tsx +443 -0
- package/src/subsystem/paths.test.ts +123 -0
- package/src/subsystem/paths.ts +127 -0
- package/src/subsystem/tokenizeComponent.ts +70 -0
- package/src/subsystem/tokenizeFormatted.ts +19 -0
- package/src/utils/animationMapping.ts +166 -0
- package/src/utils/canvasBounds.ts +146 -0
- package/src/utils/elkLayout.test.ts +240 -0
- package/src/utils/elkLayout.ts +779 -0
- package/src/utils/graphConverter.ts +148 -0
- package/src/utils/iconResolver.tsx +53 -0
- package/src/utils/orientationUtils.ts +73 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MetricCard
|
|
3
|
+
*
|
|
4
|
+
* Displays a single metric value with optional trend indicator and sparkline.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useTheme } from '@principal-ade/industry-theme';
|
|
8
|
+
import type { MetricCardProps } from '../types';
|
|
9
|
+
|
|
10
|
+
export function MetricCard({
|
|
11
|
+
title,
|
|
12
|
+
value,
|
|
13
|
+
unit,
|
|
14
|
+
description,
|
|
15
|
+
trend,
|
|
16
|
+
changePercent,
|
|
17
|
+
showTrend = true,
|
|
18
|
+
showSparkline = false,
|
|
19
|
+
sparklineData,
|
|
20
|
+
thresholds,
|
|
21
|
+
size = 'medium',
|
|
22
|
+
onClick,
|
|
23
|
+
}: MetricCardProps) {
|
|
24
|
+
const { theme } = useTheme();
|
|
25
|
+
|
|
26
|
+
// Font size indices into theme.fontSizes array
|
|
27
|
+
// Typical array: [12, 14, 16, 20, 24, 32, 48]
|
|
28
|
+
const sizeConfig = {
|
|
29
|
+
small: {
|
|
30
|
+
padding: '12px 16px',
|
|
31
|
+
titleIndex: 0, // ~12px
|
|
32
|
+
valueIndex: 4, // ~24px
|
|
33
|
+
unitIndex: 0, // ~12px
|
|
34
|
+
trendIndex: 0, // ~12px
|
|
35
|
+
},
|
|
36
|
+
medium: {
|
|
37
|
+
padding: '16px 20px',
|
|
38
|
+
titleIndex: 1, // ~14px
|
|
39
|
+
valueIndex: 5, // ~32px
|
|
40
|
+
unitIndex: 1, // ~14px
|
|
41
|
+
trendIndex: 0, // ~12px
|
|
42
|
+
},
|
|
43
|
+
large: {
|
|
44
|
+
padding: '20px 24px',
|
|
45
|
+
titleIndex: 2, // ~16px
|
|
46
|
+
valueIndex: 6, // ~48px
|
|
47
|
+
unitIndex: 2, // ~16px
|
|
48
|
+
trendIndex: 1, // ~14px
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const config = sizeConfig[size];
|
|
53
|
+
|
|
54
|
+
const getValueColor = () => {
|
|
55
|
+
if (!thresholds || typeof value !== 'number') {
|
|
56
|
+
return theme.colors.text;
|
|
57
|
+
}
|
|
58
|
+
if (thresholds.critical !== undefined && value >= thresholds.critical) {
|
|
59
|
+
return theme.colors.error;
|
|
60
|
+
}
|
|
61
|
+
if (thresholds.warning !== undefined && value >= thresholds.warning) {
|
|
62
|
+
return theme.colors.warning;
|
|
63
|
+
}
|
|
64
|
+
return theme.colors.success;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const getTrendIcon = () => {
|
|
68
|
+
if (!trend || !showTrend) return null;
|
|
69
|
+
|
|
70
|
+
const iconSize = size === 'small' ? 12 : 16;
|
|
71
|
+
const iconStyle: React.CSSProperties = {
|
|
72
|
+
width: iconSize,
|
|
73
|
+
height: iconSize,
|
|
74
|
+
marginRight: 4,
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
if (trend === 'up') {
|
|
78
|
+
return (
|
|
79
|
+
<svg style={iconStyle} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
80
|
+
<path d="M7 17l5-5 5 5M7 7l5 5 5-5" />
|
|
81
|
+
</svg>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
if (trend === 'down') {
|
|
85
|
+
return (
|
|
86
|
+
<svg style={iconStyle} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
87
|
+
<path d="M7 7l5 5 5-5M7 17l5-5 5 5" />
|
|
88
|
+
</svg>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return (
|
|
92
|
+
<svg style={iconStyle} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
93
|
+
<path d="M5 12h14" />
|
|
94
|
+
</svg>
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const getTrendColor = () => {
|
|
99
|
+
if (!trend) return theme.colors.textSecondary;
|
|
100
|
+
if (trend === 'up') return theme.colors.success;
|
|
101
|
+
if (trend === 'down') return theme.colors.error;
|
|
102
|
+
return theme.colors.textSecondary;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const formatValue = (val: number | string): string => {
|
|
106
|
+
if (typeof val === 'string') return val;
|
|
107
|
+
if (val >= 1000000) return `${(val / 1000000).toFixed(1)}M`;
|
|
108
|
+
if (val >= 1000) return `${(val / 1000).toFixed(1)}K`;
|
|
109
|
+
if (val % 1 !== 0) return val.toFixed(1);
|
|
110
|
+
return val.toString();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const renderSparkline = () => {
|
|
114
|
+
if (!showSparkline || !sparklineData || sparklineData.length < 2) return null;
|
|
115
|
+
|
|
116
|
+
const values = sparklineData
|
|
117
|
+
.map((point) => point.value)
|
|
118
|
+
.filter((v): v is number => typeof v === 'number');
|
|
119
|
+
|
|
120
|
+
if (values.length < 2) return null;
|
|
121
|
+
|
|
122
|
+
const minVal = Math.min(...values);
|
|
123
|
+
const maxVal = Math.max(...values);
|
|
124
|
+
const range = maxVal - minVal || 1;
|
|
125
|
+
|
|
126
|
+
const width = size === 'small' ? 100 : size === 'medium' ? 140 : 180;
|
|
127
|
+
const height = size === 'small' ? 24 : size === 'medium' ? 32 : 40;
|
|
128
|
+
const padding = 2;
|
|
129
|
+
|
|
130
|
+
const points = values.map((val, i) => {
|
|
131
|
+
const x = padding + (i / (values.length - 1)) * (width - padding * 2);
|
|
132
|
+
const y = height - padding - ((val - minVal) / range) * (height - padding * 2);
|
|
133
|
+
return `${x},${y}`;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const pathD = `M ${points.join(' L ')}`;
|
|
137
|
+
|
|
138
|
+
// Create gradient fill path
|
|
139
|
+
const fillPoints = [
|
|
140
|
+
`${padding},${height - padding}`,
|
|
141
|
+
...points,
|
|
142
|
+
`${width - padding},${height - padding}`,
|
|
143
|
+
];
|
|
144
|
+
const fillD = `M ${fillPoints.join(' L ')} Z`;
|
|
145
|
+
|
|
146
|
+
const lineColor = trend === 'up' ? theme.colors.success : trend === 'down' ? theme.colors.error : theme.colors.primary || theme.colors.accent;
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<div style={{ marginTop: theme.space?.[2] || 8 }}>
|
|
150
|
+
<svg width={width} height={height} style={{ display: 'block' }}>
|
|
151
|
+
<defs>
|
|
152
|
+
<linearGradient id={`sparkline-gradient-${title}`} x1="0%" y1="0%" x2="0%" y2="100%">
|
|
153
|
+
<stop offset="0%" stopColor={lineColor} stopOpacity={0.3} />
|
|
154
|
+
<stop offset="100%" stopColor={lineColor} stopOpacity={0.05} />
|
|
155
|
+
</linearGradient>
|
|
156
|
+
</defs>
|
|
157
|
+
<path d={fillD} fill={`url(#sparkline-gradient-${title})`} />
|
|
158
|
+
<path d={pathD} fill="none" stroke={lineColor} strokeWidth={1.5} strokeLinecap="round" strokeLinejoin="round" />
|
|
159
|
+
</svg>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
onClick={onClick}
|
|
167
|
+
style={{
|
|
168
|
+
backgroundColor: theme.colors.surface || theme.colors.background,
|
|
169
|
+
border: `1px solid ${theme.colors.border}`,
|
|
170
|
+
borderRadius: theme.radii?.[2] || 8,
|
|
171
|
+
padding: config.padding,
|
|
172
|
+
cursor: onClick ? 'pointer' : 'default',
|
|
173
|
+
transition: 'border-color 0.2s, box-shadow 0.2s',
|
|
174
|
+
minWidth: size === 'small' ? 140 : size === 'medium' ? 180 : 220,
|
|
175
|
+
fontFamily: theme.fonts.body,
|
|
176
|
+
}}
|
|
177
|
+
onMouseEnter={(e) => {
|
|
178
|
+
if (onClick) {
|
|
179
|
+
e.currentTarget.style.borderColor = theme.colors.primary || theme.colors.accent;
|
|
180
|
+
}
|
|
181
|
+
}}
|
|
182
|
+
onMouseLeave={(e) => {
|
|
183
|
+
e.currentTarget.style.borderColor = theme.colors.border;
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
{/* Title */}
|
|
187
|
+
<div
|
|
188
|
+
style={{
|
|
189
|
+
fontSize: theme.fontSizes[config.titleIndex],
|
|
190
|
+
color: theme.colors.textSecondary,
|
|
191
|
+
marginBottom: theme.space?.[2] || 8,
|
|
192
|
+
fontWeight: theme.fontWeights.medium,
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
{title}
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
{/* Value */}
|
|
199
|
+
<div
|
|
200
|
+
style={{
|
|
201
|
+
display: 'flex',
|
|
202
|
+
alignItems: 'baseline',
|
|
203
|
+
gap: 4,
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
<span
|
|
207
|
+
style={{
|
|
208
|
+
fontSize: theme.fontSizes[config.valueIndex],
|
|
209
|
+
fontWeight: theme.fontWeights.semibold,
|
|
210
|
+
color: getValueColor(),
|
|
211
|
+
fontVariantNumeric: 'tabular-nums',
|
|
212
|
+
fontFamily: theme.fonts.monospace,
|
|
213
|
+
}}
|
|
214
|
+
>
|
|
215
|
+
{formatValue(value)}
|
|
216
|
+
</span>
|
|
217
|
+
{unit && (
|
|
218
|
+
<span
|
|
219
|
+
style={{
|
|
220
|
+
fontSize: theme.fontSizes[config.unitIndex],
|
|
221
|
+
color: theme.colors.textSecondary,
|
|
222
|
+
}}
|
|
223
|
+
>
|
|
224
|
+
{unit}
|
|
225
|
+
</span>
|
|
226
|
+
)}
|
|
227
|
+
</div>
|
|
228
|
+
|
|
229
|
+
{/* Trend */}
|
|
230
|
+
{showTrend && (trend || changePercent !== undefined) && (
|
|
231
|
+
<div
|
|
232
|
+
style={{
|
|
233
|
+
display: 'flex',
|
|
234
|
+
alignItems: 'center',
|
|
235
|
+
marginTop: theme.space?.[2] || 8,
|
|
236
|
+
fontSize: theme.fontSizes[config.trendIndex],
|
|
237
|
+
color: getTrendColor(),
|
|
238
|
+
fontFamily: theme.fonts.monospace,
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
{getTrendIcon()}
|
|
242
|
+
{changePercent !== undefined && (
|
|
243
|
+
<span>
|
|
244
|
+
{changePercent > 0 ? '+' : ''}
|
|
245
|
+
{changePercent.toFixed(1)}%
|
|
246
|
+
</span>
|
|
247
|
+
)}
|
|
248
|
+
</div>
|
|
249
|
+
)}
|
|
250
|
+
|
|
251
|
+
{/* Description */}
|
|
252
|
+
{description && (
|
|
253
|
+
<div
|
|
254
|
+
style={{
|
|
255
|
+
fontSize: theme.fontSizes[config.trendIndex],
|
|
256
|
+
color: theme.colors.textSecondary,
|
|
257
|
+
marginTop: theme.space?.[2] || 8,
|
|
258
|
+
lineHeight: theme.lineHeights.body,
|
|
259
|
+
opacity: 0.8,
|
|
260
|
+
}}
|
|
261
|
+
>
|
|
262
|
+
{description}
|
|
263
|
+
</div>
|
|
264
|
+
)}
|
|
265
|
+
|
|
266
|
+
{/* Sparkline */}
|
|
267
|
+
{renderSparkline()}
|
|
268
|
+
</div>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SourceLink
|
|
3
|
+
*
|
|
4
|
+
* Displays a link to the workflow/canvas that sources a metric.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useTheme } from '@principal-ade/industry-theme';
|
|
8
|
+
import type { SourceLinkProps } from '../types';
|
|
9
|
+
|
|
10
|
+
export function SourceLink({ source, onClick }: SourceLinkProps) {
|
|
11
|
+
const { theme } = useTheme();
|
|
12
|
+
|
|
13
|
+
const formatSource = () => {
|
|
14
|
+
const parts = [source.storyboard, source.workflow];
|
|
15
|
+
if (source.nodes && source.nodes.length > 0) {
|
|
16
|
+
parts.push(source.nodes.join(', '));
|
|
17
|
+
}
|
|
18
|
+
if (source.event) {
|
|
19
|
+
parts.push(source.event);
|
|
20
|
+
}
|
|
21
|
+
return parts.join(' → ');
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<button
|
|
26
|
+
onClick={() => onClick?.(source)}
|
|
27
|
+
style={{
|
|
28
|
+
display: 'inline-flex',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
gap: 6,
|
|
31
|
+
padding: '4px 8px',
|
|
32
|
+
fontSize: theme.fontSizes[0],
|
|
33
|
+
fontFamily: theme.fonts.body,
|
|
34
|
+
color: theme.colors.primary || theme.colors.accent,
|
|
35
|
+
backgroundColor: 'transparent',
|
|
36
|
+
border: `1px solid ${theme.colors.border}`,
|
|
37
|
+
borderRadius: theme.radii?.[1] || 4,
|
|
38
|
+
cursor: 'pointer',
|
|
39
|
+
transition: 'background-color 0.2s',
|
|
40
|
+
}}
|
|
41
|
+
onMouseEnter={(e) => {
|
|
42
|
+
e.currentTarget.style.backgroundColor = theme.colors.surface || theme.colors.background;
|
|
43
|
+
}}
|
|
44
|
+
onMouseLeave={(e) => {
|
|
45
|
+
e.currentTarget.style.backgroundColor = 'transparent';
|
|
46
|
+
}}
|
|
47
|
+
>
|
|
48
|
+
{/* Link icon */}
|
|
49
|
+
<svg
|
|
50
|
+
width={12}
|
|
51
|
+
height={12}
|
|
52
|
+
viewBox="0 0 24 24"
|
|
53
|
+
fill="none"
|
|
54
|
+
stroke="currentColor"
|
|
55
|
+
strokeWidth={2}
|
|
56
|
+
>
|
|
57
|
+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" />
|
|
58
|
+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" />
|
|
59
|
+
</svg>
|
|
60
|
+
<span style={{ fontFamily: theme.fonts.monospace }}>{formatSource()}</span>
|
|
61
|
+
</button>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TimeRangeSelector
|
|
3
|
+
*
|
|
4
|
+
* Dropdown selector for time range and auto-refresh interval.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { useState, useRef, useEffect } from 'react';
|
|
8
|
+
import { useTheme } from '@principal-ade/industry-theme';
|
|
9
|
+
import type { TimeRangeSelectorProps, TimeRangePreset, RefreshInterval } from '../types';
|
|
10
|
+
|
|
11
|
+
const PRESET_LABELS: Record<TimeRangePreset, string> = {
|
|
12
|
+
last_5m: 'Last 5 minutes',
|
|
13
|
+
last_15m: 'Last 15 minutes',
|
|
14
|
+
last_30m: 'Last 30 minutes',
|
|
15
|
+
last_1h: 'Last 1 hour',
|
|
16
|
+
last_3h: 'Last 3 hours',
|
|
17
|
+
last_6h: 'Last 6 hours',
|
|
18
|
+
last_12h: 'Last 12 hours',
|
|
19
|
+
last_24h: 'Last 24 hours',
|
|
20
|
+
last_7d: 'Last 7 days',
|
|
21
|
+
last_30d: 'Last 30 days',
|
|
22
|
+
custom: 'Custom range',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const REFRESH_LABELS: Record<RefreshInterval, string> = {
|
|
26
|
+
off: 'Off',
|
|
27
|
+
'10s': '10 seconds',
|
|
28
|
+
'30s': '30 seconds',
|
|
29
|
+
'1m': '1 minute',
|
|
30
|
+
'5m': '5 minutes',
|
|
31
|
+
'10m': '10 minutes',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const DEFAULT_PRESETS: TimeRangePreset[] = [
|
|
35
|
+
'last_1h',
|
|
36
|
+
'last_3h',
|
|
37
|
+
'last_6h',
|
|
38
|
+
'last_12h',
|
|
39
|
+
'last_24h',
|
|
40
|
+
'last_7d',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const DEFAULT_REFRESH_INTERVALS: RefreshInterval[] = [
|
|
44
|
+
'off',
|
|
45
|
+
'30s',
|
|
46
|
+
'1m',
|
|
47
|
+
'5m',
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export function TimeRangeSelector({
|
|
51
|
+
timeRange,
|
|
52
|
+
onTimeRangeChange,
|
|
53
|
+
refreshInterval = 'off',
|
|
54
|
+
onRefreshIntervalChange,
|
|
55
|
+
config,
|
|
56
|
+
}: TimeRangeSelectorProps) {
|
|
57
|
+
const { theme } = useTheme();
|
|
58
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
59
|
+
const [activeTab, setActiveTab] = useState<'range' | 'refresh'>('range');
|
|
60
|
+
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
61
|
+
|
|
62
|
+
const presets = config?.presets ?? DEFAULT_PRESETS;
|
|
63
|
+
const refreshIntervals = config?.refreshIntervals ?? DEFAULT_REFRESH_INTERVALS;
|
|
64
|
+
|
|
65
|
+
// Close dropdown when clicking outside
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const handleClickOutside = (event: MouseEvent) => {
|
|
68
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target as Node)) {
|
|
69
|
+
setIsOpen(false);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
74
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
const getCurrentLabel = (): string => {
|
|
78
|
+
if (timeRange.preset && timeRange.preset !== 'custom') {
|
|
79
|
+
return PRESET_LABELS[timeRange.preset];
|
|
80
|
+
}
|
|
81
|
+
if (timeRange.start && timeRange.end) {
|
|
82
|
+
const formatDate = (d: Date) => d.toLocaleDateString();
|
|
83
|
+
return `${formatDate(timeRange.start)} - ${formatDate(timeRange.end)}`;
|
|
84
|
+
}
|
|
85
|
+
return 'Select time range';
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const handlePresetSelect = (preset: TimeRangePreset) => {
|
|
89
|
+
onTimeRangeChange({ preset });
|
|
90
|
+
setIsOpen(false);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const handleRefreshSelect = (interval: RefreshInterval) => {
|
|
94
|
+
onRefreshIntervalChange?.(interval);
|
|
95
|
+
setIsOpen(false);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const buttonStyle: React.CSSProperties = {
|
|
99
|
+
display: 'flex',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
gap: 8,
|
|
102
|
+
padding: '8px 12px',
|
|
103
|
+
backgroundColor: theme.colors.surface || theme.colors.background,
|
|
104
|
+
border: `1px solid ${theme.colors.border}`,
|
|
105
|
+
borderRadius: theme.radii?.[1] || 4,
|
|
106
|
+
fontSize: theme.fontSizes[1],
|
|
107
|
+
fontFamily: theme.fonts.body,
|
|
108
|
+
color: theme.colors.text,
|
|
109
|
+
cursor: 'pointer',
|
|
110
|
+
transition: 'border-color 0.2s',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const dropdownStyle: React.CSSProperties = {
|
|
114
|
+
position: 'absolute',
|
|
115
|
+
top: '100%',
|
|
116
|
+
right: 0,
|
|
117
|
+
marginTop: 4,
|
|
118
|
+
minWidth: 200,
|
|
119
|
+
backgroundColor: theme.colors.surface || theme.colors.background,
|
|
120
|
+
border: `1px solid ${theme.colors.border}`,
|
|
121
|
+
borderRadius: theme.radii?.[2] || 8,
|
|
122
|
+
boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
123
|
+
zIndex: 1000,
|
|
124
|
+
overflow: 'hidden',
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const tabStyle = (isActive: boolean): React.CSSProperties => ({
|
|
128
|
+
flex: 1,
|
|
129
|
+
padding: '8px 12px',
|
|
130
|
+
backgroundColor: isActive ? theme.colors.surface : 'transparent',
|
|
131
|
+
border: 'none',
|
|
132
|
+
borderBottom: isActive ? `2px solid ${theme.colors.primary || theme.colors.accent}` : '2px solid transparent',
|
|
133
|
+
fontSize: theme.fontSizes[0],
|
|
134
|
+
fontFamily: theme.fonts.body,
|
|
135
|
+
fontWeight: isActive ? theme.fontWeights.medium : theme.fontWeights.body,
|
|
136
|
+
color: isActive ? theme.colors.text : theme.colors.textSecondary,
|
|
137
|
+
cursor: 'pointer',
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const optionStyle = (isSelected: boolean): React.CSSProperties => ({
|
|
141
|
+
display: 'flex',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
justifyContent: 'space-between',
|
|
144
|
+
padding: '8px 12px',
|
|
145
|
+
backgroundColor: isSelected ? (theme.colors.primary || theme.colors.accent) + '15' : 'transparent',
|
|
146
|
+
border: 'none',
|
|
147
|
+
width: '100%',
|
|
148
|
+
textAlign: 'left',
|
|
149
|
+
fontSize: theme.fontSizes[1],
|
|
150
|
+
fontFamily: theme.fonts.body,
|
|
151
|
+
color: theme.colors.text,
|
|
152
|
+
cursor: 'pointer',
|
|
153
|
+
transition: 'background-color 0.15s',
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<div ref={dropdownRef} style={{ position: 'relative', display: 'inline-block' }}>
|
|
158
|
+
{/* Main button */}
|
|
159
|
+
<button
|
|
160
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
161
|
+
style={buttonStyle}
|
|
162
|
+
onMouseEnter={(e) => {
|
|
163
|
+
e.currentTarget.style.borderColor = theme.colors.primary || theme.colors.accent;
|
|
164
|
+
}}
|
|
165
|
+
onMouseLeave={(e) => {
|
|
166
|
+
e.currentTarget.style.borderColor = theme.colors.border;
|
|
167
|
+
}}
|
|
168
|
+
>
|
|
169
|
+
{/* Clock icon */}
|
|
170
|
+
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
171
|
+
<circle cx="12" cy="12" r="10" />
|
|
172
|
+
<polyline points="12 6 12 12 16 14" />
|
|
173
|
+
</svg>
|
|
174
|
+
<span>{getCurrentLabel()}</span>
|
|
175
|
+
{/* Chevron */}
|
|
176
|
+
<svg
|
|
177
|
+
width={12}
|
|
178
|
+
height={12}
|
|
179
|
+
viewBox="0 0 24 24"
|
|
180
|
+
fill="none"
|
|
181
|
+
stroke="currentColor"
|
|
182
|
+
strokeWidth={2}
|
|
183
|
+
style={{ transform: isOpen ? 'rotate(180deg)' : 'rotate(0)', transition: 'transform 0.2s' }}
|
|
184
|
+
>
|
|
185
|
+
<polyline points="6 9 12 15 18 9" />
|
|
186
|
+
</svg>
|
|
187
|
+
{/* Refresh indicator */}
|
|
188
|
+
{refreshInterval !== 'off' && (
|
|
189
|
+
<span
|
|
190
|
+
style={{
|
|
191
|
+
marginLeft: 4,
|
|
192
|
+
padding: '2px 6px',
|
|
193
|
+
backgroundColor: theme.colors.primary || theme.colors.accent,
|
|
194
|
+
color: theme.colors.background,
|
|
195
|
+
fontSize: theme.fontSizes[0],
|
|
196
|
+
borderRadius: theme.radii?.[1] || 4,
|
|
197
|
+
fontWeight: theme.fontWeights.medium,
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{refreshInterval}
|
|
201
|
+
</span>
|
|
202
|
+
)}
|
|
203
|
+
</button>
|
|
204
|
+
|
|
205
|
+
{/* Dropdown */}
|
|
206
|
+
{isOpen && (
|
|
207
|
+
<div style={dropdownStyle}>
|
|
208
|
+
{/* Tabs */}
|
|
209
|
+
{onRefreshIntervalChange && (
|
|
210
|
+
<div style={{ display: 'flex', borderBottom: `1px solid ${theme.colors.border}` }}>
|
|
211
|
+
<button style={tabStyle(activeTab === 'range')} onClick={() => setActiveTab('range')}>
|
|
212
|
+
Time Range
|
|
213
|
+
</button>
|
|
214
|
+
<button style={tabStyle(activeTab === 'refresh')} onClick={() => setActiveTab('refresh')}>
|
|
215
|
+
Auto Refresh
|
|
216
|
+
</button>
|
|
217
|
+
</div>
|
|
218
|
+
)}
|
|
219
|
+
|
|
220
|
+
{/* Options */}
|
|
221
|
+
<div style={{ maxHeight: 300, overflowY: 'auto' }}>
|
|
222
|
+
{activeTab === 'range' &&
|
|
223
|
+
presets.map((preset) => (
|
|
224
|
+
<button
|
|
225
|
+
key={preset}
|
|
226
|
+
onClick={() => handlePresetSelect(preset)}
|
|
227
|
+
style={optionStyle(timeRange.preset === preset)}
|
|
228
|
+
onMouseEnter={(e) => {
|
|
229
|
+
if (timeRange.preset !== preset) {
|
|
230
|
+
e.currentTarget.style.backgroundColor = theme.colors.border + '40';
|
|
231
|
+
}
|
|
232
|
+
}}
|
|
233
|
+
onMouseLeave={(e) => {
|
|
234
|
+
e.currentTarget.style.backgroundColor =
|
|
235
|
+
timeRange.preset === preset
|
|
236
|
+
? (theme.colors.primary || theme.colors.accent) + '15'
|
|
237
|
+
: 'transparent';
|
|
238
|
+
}}
|
|
239
|
+
>
|
|
240
|
+
<span>{PRESET_LABELS[preset]}</span>
|
|
241
|
+
{timeRange.preset === preset && (
|
|
242
|
+
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
243
|
+
<polyline points="20 6 9 17 4 12" />
|
|
244
|
+
</svg>
|
|
245
|
+
)}
|
|
246
|
+
</button>
|
|
247
|
+
))}
|
|
248
|
+
|
|
249
|
+
{activeTab === 'refresh' &&
|
|
250
|
+
refreshIntervals.map((interval) => (
|
|
251
|
+
<button
|
|
252
|
+
key={interval}
|
|
253
|
+
onClick={() => handleRefreshSelect(interval)}
|
|
254
|
+
style={optionStyle(refreshInterval === interval)}
|
|
255
|
+
onMouseEnter={(e) => {
|
|
256
|
+
if (refreshInterval !== interval) {
|
|
257
|
+
e.currentTarget.style.backgroundColor = theme.colors.border + '40';
|
|
258
|
+
}
|
|
259
|
+
}}
|
|
260
|
+
onMouseLeave={(e) => {
|
|
261
|
+
e.currentTarget.style.backgroundColor =
|
|
262
|
+
refreshInterval === interval
|
|
263
|
+
? (theme.colors.primary || theme.colors.accent) + '15'
|
|
264
|
+
: 'transparent';
|
|
265
|
+
}}
|
|
266
|
+
>
|
|
267
|
+
<span>{REFRESH_LABELS[interval]}</span>
|
|
268
|
+
{refreshInterval === interval && (
|
|
269
|
+
<svg width={14} height={14} viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth={2}>
|
|
270
|
+
<polyline points="20 6 9 17 4 12" />
|
|
271
|
+
</svg>
|
|
272
|
+
)}
|
|
273
|
+
</button>
|
|
274
|
+
))}
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
)}
|
|
278
|
+
</div>
|
|
279
|
+
);
|
|
280
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Main renderer
|
|
2
|
+
export { DashboardRenderer } from './DashboardRenderer';
|
|
3
|
+
export { MetricPanel } from './MetricPanel';
|
|
4
|
+
|
|
5
|
+
// Individual components
|
|
6
|
+
export { MetricCard, LineChart, BarChart, SourceLink, TimeRangeSelector } from './components';
|
|
7
|
+
|
|
8
|
+
// Data providers
|
|
9
|
+
export { MockDataProvider, createMockDataProvider } from './MockDataProvider';
|
|
10
|
+
|
|
11
|
+
// Types
|
|
12
|
+
export type {
|
|
13
|
+
// Dashboard definition types
|
|
14
|
+
DashboardDefinition,
|
|
15
|
+
MetricDefinition,
|
|
16
|
+
MetricType,
|
|
17
|
+
MetricSource,
|
|
18
|
+
MetricQuery,
|
|
19
|
+
Derivation,
|
|
20
|
+
TimeGroup,
|
|
21
|
+
AlertDefinition,
|
|
22
|
+
MetricDisplay,
|
|
23
|
+
DisplayComponent,
|
|
24
|
+
DashboardLayout,
|
|
25
|
+
DashboardRow,
|
|
26
|
+
PanelPlacement,
|
|
27
|
+
// Time range types
|
|
28
|
+
TimeRangePreset,
|
|
29
|
+
TimeRange,
|
|
30
|
+
RefreshInterval,
|
|
31
|
+
TimeRangeConfig,
|
|
32
|
+
// Mock data types
|
|
33
|
+
MockMetricData,
|
|
34
|
+
TimeSeriesPoint,
|
|
35
|
+
HistogramData,
|
|
36
|
+
// Runtime types
|
|
37
|
+
MetricData,
|
|
38
|
+
DataProvider,
|
|
39
|
+
// Component props
|
|
40
|
+
DashboardRendererProps,
|
|
41
|
+
MetricPanelProps,
|
|
42
|
+
MetricCardProps,
|
|
43
|
+
LineChartProps,
|
|
44
|
+
BarChartProps,
|
|
45
|
+
SourceLinkProps,
|
|
46
|
+
TimeRangeSelectorProps,
|
|
47
|
+
} from './types';
|