@flanksource/clicky-ui 0.3.44 → 0.3.46
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 +24 -0
- package/dist/ai.cjs +4 -2
- package/dist/ai.cjs.map +1 -1
- package/dist/ai.js +3 -1
- package/dist/components/MdxEditorField.cjs +40 -22
- package/dist/components/MdxEditorField.cjs.map +1 -1
- package/dist/components/MdxEditorField.d.ts.map +1 -1
- package/dist/components/MdxEditorField.js +41 -23
- package/dist/components/MdxEditorField.js.map +1 -1
- package/dist/components/json-schema-form-item-summary.cjs +6 -1
- package/dist/components/json-schema-form-item-summary.cjs.map +1 -1
- package/dist/components/json-schema-form-item-summary.d.ts.map +1 -1
- package/dist/components/json-schema-form-item-summary.js +6 -1
- package/dist/components/json-schema-form-item-summary.js.map +1 -1
- package/dist/data/AccessMark.cjs +23 -0
- package/dist/data/AccessMark.cjs.map +1 -0
- package/dist/data/AccessMark.d.ts +11 -0
- package/dist/data/AccessMark.d.ts.map +1 -0
- package/dist/data/AccessMark.js +23 -0
- package/dist/data/AccessMark.js.map +1 -0
- package/dist/data/CodeBlock.cjs +3 -2
- package/dist/data/CodeBlock.cjs.map +1 -1
- package/dist/data/CodeBlock.d.ts +3 -1
- package/dist/data/CodeBlock.d.ts.map +1 -1
- package/dist/data/CodeBlock.js +3 -2
- package/dist/data/CodeBlock.js.map +1 -1
- package/dist/data/CodeDiff.cjs +116 -23
- package/dist/data/CodeDiff.cjs.map +1 -1
- package/dist/data/CodeDiff.d.ts +26 -0
- package/dist/data/CodeDiff.d.ts.map +1 -1
- package/dist/data/CodeDiff.js +116 -23
- package/dist/data/CodeDiff.js.map +1 -1
- package/dist/data/GraphDiagram.cjs +75 -11
- package/dist/data/GraphDiagram.cjs.map +1 -1
- package/dist/data/GraphDiagram.d.ts +17 -2
- package/dist/data/GraphDiagram.d.ts.map +1 -1
- package/dist/data/GraphDiagram.js +76 -12
- package/dist/data/GraphDiagram.js.map +1 -1
- package/dist/data/GraphDiagramGroups.cjs +100 -0
- package/dist/data/GraphDiagramGroups.cjs.map +1 -0
- package/dist/data/GraphDiagramGroups.d.ts +24 -0
- package/dist/data/GraphDiagramGroups.d.ts.map +1 -0
- package/dist/data/GraphDiagramGroups.js +100 -0
- package/dist/data/GraphDiagramGroups.js.map +1 -0
- package/dist/data/GraphDiagramNodes.cjs +46 -51
- package/dist/data/GraphDiagramNodes.cjs.map +1 -1
- package/dist/data/GraphDiagramNodes.d.ts +8 -9
- package/dist/data/GraphDiagramNodes.d.ts.map +1 -1
- package/dist/data/GraphDiagramNodes.js +46 -51
- package/dist/data/GraphDiagramNodes.js.map +1 -1
- package/dist/data/JsonView.cjs +118 -49
- package/dist/data/JsonView.cjs.map +1 -1
- package/dist/data/JsonView.d.ts +13 -10
- package/dist/data/JsonView.d.ts.map +1 -1
- package/dist/data/JsonView.js +118 -49
- package/dist/data/JsonView.js.map +1 -1
- package/dist/data/MarkdownEditor.cjs +2 -2
- package/dist/data/MarkdownEditor.cjs.map +1 -1
- package/dist/data/MarkdownEditor.js +2 -2
- package/dist/data/MarkdownEditor.js.map +1 -1
- package/dist/data/TreeNode.cjs +1 -1
- package/dist/data/TreeNode.cjs.map +1 -1
- package/dist/data/TreeNode.d.ts.map +1 -1
- package/dist/data/TreeNode.js +1 -1
- package/dist/data/TreeNode.js.map +1 -1
- package/dist/data/ai/AdvancedChatConfig.cjs +90 -249
- package/dist/data/ai/AdvancedChatConfig.cjs.map +1 -1
- package/dist/data/ai/AdvancedChatConfig.d.ts +2 -5
- package/dist/data/ai/AdvancedChatConfig.d.ts.map +1 -1
- package/dist/data/ai/AdvancedChatConfig.js +91 -250
- package/dist/data/ai/AdvancedChatConfig.js.map +1 -1
- package/dist/data/ai/ChatButton.cjs +2 -0
- package/dist/data/ai/ChatButton.cjs.map +1 -1
- package/dist/data/ai/ChatButton.d.ts +1 -1
- package/dist/data/ai/ChatButton.d.ts.map +1 -1
- package/dist/data/ai/ChatButton.js +2 -0
- package/dist/data/ai/ChatButton.js.map +1 -1
- package/dist/data/ai/ChatFab.cjs +5 -1
- package/dist/data/ai/ChatFab.cjs.map +1 -1
- package/dist/data/ai/ChatFab.d.ts +5 -1
- package/dist/data/ai/ChatFab.d.ts.map +1 -1
- package/dist/data/ai/ChatFab.js +5 -1
- package/dist/data/ai/ChatFab.js.map +1 -1
- package/dist/data/ai/ChatWindow.cjs +2 -8
- package/dist/data/ai/ChatWindow.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.js +2 -8
- package/dist/data/ai/ChatWindow.js.map +1 -1
- package/dist/data/ai/ChatWindow.runtime.cjs +0 -5
- package/dist/data/ai/ChatWindow.runtime.cjs.map +1 -1
- package/dist/data/ai/ChatWindow.runtime.d.ts +0 -2
- package/dist/data/ai/ChatWindow.runtime.d.ts.map +1 -1
- package/dist/data/ai/ChatWindow.runtime.js +0 -5
- package/dist/data/ai/ChatWindow.runtime.js.map +1 -1
- package/dist/data/ai/PromptRunEditor/runtimeActions.cjs +2 -2
- package/dist/data/ai/PromptRunEditor/runtimeActions.cjs.map +1 -1
- package/dist/data/ai/PromptRunEditor/runtimeActions.d.ts.map +1 -1
- package/dist/data/ai/PromptRunEditor/runtimeActions.js +2 -2
- package/dist/data/ai/PromptRunEditor/runtimeActions.js.map +1 -1
- package/dist/data/ai/SessionInspector.approvals.cjs +3 -6
- package/dist/data/ai/SessionInspector.approvals.cjs.map +1 -1
- package/dist/data/ai/SessionInspector.approvals.js +3 -6
- package/dist/data/ai/SessionInspector.approvals.js.map +1 -1
- package/dist/data/ai/SessionViewer.cjs +13 -4
- package/dist/data/ai/SessionViewer.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.d.ts +5 -1
- package/dist/data/ai/SessionViewer.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.header.cjs +1 -1
- package/dist/data/ai/SessionViewer.header.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.header.js +1 -1
- package/dist/data/ai/SessionViewer.header.js.map +1 -1
- package/dist/data/ai/SessionViewer.js +13 -4
- package/dist/data/ai/SessionViewer.js.map +1 -1
- package/dist/data/ai/SessionViewer.model.cjs +2 -0
- package/dist/data/ai/SessionViewer.model.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.model.d.ts +1 -0
- package/dist/data/ai/SessionViewer.model.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.model.js +2 -0
- package/dist/data/ai/SessionViewer.model.js.map +1 -1
- package/dist/data/ai/SessionViewer.rows.cjs +41 -27
- package/dist/data/ai/SessionViewer.rows.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.rows.d.ts +4 -2
- package/dist/data/ai/SessionViewer.rows.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.rows.js +41 -27
- package/dist/data/ai/SessionViewer.rows.js.map +1 -1
- package/dist/data/ai/SessionViewer.tokens.cjs +35 -0
- package/dist/data/ai/SessionViewer.tokens.cjs.map +1 -0
- package/dist/data/ai/SessionViewer.tokens.d.ts +5 -0
- package/dist/data/ai/SessionViewer.tokens.d.ts.map +1 -0
- package/dist/data/ai/SessionViewer.tokens.js +35 -0
- package/dist/data/ai/SessionViewer.tokens.js.map +1 -0
- package/dist/data/ai/SessionViewer.tool-cost.cjs +128 -0
- package/dist/data/ai/SessionViewer.tool-cost.cjs.map +1 -0
- package/dist/data/ai/SessionViewer.tool-cost.d.ts +6 -0
- package/dist/data/ai/SessionViewer.tool-cost.d.ts.map +1 -0
- package/dist/data/ai/SessionViewer.tool-cost.js +128 -0
- package/dist/data/ai/SessionViewer.tool-cost.js.map +1 -0
- package/dist/data/ai/SessionViewer.tool-details.cjs +3 -1
- package/dist/data/ai/SessionViewer.tool-details.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-details.js +3 -1
- package/dist/data/ai/SessionViewer.tool-details.js.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.cjs +55 -35
- package/dist/data/ai/SessionViewer.tool-row.cjs.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.d.ts +2 -1
- package/dist/data/ai/SessionViewer.tool-row.d.ts.map +1 -1
- package/dist/data/ai/SessionViewer.tool-row.js +55 -35
- package/dist/data/ai/SessionViewer.tool-row.js.map +1 -1
- package/dist/data/ai/SessionViewer.unified.d.ts +4 -0
- package/dist/data/ai/SessionViewer.unified.d.ts.map +1 -1
- package/dist/data/ai/SessionViewerMenu.cjs +18 -1
- package/dist/data/ai/SessionViewerMenu.cjs.map +1 -1
- package/dist/data/ai/SessionViewerMenu.d.ts +6 -1
- package/dist/data/ai/SessionViewerMenu.d.ts.map +1 -1
- package/dist/data/ai/SessionViewerMenu.js +18 -1
- package/dist/data/ai/SessionViewerMenu.js.map +1 -1
- package/dist/data/ai/ToolPreferences.cjs +149 -143
- package/dist/data/ai/ToolPreferences.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.d.ts +20 -6
- package/dist/data/ai/ToolPreferences.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.js +151 -146
- package/dist/data/ai/ToolPreferences.js.map +1 -1
- package/dist/data/ai/ToolPreferences.model.cjs +14 -10
- package/dist/data/ai/ToolPreferences.model.cjs.map +1 -1
- package/dist/data/ai/ToolPreferences.model.d.ts +1 -0
- package/dist/data/ai/ToolPreferences.model.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferences.model.js +15 -11
- package/dist/data/ai/ToolPreferences.model.js.map +1 -1
- package/dist/data/ai/ToolPreferencesList.cjs +1 -0
- package/dist/data/ai/ToolPreferencesList.cjs.map +1 -1
- package/dist/data/ai/ToolPreferencesList.d.ts +4 -1
- package/dist/data/ai/ToolPreferencesList.d.ts.map +1 -1
- package/dist/data/ai/ToolPreferencesList.js +2 -1
- package/dist/data/ai/ToolPreferencesList.js.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.cjs +52 -53
- package/dist/data/ai/ToolSchemaBrowser.cjs.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.d.ts +6 -3
- package/dist/data/ai/ToolSchemaBrowser.d.ts.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.directory-header.cjs +9 -13
- package/dist/data/ai/ToolSchemaBrowser.directory-header.cjs.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.directory-header.d.ts +5 -2
- package/dist/data/ai/ToolSchemaBrowser.directory-header.d.ts.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.directory-header.js +9 -13
- package/dist/data/ai/ToolSchemaBrowser.directory-header.js.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.js +53 -54
- package/dist/data/ai/ToolSchemaBrowser.js.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.model.cjs +19 -27
- package/dist/data/ai/ToolSchemaBrowser.model.cjs.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.model.d.ts +9 -6
- package/dist/data/ai/ToolSchemaBrowser.model.d.ts.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.model.js +20 -28
- package/dist/data/ai/ToolSchemaBrowser.model.js.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.sidebar.cjs +12 -213
- package/dist/data/ai/ToolSchemaBrowser.sidebar.cjs.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.sidebar.d.ts +1 -3
- package/dist/data/ai/ToolSchemaBrowser.sidebar.d.ts.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.sidebar.js +13 -214
- package/dist/data/ai/ToolSchemaBrowser.sidebar.js.map +1 -1
- package/dist/data/ai/ToolSchemaBrowser.strategies.cjs +54 -0
- package/dist/data/ai/ToolSchemaBrowser.strategies.cjs.map +1 -0
- package/dist/data/ai/ToolSchemaBrowser.strategies.d.ts +9 -0
- package/dist/data/ai/ToolSchemaBrowser.strategies.d.ts.map +1 -0
- package/dist/data/ai/ToolSchemaBrowser.strategies.js +54 -0
- package/dist/data/ai/ToolSchemaBrowser.strategies.js.map +1 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.cjs +179 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.cjs.map +1 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.d.ts +20 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.d.ts.map +1 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.js +179 -0
- package/dist/data/ai/ToolSchemaBrowser.tree.js.map +1 -0
- package/dist/data/ai/index.d.ts +2 -2
- package/dist/data/ai/index.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.cjs +8 -28
- package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.cjs.map +1 -1
- package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.d.ts.map +1 -1
- package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.js +9 -29
- package/dist/data/ai/runtime-profiles/PermissionStrategiesEditor.js.map +1 -1
- package/dist/data/ai/session-token-sizing.d.ts +32 -0
- package/dist/data/ai/session-token-sizing.d.ts.map +1 -0
- package/dist/data/ai/use-session-token-sizing.cjs +73 -0
- package/dist/data/ai/use-session-token-sizing.cjs.map +1 -0
- package/dist/data/ai/use-session-token-sizing.d.ts +21 -0
- package/dist/data/ai/use-session-token-sizing.d.ts.map +1 -0
- package/dist/data/ai/use-session-token-sizing.js +73 -0
- package/dist/data/ai/use-session-token-sizing.js.map +1 -0
- package/dist/data/call-graph/CallGraph.cjs +269 -0
- package/dist/data/call-graph/CallGraph.cjs.map +1 -0
- package/dist/data/call-graph/CallGraph.d.ts +78 -0
- package/dist/data/call-graph/CallGraph.d.ts.map +1 -0
- package/dist/data/call-graph/CallGraph.js +269 -0
- package/dist/data/call-graph/CallGraph.js.map +1 -0
- package/dist/data/call-graph/CallGraphGlyphs.cjs +39 -0
- package/dist/data/call-graph/CallGraphGlyphs.cjs.map +1 -0
- package/dist/data/call-graph/CallGraphGlyphs.d.ts +19 -0
- package/dist/data/call-graph/CallGraphGlyphs.d.ts.map +1 -0
- package/dist/data/call-graph/CallGraphGlyphs.js +39 -0
- package/dist/data/call-graph/CallGraphGlyphs.js.map +1 -0
- package/dist/data/call-graph/CallGraphMembers.cjs +51 -0
- package/dist/data/call-graph/CallGraphMembers.cjs.map +1 -0
- package/dist/data/call-graph/CallGraphMembers.d.ts +22 -0
- package/dist/data/call-graph/CallGraphMembers.d.ts.map +1 -0
- package/dist/data/call-graph/CallGraphMembers.js +51 -0
- package/dist/data/call-graph/CallGraphMembers.js.map +1 -0
- package/dist/data/call-graph/CallGraphParts.cjs +204 -0
- package/dist/data/call-graph/CallGraphParts.cjs.map +1 -0
- package/dist/data/call-graph/CallGraphParts.d.ts +44 -0
- package/dist/data/call-graph/CallGraphParts.d.ts.map +1 -0
- package/dist/data/call-graph/CallGraphParts.js +204 -0
- package/dist/data/call-graph/CallGraphParts.js.map +1 -0
- package/dist/data/call-graph/CallGraphToolbar.cjs +198 -0
- package/dist/data/call-graph/CallGraphToolbar.cjs.map +1 -0
- package/dist/data/call-graph/CallGraphToolbar.d.ts +55 -0
- package/dist/data/call-graph/CallGraphToolbar.d.ts.map +1 -0
- package/dist/data/call-graph/CallGraphToolbar.js +198 -0
- package/dist/data/call-graph/CallGraphToolbar.js.map +1 -0
- package/dist/data/call-graph/call-graph-exclude.cjs +75 -0
- package/dist/data/call-graph/call-graph-exclude.cjs.map +1 -0
- package/dist/data/call-graph/call-graph-exclude.d.ts +31 -0
- package/dist/data/call-graph/call-graph-exclude.d.ts.map +1 -0
- package/dist/data/call-graph/call-graph-exclude.js +75 -0
- package/dist/data/call-graph/call-graph-exclude.js.map +1 -0
- package/dist/data/call-graph/call-graph-labels.cjs +96 -0
- package/dist/data/call-graph/call-graph-labels.cjs.map +1 -0
- package/dist/data/call-graph/call-graph-labels.d.ts +53 -0
- package/dist/data/call-graph/call-graph-labels.d.ts.map +1 -0
- package/dist/data/call-graph/call-graph-labels.js +96 -0
- package/dist/data/call-graph/call-graph-labels.js.map +1 -0
- package/dist/data/call-graph/call-graph-model.cjs +312 -0
- package/dist/data/call-graph/call-graph-model.cjs.map +1 -0
- package/dist/data/call-graph/call-graph-model.d.ts +138 -0
- package/dist/data/call-graph/call-graph-model.d.ts.map +1 -0
- package/dist/data/call-graph/call-graph-model.js +312 -0
- package/dist/data/call-graph/call-graph-model.js.map +1 -0
- package/dist/data/call-graph/call-graph-vocabulary.cjs +195 -0
- package/dist/data/call-graph/call-graph-vocabulary.cjs.map +1 -0
- package/dist/data/call-graph/call-graph-vocabulary.d.ts +76 -0
- package/dist/data/call-graph/call-graph-vocabulary.d.ts.map +1 -0
- package/dist/data/call-graph/call-graph-vocabulary.js +195 -0
- package/dist/data/call-graph/call-graph-vocabulary.js.map +1 -0
- package/dist/data/call-graph/call-graph.fixtures.d.ts +63 -0
- package/dist/data/call-graph/call-graph.fixtures.d.ts.map +1 -0
- package/dist/data/call-graph/index.d.ts +7 -0
- package/dist/data/call-graph/index.d.ts.map +1 -0
- package/dist/data/call-graph/types.cjs +5 -0
- package/dist/data/call-graph/types.cjs.map +1 -0
- package/dist/data/call-graph/types.d.ts +140 -0
- package/dist/data/call-graph/types.d.ts.map +1 -0
- package/dist/data/call-graph/types.js +5 -0
- package/dist/data/call-graph/types.js.map +1 -0
- package/dist/data/call-graph/use-call-graph.cjs +93 -0
- package/dist/data/call-graph/use-call-graph.cjs.map +1 -0
- package/dist/data/call-graph/use-call-graph.d.ts +24 -0
- package/dist/data/call-graph/use-call-graph.d.ts.map +1 -0
- package/dist/data/call-graph/use-call-graph.js +93 -0
- package/dist/data/call-graph/use-call-graph.js.map +1 -0
- package/dist/data/chat/Chat.cjs +39 -15
- package/dist/data/chat/Chat.cjs.map +1 -1
- package/dist/data/chat/Chat.d.ts.map +1 -1
- package/dist/data/chat/Chat.fixtures.cjs +2 -2
- package/dist/data/chat/Chat.fixtures.cjs.map +1 -1
- package/dist/data/chat/Chat.fixtures.js +2 -2
- package/dist/data/chat/Chat.fixtures.js.map +1 -1
- package/dist/data/chat/Chat.js +40 -16
- package/dist/data/chat/Chat.js.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.cjs +3 -6
- package/dist/data/chat/ChatRuntimeToolbar.cjs.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.d.ts.map +1 -1
- package/dist/data/chat/ChatRuntimeToolbar.js +3 -6
- package/dist/data/chat/ChatRuntimeToolbar.js.map +1 -1
- package/dist/data/chat/ContextMeter.bar.cjs +5 -8
- package/dist/data/chat/ContextMeter.bar.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.bar.d.ts +1 -1
- package/dist/data/chat/ContextMeter.bar.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.bar.js +5 -8
- package/dist/data/chat/ContextMeter.bar.js.map +1 -1
- package/dist/data/chat/ContextMeter.cjs +18 -19
- package/dist/data/chat/ContextMeter.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.d.ts +1 -1
- package/dist/data/chat/ContextMeter.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.js +18 -19
- package/dist/data/chat/ContextMeter.js.map +1 -1
- package/dist/data/chat/Conversation.cjs +2 -1
- package/dist/data/chat/Conversation.cjs.map +1 -1
- package/dist/data/chat/Conversation.d.ts +4 -1
- package/dist/data/chat/Conversation.d.ts.map +1 -1
- package/dist/data/chat/Conversation.js +2 -1
- package/dist/data/chat/Conversation.js.map +1 -1
- package/dist/data/chat/Message.cjs +39 -12
- package/dist/data/chat/Message.cjs.map +1 -1
- package/dist/data/chat/Message.d.ts +1 -1
- package/dist/data/chat/Message.d.ts.map +1 -1
- package/dist/data/chat/Message.js +40 -13
- package/dist/data/chat/Message.js.map +1 -1
- package/dist/data/chat/ToolCall.cjs +60 -5
- package/dist/data/chat/ToolCall.cjs.map +1 -1
- package/dist/data/chat/ToolCall.d.ts +7 -2
- package/dist/data/chat/ToolCall.d.ts.map +1 -1
- package/dist/data/chat/ToolCall.js +60 -5
- package/dist/data/chat/ToolCall.js.map +1 -1
- package/dist/data/chat/approval.cjs.map +1 -1
- package/dist/data/chat/approval.d.ts +2 -2
- package/dist/data/chat/approval.d.ts.map +1 -1
- package/dist/data/chat/approval.js.map +1 -1
- package/dist/data/chat/tool-policy.cjs +59 -2
- package/dist/data/chat/tool-policy.cjs.map +1 -1
- package/dist/data/chat/tool-policy.d.ts +9 -0
- package/dist/data/chat/tool-policy.d.ts.map +1 -1
- package/dist/data/chat/tool-policy.js +59 -2
- package/dist/data/chat/tool-policy.js.map +1 -1
- package/dist/data/chat/types.cjs +6 -0
- package/dist/data/chat/types.cjs.map +1 -1
- package/dist/data/chat/types.d.ts +13 -4
- package/dist/data/chat/types.d.ts.map +1 -1
- package/dist/data/chat/types.js +7 -1
- package/dist/data/chat/types.js.map +1 -1
- package/dist/data/chat/usage-snapshot.cjs +11 -6
- package/dist/data/chat/usage-snapshot.cjs.map +1 -1
- package/dist/data/chat/usage-snapshot.d.ts +0 -1
- package/dist/data/chat/usage-snapshot.d.ts.map +1 -1
- package/dist/data/chat/usage-snapshot.js +11 -6
- package/dist/data/chat/usage-snapshot.js.map +1 -1
- package/dist/data/data-access.cjs +8 -0
- package/dist/data/data-access.cjs.map +1 -0
- package/dist/data/data-access.d.ts +5 -0
- package/dist/data/data-access.d.ts.map +1 -0
- package/dist/data/data-access.js +8 -0
- package/dist/data/data-access.js.map +1 -0
- package/dist/data/diagnostics/StackFrameRow.cjs +3 -3
- package/dist/data/diagnostics/StackFrameRow.cjs.map +1 -1
- package/dist/data/diagnostics/StackFrameRow.js +3 -3
- package/dist/data/diagnostics/StackFrameRow.js.map +1 -1
- package/dist/data/git/GitChangeList.cjs +6 -2
- package/dist/data/git/GitChangeList.cjs.map +1 -1
- package/dist/data/git/GitChangeList.d.ts +6 -1
- package/dist/data/git/GitChangeList.d.ts.map +1 -1
- package/dist/data/git/GitChangeList.js +6 -2
- package/dist/data/git/GitChangeList.js.map +1 -1
- package/dist/data/graph-columns-layout.cjs +61 -14
- package/dist/data/graph-columns-layout.cjs.map +1 -1
- package/dist/data/graph-columns-layout.d.ts +42 -0
- package/dist/data/graph-columns-layout.d.ts.map +1 -1
- package/dist/data/graph-columns-layout.js +61 -14
- package/dist/data/graph-columns-layout.js.map +1 -1
- package/dist/data/graph-diagram-model.cjs +5 -0
- package/dist/data/graph-diagram-model.cjs.map +1 -1
- package/dist/data/graph-diagram-model.d.ts +24 -0
- package/dist/data/graph-diagram-model.d.ts.map +1 -1
- package/dist/data/graph-diagram-model.js +5 -0
- package/dist/data/graph-diagram-model.js.map +1 -1
- package/dist/data/graph-edge-routing.cjs +9 -3
- package/dist/data/graph-edge-routing.cjs.map +1 -1
- package/dist/data/graph-edge-routing.d.ts +2 -0
- package/dist/data/graph-edge-routing.d.ts.map +1 -1
- package/dist/data/graph-edge-routing.js +9 -3
- package/dist/data/graph-edge-routing.js.map +1 -1
- package/dist/data/graph-group-window.cjs +60 -0
- package/dist/data/graph-group-window.cjs.map +1 -0
- package/dist/data/graph-group-window.d.ts +33 -0
- package/dist/data/graph-group-window.d.ts.map +1 -0
- package/dist/data/graph-group-window.js +60 -0
- package/dist/data/graph-group-window.js.map +1 -0
- package/dist/data/json-view/JsonSource.cjs +84 -0
- package/dist/data/json-view/JsonSource.cjs.map +1 -0
- package/dist/data/json-view/JsonSource.d.ts +7 -0
- package/dist/data/json-view/JsonSource.d.ts.map +1 -0
- package/dist/data/json-view/JsonSource.js +84 -0
- package/dist/data/json-view/JsonSource.js.map +1 -0
- package/dist/data/json-view/parse-prefix.cjs +132 -0
- package/dist/data/json-view/parse-prefix.cjs.map +1 -0
- package/dist/data/json-view/parse-prefix.d.ts +11 -0
- package/dist/data/json-view/parse-prefix.d.ts.map +1 -0
- package/dist/data/json-view/parse-prefix.js +132 -0
- package/dist/data/json-view/parse-prefix.js.map +1 -0
- package/dist/data/json-view/parse-source.cjs +62 -0
- package/dist/data/json-view/parse-source.cjs.map +1 -0
- package/dist/data/json-view/parse-source.d.ts +16 -0
- package/dist/data/json-view/parse-source.d.ts.map +1 -0
- package/dist/data/json-view/parse-source.js +62 -0
- package/dist/data/json-view/parse-source.js.map +1 -0
- package/dist/data/json-view/story-fixtures.d.ts +6 -0
- package/dist/data/json-view/story-fixtures.d.ts.map +1 -0
- package/dist/data/json-view/types.d.ts +14 -0
- package/dist/data/json-view/types.d.ts.map +1 -0
- package/dist/data/runtime/RuntimeBar.cjs +2 -5
- package/dist/data/runtime/RuntimeBar.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.d.ts +2 -4
- package/dist/data/runtime/RuntimeBar.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBar.fields.cjs +2 -2
- package/dist/data/runtime/RuntimeBar.fields.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.fields.js +2 -2
- package/dist/data/runtime/RuntimeBar.fields.js.map +1 -1
- package/dist/data/runtime/RuntimeBar.js +2 -5
- package/dist/data/runtime/RuntimeBar.js.map +1 -1
- package/dist/data/runtime/RuntimeBar.selection.cjs +4 -1
- package/dist/data/runtime/RuntimeBar.selection.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBar.selection.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBar.selection.js +5 -2
- package/dist/data/runtime/RuntimeBar.selection.js.map +1 -1
- package/dist/data/runtime/RuntimeBarActions.cjs +1 -5
- package/dist/data/runtime/RuntimeBarActions.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBarActions.d.ts +1 -1
- package/dist/data/runtime/RuntimeBarActions.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBarActions.js +1 -5
- package/dist/data/runtime/RuntimeBarActions.js.map +1 -1
- package/dist/data/runtime/RuntimeBarIdentity.cjs +6 -14
- package/dist/data/runtime/RuntimeBarIdentity.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBarIdentity.d.ts +0 -1
- package/dist/data/runtime/RuntimeBarIdentity.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBarIdentity.js +6 -14
- package/dist/data/runtime/RuntimeBarIdentity.js.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.cjs +8 -27
- package/dist/data/runtime/RuntimeBarLayout.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBarLayout.js +8 -27
- package/dist/data/runtime/RuntimeBarLayout.js.map +1 -1
- package/dist/data/runtime/RuntimeBarSegment.cjs +1 -5
- package/dist/data/runtime/RuntimeBarSegment.cjs.map +1 -1
- package/dist/data/runtime/RuntimeBarSegment.d.ts.map +1 -1
- package/dist/data/runtime/RuntimeBarSegment.js +1 -5
- package/dist/data/runtime/RuntimeBarSegment.js.map +1 -1
- package/dist/data/runtime/use-runtime-bar-overflow.cjs +4 -10
- package/dist/data/runtime/use-runtime-bar-overflow.cjs.map +1 -1
- package/dist/data/runtime/use-runtime-bar-overflow.d.ts +1 -2
- package/dist/data/runtime/use-runtime-bar-overflow.d.ts.map +1 -1
- package/dist/data/runtime/use-runtime-bar-overflow.js +4 -10
- package/dist/data/runtime/use-runtime-bar-overflow.js.map +1 -1
- package/dist/data/test-runner/TestRunner.fixtures.d.ts +0 -20
- package/dist/data/test-runner/TestRunner.fixtures.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunner.large-fixtures.d.ts +22 -0
- package/dist/data/test-runner/TestRunner.large-fixtures.d.ts.map +1 -0
- package/dist/data/use-group-windows.cjs +50 -0
- package/dist/data/use-group-windows.cjs.map +1 -0
- package/dist/data/use-group-windows.d.ts +27 -0
- package/dist/data/use-group-windows.d.ts.map +1 -0
- package/dist/data/use-group-windows.js +50 -0
- package/dist/data/use-group-windows.js.map +1 -0
- package/dist/data/use-pan-zoom.cjs +23 -10
- package/dist/data/use-pan-zoom.cjs.map +1 -1
- package/dist/data/use-pan-zoom.d.ts +16 -2
- package/dist/data/use-pan-zoom.d.ts.map +1 -1
- package/dist/data/use-pan-zoom.js +23 -10
- package/dist/data/use-pan-zoom.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +36 -2
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +5 -2
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +35 -1
- package/dist/data.js.map +1 -1
- package/dist/hooks/event-hub.cjs +229 -0
- package/dist/hooks/event-hub.cjs.map +1 -0
- package/dist/hooks/event-hub.d.ts +26 -0
- package/dist/hooks/event-hub.d.ts.map +1 -0
- package/dist/hooks/event-hub.js +229 -0
- package/dist/hooks/event-hub.js.map +1 -0
- package/dist/hooks.cjs +2 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +2 -0
- package/dist/hooks.js.map +1 -1
- package/dist/index.cjs +40 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +37 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/Workspace.cjs +13 -4
- package/dist/layout/Workspace.cjs.map +1 -1
- package/dist/layout/Workspace.d.ts +7 -2
- package/dist/layout/Workspace.d.ts.map +1 -1
- package/dist/layout/Workspace.js +13 -4
- package/dist/layout/Workspace.js.map +1 -1
- package/dist/lib/permission-strategies.cjs +71 -11
- package/dist/lib/permission-strategies.cjs.map +1 -1
- package/dist/lib/permission-strategies.d.ts +3 -0
- package/dist/lib/permission-strategies.d.ts.map +1 -1
- package/dist/lib/permission-strategies.js +71 -11
- package/dist/lib/permission-strategies.js.map +1 -1
- package/dist/overlay/modalStack.cjs +13 -6
- package/dist/overlay/modalStack.cjs.map +1 -1
- package/dist/overlay/modalStack.d.ts.map +1 -1
- package/dist/overlay/modalStack.js +13 -6
- package/dist/overlay/modalStack.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -3
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.cjs +0 -57
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.cjs.map +0 -1
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.d.ts +0 -7
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.d.ts.map +0 -1
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.js +0 -57
- package/dist/data/ai/ToolSchemaBrowser.selection-toolbar.js.map +0 -1
- package/dist/data/runtime/RuntimeBar.context.cjs +0 -8
- package/dist/data/runtime/RuntimeBar.context.cjs.map +0 -1
- package/dist/data/runtime/RuntimeBar.context.d.ts +0 -2
- package/dist/data/runtime/RuntimeBar.context.d.ts.map +0 -1
- package/dist/data/runtime/RuntimeBar.context.js +0 -8
- package/dist/data/runtime/RuntimeBar.context.js.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const dataAccess = require("../data-access.cjs");
|
|
4
|
+
const callGraphLabels = require("./call-graph-labels.cjs");
|
|
5
|
+
const callGraphVocabulary = require("./call-graph-vocabulary.cjs");
|
|
6
|
+
const types = require("./types.cjs");
|
|
7
|
+
const CALL_GRAPH_MAX_DEPTH = 8;
|
|
8
|
+
const CALL_GRAPH_DEFAULT_DEPTH = 2;
|
|
9
|
+
const DEFAULT_EDGE_LABELS = { call: "call", dispatch: "dispatch", read: "read", write: "write" };
|
|
10
|
+
const EDGE_TONE = { dispatch: "info", read: "success", write: "warning" };
|
|
11
|
+
function toggleAccess(access, type) {
|
|
12
|
+
const on = !access.includes(type);
|
|
13
|
+
if (!on && type !== "variable" && baseAccess(access).length === 1) throw new Error(`call graph: ${type} is the only access type on`);
|
|
14
|
+
return ACCESS_ORDER.filter((entry) => entry === type ? on : access.includes(entry));
|
|
15
|
+
}
|
|
16
|
+
const ACCESS_ORDER = [...types.CALL_GRAPH_ACCESS, "variable"];
|
|
17
|
+
function baseAccess(access) {
|
|
18
|
+
return access.filter((type) => types.CALL_GRAPH_ACCESS.includes(type));
|
|
19
|
+
}
|
|
20
|
+
function requireNode(graph, id) {
|
|
21
|
+
const node = graph.nodes.find((candidate) => candidate.id === id);
|
|
22
|
+
if (!node) throw new Error(`call graph: no node "${id}"`);
|
|
23
|
+
return node;
|
|
24
|
+
}
|
|
25
|
+
function inDirection(depth, direction) {
|
|
26
|
+
if (direction === "both" || depth === 0) return true;
|
|
27
|
+
return direction === "callees" ? depth > 0 : depth < 0;
|
|
28
|
+
}
|
|
29
|
+
function visibleGraph(graph, view) {
|
|
30
|
+
const revealed = new Set(view.revealed);
|
|
31
|
+
const nodes = graph.nodes.filter(
|
|
32
|
+
(node) => inDirection(node.depth, view.direction) && (Math.abs(node.depth) <= view.depth || revealed.has(node.id))
|
|
33
|
+
);
|
|
34
|
+
const ids = new Set(nodes.map((node) => node.id));
|
|
35
|
+
return { nodes, edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to)) };
|
|
36
|
+
}
|
|
37
|
+
function outerSide(node) {
|
|
38
|
+
return node.depth < 0 ? "in" : "out";
|
|
39
|
+
}
|
|
40
|
+
function expansionDirection(node) {
|
|
41
|
+
return outerSide(node) === "in" ? "callers" : "callees";
|
|
42
|
+
}
|
|
43
|
+
function outerEdges(graph, node) {
|
|
44
|
+
const side = outerSide(node);
|
|
45
|
+
return graph.edges.filter((edge) => (side === "out" ? edge.from : edge.to) === node.id);
|
|
46
|
+
}
|
|
47
|
+
function expandCount(graph, visible, nodeId, direction, vocabulary, merged = /* @__PURE__ */ new Map()) {
|
|
48
|
+
const node = requireNode(graph, nodeId);
|
|
49
|
+
const side = outerSide(node);
|
|
50
|
+
if (!vocabulary.hasSource(node) || direction === (side === "out" ? "callers" : "callees")) return 0;
|
|
51
|
+
const drawn = new Set(visible.nodes.map((entry) => entry.id));
|
|
52
|
+
const accounted = outerEdges(graph, node).filter((edge) => drawn.has(side === "out" ? edge.to : edge.from)).reduce((sum, edge) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return sum + (((_a = merged.get(edge.id)) == null ? void 0 : _a.sources.length) ?? 1);
|
|
55
|
+
}, 0);
|
|
56
|
+
return Math.max(0, (side === "out" ? node.out : node.in) - accounted);
|
|
57
|
+
}
|
|
58
|
+
function accessTotals(graph, node) {
|
|
59
|
+
const into = (types2) => graph.edges.filter((edge) => edge.to === node.id && types2.includes(edge.type)).length;
|
|
60
|
+
const totals = [["readers", into(["read"])], ["writers", into(["write"])], ["callers", into(["call", "dispatch"])]];
|
|
61
|
+
return Object.fromEntries(totals.filter(([, count]) => count > 0));
|
|
62
|
+
}
|
|
63
|
+
function walkedTotals(graph, node, vocabulary) {
|
|
64
|
+
if (vocabulary.isData(node)) return accessTotals(graph, node);
|
|
65
|
+
const walked = (sign) => graph.nodes.some((other) => Math.sign(other.depth) === sign);
|
|
66
|
+
return {
|
|
67
|
+
...node.depth <= 0 && walked(-1) ? { callers: node.in } : {},
|
|
68
|
+
...node.depth >= 0 && walked(1) ? { callees: node.out } : {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function distinctSites(sites) {
|
|
72
|
+
return sites.filter((site, index) => sites.findIndex((other) => callGraphVocabulary.siteKey(other) === callGraphVocabulary.siteKey(site)) === index);
|
|
73
|
+
}
|
|
74
|
+
const edgeKey = (edge) => `${edge.from}|${edge.to}|${edge.type}`;
|
|
75
|
+
function mergeGraph(held, expansion) {
|
|
76
|
+
const [rootId] = expansion.roots;
|
|
77
|
+
const base = held.nodes.find((node) => node.id === rootId);
|
|
78
|
+
if (rootId === void 0 || !base) throw new Error(`call graph: expansion root "${rootId}" is not in the held graph`);
|
|
79
|
+
const heldIds = new Set(held.nodes.map((node) => node.id));
|
|
80
|
+
const added = expansion.nodes.filter((node) => !heldIds.has(node.id)).map((node) => ({ ...node, depth: base.depth + node.depth }));
|
|
81
|
+
const incoming = new Map(expansion.edges.map((edge) => [edgeKey(edge), edge]));
|
|
82
|
+
const edges = held.edges.map((edge) => {
|
|
83
|
+
const more = incoming.get(edgeKey(edge));
|
|
84
|
+
incoming.delete(edgeKey(edge));
|
|
85
|
+
if (!more) return edge;
|
|
86
|
+
const properties = edge.properties && Object.keys(edge.properties).length > 0 ? edge.properties : more.properties;
|
|
87
|
+
return { ...edge, sites: distinctSites([...edge.sites, ...more.sites]), ...properties ? { properties } : {} };
|
|
88
|
+
});
|
|
89
|
+
const groupIds = new Set((held.groups ?? []).map((group) => group.id));
|
|
90
|
+
const groups = [...held.groups ?? [], ...(expansion.groups ?? []).filter((group) => !groupIds.has(group.id))];
|
|
91
|
+
return { ...held, nodes: [...held.nodes, ...added], edges: [...edges, ...incoming.values()], groups };
|
|
92
|
+
}
|
|
93
|
+
function groupRank(graph, vocabulary) {
|
|
94
|
+
const rootGroups2 = new Set(graph.roots.map((id) => requireNode(graph, id).group));
|
|
95
|
+
const sourced = new Set(graph.nodes.filter((node) => vocabulary.hasSource(node)).map((node) => node.group));
|
|
96
|
+
return (node) => {
|
|
97
|
+
if (node.group === void 0) return 3;
|
|
98
|
+
if (rootGroups2.has(node.group)) return 0;
|
|
99
|
+
return sourced.has(node.group) ? 1 : 2;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function accessInto(edges, id) {
|
|
103
|
+
return edges.reduce((held, edge) => edge.to === id && (edge.type === "read" || edge.type === "write") ? dataAccess.mergeAccess(held, edge.type) : held, void 0);
|
|
104
|
+
}
|
|
105
|
+
function toDiagramNode(node, { direction, options, glyphs, vocabulary }, drawn, records) {
|
|
106
|
+
var _a;
|
|
107
|
+
const { graph, visible } = drawn;
|
|
108
|
+
const count = expandCount(graph, visible, node.id, direction, vocabulary, drawn.merged);
|
|
109
|
+
const isRoot = graph.roots.includes(node.id);
|
|
110
|
+
const tone = isRoot ? "info" : node.unresolved ? "warning" : void 0;
|
|
111
|
+
const compact = node.group !== void 0 && records.has(node.group) || !isRoot && vocabulary.isData(node) && !vocabulary.hasSource(node);
|
|
112
|
+
const aside = callGraphVocabulary.dataMemberAside(node);
|
|
113
|
+
const access = glyphs.access && accessInto(visible.edges, node.id);
|
|
114
|
+
return {
|
|
115
|
+
id: node.id,
|
|
116
|
+
label: node.label,
|
|
117
|
+
icon: glyphs.node(vocabulary.glyphOf(graph, node), vocabulary.kindOf(graph, node)),
|
|
118
|
+
title: callGraphVocabulary.nodeTitle(graph, node, vocabulary),
|
|
119
|
+
level: node.depth,
|
|
120
|
+
...options.grouped && node.group !== void 0 ? { group: node.group } : {},
|
|
121
|
+
...compact ? { size: "compact" } : {},
|
|
122
|
+
...aside !== void 0 ? { aside } : {},
|
|
123
|
+
...access ? { mark: (_a = glyphs.access) == null ? void 0 : _a.call(glyphs, access) } : {},
|
|
124
|
+
...tone !== void 0 ? { tone } : {},
|
|
125
|
+
...vocabulary.muted(node) ? { muted: true } : {},
|
|
126
|
+
...count > 0 ? { expandCount: count } : {}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function toDiagramEdge(edge, { options, glyphs, edgeLabels, vocabulary }, drawn) {
|
|
130
|
+
const merge = drawn.merged.get(edge.id);
|
|
131
|
+
const label = [callGraphLabels.edgeLabel(edge, options), merge && countWords(merge.members, drawn.graph, vocabulary)].filter(Boolean).join(" · ") || void 0;
|
|
132
|
+
const title = callGraphLabels.edgeTitle(edge);
|
|
133
|
+
return {
|
|
134
|
+
id: edge.id,
|
|
135
|
+
from: edge.from,
|
|
136
|
+
to: edge.to,
|
|
137
|
+
dashed: callGraphLabels.isConditional(edge),
|
|
138
|
+
...edge.type === "call" ? {} : { tone: EDGE_TONE[edge.type], icon: glyphs.edge(edge.type), iconLabel: edgeLabels[edge.type] },
|
|
139
|
+
...label !== void 0 ? { label } : {},
|
|
140
|
+
...title !== void 0 ? { title } : {}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const PILL_CHAR_WIDTH = 5.2;
|
|
144
|
+
const PILL_CHROME = 22;
|
|
145
|
+
const PILL_ICON_CHARS = 3;
|
|
146
|
+
const MIN_COLUMN_GAP = 96;
|
|
147
|
+
function columnGap({
|
|
148
|
+
nodes,
|
|
149
|
+
edges
|
|
150
|
+
}) {
|
|
151
|
+
const level = new Map(nodes.map((node) => [node.id, node.level]));
|
|
152
|
+
const chars = edges.filter((edge) => level.get(edge.from) !== level.get(edge.to)).map((edge) => {
|
|
153
|
+
var _a;
|
|
154
|
+
return (((_a = edge.label) == null ? void 0 : _a.length) ?? 0) + (edge.icon != null ? PILL_ICON_CHARS : 0);
|
|
155
|
+
});
|
|
156
|
+
return Math.max(MIN_COLUMN_GAP, Math.round(Math.max(0, ...chars) * PILL_CHAR_WIDTH) + PILL_CHROME);
|
|
157
|
+
}
|
|
158
|
+
function recordGroups(visible, vocabulary) {
|
|
159
|
+
var _a;
|
|
160
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
161
|
+
for (const node of visible.nodes) {
|
|
162
|
+
if (node.group !== void 0) grouped.set(node.group, [...grouped.get(node.group) ?? [], node]);
|
|
163
|
+
}
|
|
164
|
+
const records = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const [group, nodes] of grouped) {
|
|
166
|
+
const kind = (_a = nodes[0]) == null ? void 0 : _a.kind;
|
|
167
|
+
if (kind !== void 0 && nodes.every((node) => vocabulary.isData(node) && callGraphVocabulary.isDataMember(node) && node.kind === kind)) {
|
|
168
|
+
const owner = callGraphVocabulary.DATA_MEMBER_OWNER[kind];
|
|
169
|
+
if (owner === void 0) throw new Error(`call graph: no owner kind for data member "${kind}"`);
|
|
170
|
+
records.set(group, owner);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return records;
|
|
174
|
+
}
|
|
175
|
+
const STAND_IN_PREFIX = "group:";
|
|
176
|
+
function standInId(group) {
|
|
177
|
+
return `${STAND_IN_PREFIX}${group}`;
|
|
178
|
+
}
|
|
179
|
+
function rootGroups(graph) {
|
|
180
|
+
return new Set(graph.roots.map((id) => requireNode(graph, id).group));
|
|
181
|
+
}
|
|
182
|
+
function collapsibleGroups(graph, visible) {
|
|
183
|
+
const roots = rootGroups(graph);
|
|
184
|
+
return [...new Set(visible.nodes.map((node) => node.group))].filter((group) => group !== void 0 && !roots.has(group));
|
|
185
|
+
}
|
|
186
|
+
function countWords(members, graph, vocabulary) {
|
|
187
|
+
const [first] = members;
|
|
188
|
+
const kind = first && members.every((member) => member.kind === first.kind) ? vocabulary.kindOf(graph, first) : "member";
|
|
189
|
+
return `${members.length} ${kind}${members.length === 1 ? "" : "s"}`;
|
|
190
|
+
}
|
|
191
|
+
function memberProperties(members) {
|
|
192
|
+
const keys = { column: "columns", field: "fields" };
|
|
193
|
+
const names = /* @__PURE__ */ new Map();
|
|
194
|
+
for (const member of members) {
|
|
195
|
+
const key = keys[member.kind] ?? "members";
|
|
196
|
+
names.set(key, [...names.get(key) ?? [], member.label]);
|
|
197
|
+
}
|
|
198
|
+
return Object.fromEntries([...names].map(([key, list]) => [key, list.join(", ")]));
|
|
199
|
+
}
|
|
200
|
+
function mergeEdges(id, sources, standInOf, nodes) {
|
|
201
|
+
const [first] = sources;
|
|
202
|
+
if (!first) throw new Error(`call graph: merged edge "${id}" stands for no edge`);
|
|
203
|
+
const memberIds = [...new Set(sources.flatMap((edge2) => [edge2.from, edge2.to]).filter((end) => standInOf.has(end)))];
|
|
204
|
+
const members = memberIds.map((member) => {
|
|
205
|
+
const node = nodes.get(member);
|
|
206
|
+
if (!node) throw new Error(`call graph: no node "${member}"`);
|
|
207
|
+
return node;
|
|
208
|
+
});
|
|
209
|
+
const kind = sources.every((edge2) => edge2.kind === first.kind) ? first.kind : void 0;
|
|
210
|
+
const edge = {
|
|
211
|
+
id,
|
|
212
|
+
from: standInOf.get(first.from) ?? first.from,
|
|
213
|
+
to: standInOf.get(first.to) ?? first.to,
|
|
214
|
+
type: first.type,
|
|
215
|
+
...kind !== void 0 ? { kind } : {},
|
|
216
|
+
sites: distinctSites(sources.flatMap((source) => source.sites)),
|
|
217
|
+
properties: memberProperties(members)
|
|
218
|
+
};
|
|
219
|
+
return [edge, { sources: [...sources], members }];
|
|
220
|
+
}
|
|
221
|
+
function foldEdges(edges, standInOf, nodes) {
|
|
222
|
+
const kept = [];
|
|
223
|
+
const grouped = /* @__PURE__ */ new Map();
|
|
224
|
+
for (const edge of edges) {
|
|
225
|
+
const from = standInOf.get(edge.from) ?? edge.from;
|
|
226
|
+
const to = standInOf.get(edge.to) ?? edge.to;
|
|
227
|
+
if (from === edge.from && to === edge.to) kept.push(edge);
|
|
228
|
+
else grouped.set(`${from}|${to}|${edge.type}`, [...grouped.get(`${from}|${to}|${edge.type}`) ?? [], edge]);
|
|
229
|
+
}
|
|
230
|
+
const merged = new Map([...grouped].map(([id, sources]) => mergeEdges(id, sources, standInOf, nodes)).map(([edge, merge]) => [edge.id, { edge, merge }]));
|
|
231
|
+
return { edges: [...kept, ...[...merged.values()].map(({ edge }) => edge)], merged: new Map([...merged].map(([id, { merge }]) => [id, merge])) };
|
|
232
|
+
}
|
|
233
|
+
function standInNode(id, fold, graph, records, edges) {
|
|
234
|
+
var _a, _b;
|
|
235
|
+
const [first, ...rest] = fold.members;
|
|
236
|
+
if (!first) throw new Error(`call graph: collapsed group "${fold.group}" holds no node`);
|
|
237
|
+
const nearest = rest.reduce((best, member) => Math.abs(member.depth) < Math.abs(best.depth) ? member : best, first);
|
|
238
|
+
return {
|
|
239
|
+
id,
|
|
240
|
+
identifier: {},
|
|
241
|
+
kind: records.get(fold.group) ?? first.kind,
|
|
242
|
+
label: ((_b = (_a = graph.groups) == null ? void 0 : _a.find((group) => group.id === fold.group)) == null ? void 0 : _b.label) ?? fold.group,
|
|
243
|
+
group: fold.group,
|
|
244
|
+
depth: nearest.depth,
|
|
245
|
+
in: edges.filter((edge) => edge.to === id).length,
|
|
246
|
+
out: edges.filter((edge) => edge.from === id).length
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function foldGroups(graph, visible, collapsed, records) {
|
|
250
|
+
var _a;
|
|
251
|
+
const roots = rootGroups(graph);
|
|
252
|
+
const folds = /* @__PURE__ */ new Map();
|
|
253
|
+
const standInOf = /* @__PURE__ */ new Map();
|
|
254
|
+
for (const node of visible.nodes) {
|
|
255
|
+
if (node.group === void 0 || roots.has(node.group) || !collapsed.includes(node.group)) continue;
|
|
256
|
+
const id = standInId(node.group);
|
|
257
|
+
folds.set(id, { group: node.group, members: [...((_a = folds.get(id)) == null ? void 0 : _a.members) ?? [], node] });
|
|
258
|
+
standInOf.set(node.id, id);
|
|
259
|
+
}
|
|
260
|
+
if (folds.size === 0) return { graph, visible, folds, merged: /* @__PURE__ */ new Map() };
|
|
261
|
+
const { edges, merged } = foldEdges(graph.edges, standInOf, new Map(graph.nodes.map((node) => [node.id, node])));
|
|
262
|
+
const standIns = [...folds].map(([id, fold]) => standInNode(id, fold, graph, records, edges));
|
|
263
|
+
const nodes = [...visible.nodes.filter((node) => !standInOf.has(node.id)), ...standIns];
|
|
264
|
+
const drawnIds = new Set(nodes.map((node) => node.id));
|
|
265
|
+
return {
|
|
266
|
+
graph: { ...graph, nodes: [...graph.nodes.filter((node) => !standInOf.has(node.id)), ...standIns], edges },
|
|
267
|
+
visible: { nodes, edges: edges.filter((edge) => drawnIds.has(edge.from) && drawnIds.has(edge.to)) },
|
|
268
|
+
folds,
|
|
269
|
+
merged
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function toDiagramGroup({ id, label }, { glyphs, graph, vocabulary }, drawn, records, collapsible) {
|
|
273
|
+
const fold = drawn.folds.get(standInId(id));
|
|
274
|
+
return {
|
|
275
|
+
id,
|
|
276
|
+
label: glyphs.group(callGraphLabels.groupCaption(label), records.get(id)),
|
|
277
|
+
title: label,
|
|
278
|
+
...records.has(id) ? { variant: "record" } : {},
|
|
279
|
+
...(collapsible == null ? void 0 : collapsible.has(id)) ? { collapsed: fold !== void 0 } : {},
|
|
280
|
+
...fold ? { aside: countWords(fold.members, graph, vocabulary) } : {}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
function toDiagram(input) {
|
|
284
|
+
const { graph, visible, options, vocabulary, collapsed } = input;
|
|
285
|
+
const records = options.grouped ? recordGroups(visible, vocabulary) : /* @__PURE__ */ new Map();
|
|
286
|
+
const drawn = options.grouped && collapsed ? foldGroups(graph, visible, collapsed, records) : { graph, visible, folds: /* @__PURE__ */ new Map(), merged: /* @__PURE__ */ new Map() };
|
|
287
|
+
const collapsible = options.grouped && collapsed ? new Set(collapsibleGroups(graph, visible)) : void 0;
|
|
288
|
+
const rank = groupRank(drawn.graph, vocabulary);
|
|
289
|
+
return {
|
|
290
|
+
nodes: [...drawn.visible.nodes].sort((a, b) => rank(a) - rank(b)).map((node) => toDiagramNode(node, input, drawn, records)),
|
|
291
|
+
edges: drawn.visible.edges.map((edge) => toDiagramEdge(edge, input, drawn)),
|
|
292
|
+
groups: options.grouped ? (graph.groups ?? []).map((group) => toDiagramGroup(group, input, drawn, records, collapsible)) : [],
|
|
293
|
+
drawn
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
exports.CALL_GRAPH_DEFAULT_DEPTH = CALL_GRAPH_DEFAULT_DEPTH;
|
|
297
|
+
exports.CALL_GRAPH_MAX_DEPTH = CALL_GRAPH_MAX_DEPTH;
|
|
298
|
+
exports.DEFAULT_EDGE_LABELS = DEFAULT_EDGE_LABELS;
|
|
299
|
+
exports.baseAccess = baseAccess;
|
|
300
|
+
exports.collapsibleGroups = collapsibleGroups;
|
|
301
|
+
exports.columnGap = columnGap;
|
|
302
|
+
exports.expandCount = expandCount;
|
|
303
|
+
exports.expansionDirection = expansionDirection;
|
|
304
|
+
exports.mergeGraph = mergeGraph;
|
|
305
|
+
exports.recordGroups = recordGroups;
|
|
306
|
+
exports.requireNode = requireNode;
|
|
307
|
+
exports.standInId = standInId;
|
|
308
|
+
exports.toDiagram = toDiagram;
|
|
309
|
+
exports.toggleAccess = toggleAccess;
|
|
310
|
+
exports.visibleGraph = visibleGraph;
|
|
311
|
+
exports.walkedTotals = walkedTotals;
|
|
312
|
+
//# sourceMappingURL=call-graph-model.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-graph-model.cjs","sources":["../../../src/data/call-graph/call-graph-model.ts"],"sourcesContent":["// Pure mapping from a call graph to what GraphDiagram draws, and how a `+N` expansion merges into the\n// held graph. It decides what is shown and leaves drawing a glyph to the DiagramGlyphs it is handed,\n// so it renders nothing itself.\nimport type { ReactNode } from \"react\";\nimport type { BadgeTone } from \"../Badge\";\nimport { mergeAccess, type DataAccess } from \"../data-access\";\nimport type { GraphDiagramEdge, GraphDiagramGroup, GraphDiagramNode } from \"../graph-diagram-model\";\nimport { edgeLabel, edgeTitle, groupCaption, isConditional, type PillOptions } from \"./call-graph-labels\";\nimport { DATA_MEMBER_OWNER, dataMemberAside, isDataMember, nodeTitle, siteKey, type CallGraphVocabulary } from \"./call-graph-vocabulary\";\nimport {\n CALL_GRAPH_ACCESS,\n type CallGraph,\n type CallGraphAccess,\n type CallGraphDirection,\n type CallGraphEdge,\n type CallGraphEdgeLabels,\n type CallGraphEdgeType,\n type CallGraphGroup,\n type CallGraphNode,\n type CallGraphSite,\n} from \"./types\";\n\n/** The deepest graph uir builds (graph.MaxDepth). */\nexport const CALL_GRAPH_MAX_DEPTH = 8;\n/** The depth uir builds when none is asked for (graph.DefaultDepth). */\nexport const CALL_GRAPH_DEFAULT_DEPTH = 2;\n\nexport const DEFAULT_EDGE_LABELS: CallGraphEdgeLabels = { call: \"call\", dispatch: \"dispatch\", read: \"read\", write: \"write\" };\n\n/** The tone each edge type but a plain call is drawn in: dispatch blue, a read green, a write amber. */\nconst EDGE_TONE: Record<Exclude<CallGraphEdgeType, \"call\">, BadgeTone> = { dispatch: \"info\", read: \"success\", write: \"warning\" };\n\n/** Turns one access type on or off, in the usual order. Turning the last one off fails: a graph follows something. */\nexport function toggleAccess(access: readonly CallGraphAccess[], type: CallGraphAccess): CallGraphAccess[] {\n const on = !access.includes(type);\n if (!on && type !== \"variable\" && baseAccess(access).length === 1) throw new Error(`call graph: ${type} is the only access type on`);\n return ACCESS_ORDER.filter((entry) => (entry === type ? on : access.includes(entry)));\n}\n\n/** Every access type in the usual order: variables last, on top of the others. */\nconst ACCESS_ORDER: readonly CallGraphAccess[] = [...CALL_GRAPH_ACCESS, \"variable\"];\n\n/** The access types of `access` that are not variables, at least one of which a graph follows. */\nexport function baseAccess(access: readonly CallGraphAccess[]): CallGraphAccess[] {\n return access.filter((type) => CALL_GRAPH_ACCESS.includes(type));\n}\n\nexport interface GraphView {\n direction: CallGraphDirection;\n /** Nodes further than this many hops from the root are hidden. */\n depth: number;\n /** Node ids shown regardless of `depth`, because a `+N` expansion revealed them. */\n revealed: readonly string[];\n}\n\nexport interface VisibleGraph {\n nodes: CallGraphNode[];\n edges: CallGraphEdge[];\n}\n\nexport interface DiagramOptions extends PillOptions {\n /** Box nodes by their `group`. */\n grouped: boolean;\n}\n\nexport type DiagramNode = GraphDiagramNode & { label: string; level: number; title: string };\nexport type DiagramEdge = GraphDiagramEdge & { dashed: boolean };\nexport type DiagramGroup = GraphDiagramGroup & { title: string; aside?: string };\n\nexport interface Diagram {\n nodes: DiagramNode[];\n edges: DiagramEdge[];\n groups: DiagramGroup[];\n /** The graph as drawn, collapsed groups folded into their stand-ins: what a selection is looked up in. */\n drawn: DrawnGraph;\n}\n\n/** Draws the glyphs the model chooses. The component supplies icons; the tests supply strings. */\nexport interface DiagramGlyphs {\n /** `words` is the icon's name for a screen reader, such as `external function`. */\n node(glyph: string, words: string): ReactNode;\n /** The pill icon of an edge type; a plain call has none. */\n edge(type: CallGraphEdgeType): ReactNode | undefined;\n group(caption: string, glyph?: string): ReactNode;\n /** The mark of a node the reads and writes into it access; without it no node is marked. */\n access?(access: DataAccess): ReactNode;\n}\n\nexport interface DiagramInput {\n graph: CallGraph;\n visible: VisibleGraph;\n direction: CallGraphDirection;\n options: DiagramOptions;\n glyphs: DiagramGlyphs;\n vocabulary: CallGraphVocabulary;\n edgeLabels: CallGraphEdgeLabels;\n /**\n * The groups drawn as their header alone, by id: each folds into one stand-in node, and its members'\n * edges merge onto it. The root's group never folds. Leave it out and no group can collapse.\n */\n collapsed?: readonly string[];\n}\n\nexport function requireNode(graph: CallGraph, id: string): CallGraphNode {\n const node = graph.nodes.find((candidate) => candidate.id === id);\n if (!node) throw new Error(`call graph: no node \"${id}\"`);\n return node;\n}\n\nfunction inDirection(depth: number, direction: CallGraphDirection): boolean {\n if (direction === \"both\" || depth === 0) return true;\n return direction === \"callees\" ? depth > 0 : depth < 0;\n}\n\n/** The nodes on the requested side within `depth`, plus revealed ones, and the edges between them. */\nexport function visibleGraph(graph: CallGraph, view: GraphView): VisibleGraph {\n const revealed = new Set(view.revealed);\n const nodes = graph.nodes.filter(\n (node) => inDirection(node.depth, view.direction) && (Math.abs(node.depth) <= view.depth || revealed.has(node.id)),\n );\n const ids = new Set(nodes.map((node) => node.id));\n return { nodes, edges: graph.edges.filter((edge) => ids.has(edge.from) && ids.has(edge.to)) };\n}\n\n/** A caller grows toward its own callers; the root and callees grow toward their callees. */\nfunction outerSide(node: CallGraphNode): \"in\" | \"out\" {\n return node.depth < 0 ? \"in\" : \"out\";\n}\n\n/** The direction a `+N` expansion of the node walks: its outer side, the side `+N` counts. */\nexport function expansionDirection(node: CallGraphNode): Exclude<CallGraphDirection, \"both\"> {\n return outerSide(node) === \"in\" ? \"callers\" : \"callees\";\n}\n\n/** A node's edges on its outer side, as the response holds them. */\nfunction outerEdges(graph: CallGraph, node: CallGraphNode): CallGraphEdge[] {\n const side = outerSide(node);\n return graph.edges.filter((edge) => (side === \"out\" ? edge.from : edge.to) === node.id);\n}\n\n/** The ids at the far end of a node's edges on its outer side, as the response holds them. */\nfunction outerNeighbours(graph: CallGraph, node: CallGraphNode): string[] {\n const side = outerSide(node);\n return outerEdges(graph, node).map((edge) => (side === \"out\" ? edge.to : edge.from));\n}\n\n/** The neighbours on a node's outer side that the response holds and are not drawn. */\nexport function hiddenNeighbours(graph: CallGraph, visible: VisibleGraph, nodeId: string): string[] {\n const drawn = new Set(visible.nodes.map((node) => node.id));\n return outerNeighbours(graph, requireNode(graph, nodeId)).filter((id, index, all) => !drawn.has(id) && all.indexOf(id) === index);\n}\n\n/**\n * The `+N` on a node: how many more edges there are to load on its outer side. Only that side's count\n * is a total (`out` for the root and callees, `in` for callers); the other equals the edges in the\n * response. Excluded neighbours are in neither. From it come off the edges drawn, a merged edge counting\n * every edge it stands for. A node without a source cannot be expanded, nor can the side the direction hides.\n */\nexport function expandCount(\n graph: CallGraph,\n visible: VisibleGraph,\n nodeId: string,\n direction: CallGraphDirection,\n vocabulary: Pick<CallGraphVocabulary, \"hasSource\">,\n merged: ReadonlyMap<string, EdgeMerge> = new Map(),\n): number {\n const node = requireNode(graph, nodeId);\n const side = outerSide(node);\n if (!vocabulary.hasSource(node) || direction === (side === \"out\" ? \"callers\" : \"callees\")) return 0;\n const drawn = new Set(visible.nodes.map((entry) => entry.id));\n const accounted = outerEdges(graph, node)\n .filter((edge) => drawn.has(side === \"out\" ? edge.to : edge.from))\n .reduce((sum, edge) => sum + (merged.get(edge.id)?.sources.length ?? 1), 0);\n return Math.max(0, (side === \"out\" ? node.out : node.in) - accounted);\n}\n\nexport interface NodeTotals {\n callers?: number;\n callees?: number;\n readers?: number;\n writers?: number;\n}\n\n/**\n * A data node's readers, writers and callers: the edges into it the graph holds, by type, each left\n * out when there are none.\n */\nfunction accessTotals(graph: CallGraph, node: CallGraphNode): NodeTotals {\n const into = (types: readonly CallGraphEdgeType[]) => graph.edges.filter((edge) => edge.to === node.id && types.includes(edge.type)).length;\n const totals: [keyof NodeTotals, number][] = [[\"readers\", into([\"read\"])], [\"writers\", into([\"write\"])], [\"callers\", into([\"call\", \"dispatch\"])]];\n return Object.fromEntries(totals.filter(([, count]) => count > 0));\n}\n\n/**\n * A node's call totals on the sides the response walked: callees at depth >= 0, callers at depth <= 0.\n * A data node counts who reads, writes and calls it instead.\n */\nexport function walkedTotals(graph: CallGraph, node: CallGraphNode, vocabulary: Pick<CallGraphVocabulary, \"isData\">): NodeTotals {\n if (vocabulary.isData(node)) return accessTotals(graph, node);\n const walked = (sign: number) => graph.nodes.some((other) => Math.sign(other.depth) === sign);\n return {\n ...(node.depth <= 0 && walked(-1) ? { callers: node.in } : {}),\n ...(node.depth >= 0 && walked(1) ? { callees: node.out } : {}),\n };\n}\n\nfunction distinctSites(sites: CallGraphSite[]): CallGraphSite[] {\n return sites.filter((site, index) => sites.findIndex((other) => siteKey(other) === siteKey(site)) === index);\n}\n\nconst edgeKey = (edge: CallGraphEdge) => `${edge.from}|${edge.to}|${edge.type}`;\n\n/**\n * Merges a one-hop expansion into the held graph. The expansion is rooted at a held node, so its\n * depths are re-signed from that node's depth. Held nodes keep their place; edges are keyed by\n * `from|to|type`, gain the call sites they did not hold and keep their first non-empty properties;\n * the held response's other fields stay.\n */\nexport function mergeGraph<T extends CallGraph>(held: T, expansion: CallGraph): T {\n const [rootId] = expansion.roots;\n const base = held.nodes.find((node) => node.id === rootId);\n if (rootId === undefined || !base) throw new Error(`call graph: expansion root \"${rootId}\" is not in the held graph`);\n const heldIds = new Set(held.nodes.map((node) => node.id));\n const added = expansion.nodes.filter((node) => !heldIds.has(node.id)).map((node) => ({ ...node, depth: base.depth + node.depth }));\n const incoming = new Map(expansion.edges.map((edge) => [edgeKey(edge), edge]));\n const edges = held.edges.map((edge) => {\n const more = incoming.get(edgeKey(edge));\n incoming.delete(edgeKey(edge));\n if (!more) return edge;\n const properties = edge.properties && Object.keys(edge.properties).length > 0 ? edge.properties : more.properties;\n return { ...edge, sites: distinctSites([...edge.sites, ...more.sites]), ...(properties ? { properties } : {}) };\n });\n const groupIds = new Set((held.groups ?? []).map((group) => group.id));\n const groups: CallGraphGroup[] = [...(held.groups ?? []), ...(expansion.groups ?? []).filter((group) => !groupIds.has(group.id))];\n return { ...held, nodes: [...held.nodes, ...added], edges: [...edges, ...incoming.values()], groups };\n}\n\n/**\n * The order nodes are handed to the diagram, which stacks groups in the order they first appear: the\n * root's group, then the other groups holding nodes with a source, then the others, then nodes in no group.\n */\nfunction groupRank(graph: CallGraph, vocabulary: CallGraphVocabulary): (node: CallGraphNode) => number {\n const rootGroups = new Set(graph.roots.map((id) => requireNode(graph, id).group));\n const sourced = new Set(graph.nodes.filter((node) => vocabulary.hasSource(node)).map((node) => node.group));\n return (node) => {\n if (node.group === undefined) return 3;\n if (rootGroups.has(node.group)) return 0;\n return sourced.has(node.group) ? 1 : 2;\n };\n}\n\n/** How the reads and writes among `edges` into the node access it, or undefined when none do. */\nfunction accessInto(edges: readonly CallGraphEdge[], id: string): DataAccess | undefined {\n return edges.reduce<DataAccess | undefined>((held, edge) => (edge.to === id && (edge.type === \"read\" || edge.type === \"write\") ? mergeAccess(held, edge.type) : held), undefined);\n}\n\nfunction toDiagramNode(node: CallGraphNode, { direction, options, glyphs, vocabulary }: DiagramInput, drawn: DrawnGraph, records: ReadonlyMap<string, string>): DiagramNode {\n const { graph, visible } = drawn;\n const count = expandCount(graph, visible, node.id, direction, vocabulary, drawn.merged);\n const isRoot = graph.roots.includes(node.id);\n const tone = isRoot ? \"info\" : node.unresolved ? \"warning\" : undefined;\n // A table, column, entity or field is a name its group box already places: one short line will do.\n const compact = (node.group !== undefined && records.has(node.group)) || (!isRoot && vocabulary.isData(node) && !vocabulary.hasSource(node));\n const aside = dataMemberAside(node);\n const access = glyphs.access && accessInto(visible.edges, node.id);\n return {\n id: node.id,\n label: node.label,\n icon: glyphs.node(vocabulary.glyphOf(graph, node), vocabulary.kindOf(graph, node)),\n title: nodeTitle(graph, node, vocabulary),\n level: node.depth,\n ...(options.grouped && node.group !== undefined ? { group: node.group } : {}),\n ...(compact ? { size: \"compact\" as const } : {}),\n ...(aside !== undefined ? { aside } : {}),\n ...(access ? { mark: glyphs.access?.(access) } : {}),\n ...(tone !== undefined ? { tone } : {}),\n ...(vocabulary.muted(node) ? { muted: true } : {}),\n ...(count > 0 ? { expandCount: count } : {}),\n };\n}\n\nfunction toDiagramEdge(edge: CallGraphEdge, { options, glyphs, edgeLabels, vocabulary }: DiagramInput, drawn: DrawnGraph): DiagramEdge {\n const merge = drawn.merged.get(edge.id);\n const label = [edgeLabel(edge, options), merge && countWords(merge.members, drawn.graph, vocabulary)].filter(Boolean).join(\" · \") || undefined;\n const title = edgeTitle(edge);\n return {\n id: edge.id,\n from: edge.from,\n to: edge.to,\n dashed: isConditional(edge),\n ...(edge.type === \"call\" ? {} : { tone: EDGE_TONE[edge.type], icon: glyphs.edge(edge.type), iconLabel: edgeLabels[edge.type] }),\n ...(label !== undefined ? { label } : {}),\n ...(title !== undefined ? { title } : {}),\n };\n}\n\n/** Mean glyph advance of the 10px pill text, and the pill's padding plus a little air. */\nconst PILL_CHAR_WIDTH = 5.2;\nconst PILL_CHROME = 22;\n/** The room a pill's icon and its gap take, in characters. */\nconst PILL_ICON_CHARS = 3;\nconst MIN_COLUMN_GAP = 96;\n\n/**\n * The gap between columns: as wide as the longest pill on an edge between two columns, so no pill\n * covers a node. Wider gaps than the pills need make the diagram wider, and so smaller once fitted.\n */\nexport function columnGap({\n nodes,\n edges,\n}: {\n nodes: readonly Pick<DiagramNode, \"id\" | \"level\">[];\n edges: readonly Pick<DiagramEdge, \"id\" | \"from\" | \"to\" | \"label\" | \"icon\">[];\n}): number {\n const level = new Map(nodes.map((node) => [node.id, node.level]));\n const chars = edges\n .filter((edge) => level.get(edge.from) !== level.get(edge.to))\n .map((edge) => (edge.label?.length ?? 0) + (edge.icon != null ? PILL_ICON_CHARS : 0));\n return Math.max(MIN_COLUMN_GAP, Math.round(Math.max(0, ...chars) * PILL_CHAR_WIDTH) + PILL_CHROME);\n}\n\nexport function recordGroups(visible: VisibleGraph, vocabulary: CallGraphVocabulary): Map<string, string> {\n const grouped = new Map<string, CallGraphNode[]>();\n for (const node of visible.nodes) {\n if (node.group !== undefined) grouped.set(node.group, [...(grouped.get(node.group) ?? []), node]);\n }\n const records = new Map<string, string>();\n for (const [group, nodes] of grouped) {\n const kind = nodes[0]?.kind;\n if (kind !== undefined && nodes.every((node) => vocabulary.isData(node) && isDataMember(node) && node.kind === kind)) {\n const owner = DATA_MEMBER_OWNER[kind];\n if (owner === undefined) throw new Error(`call graph: no owner kind for data member \"${kind}\"`);\n records.set(group, owner);\n }\n }\n return records;\n}\n\n/** A collapsed group's members, and the stand-in node drawn for them. */\nexport interface GroupFold {\n group: string;\n members: CallGraphNode[];\n}\n\n/** One edge drawn for the edges of several members: the edges it stands for and the members at their ends. */\nexport interface EdgeMerge {\n sources: CallGraphEdge[];\n members: CallGraphNode[];\n}\n\nexport interface DrawnGraph {\n graph: CallGraph;\n visible: VisibleGraph;\n /** By stand-in id. */\n folds: ReadonlyMap<string, GroupFold>;\n /** By the id of the edge drawn for them. */\n merged: ReadonlyMap<string, EdgeMerge>;\n}\n\nconst STAND_IN_PREFIX = \"group:\";\n\n/** The id of the node a collapsed group is drawn as. */\nexport function standInId(group: string): string {\n return `${STAND_IN_PREFIX}${group}`;\n}\n\nfunction rootGroups(graph: CallGraph): Set<string | undefined> {\n return new Set(graph.roots.map((id) => requireNode(graph, id).group));\n}\n\n/** The groups that hold a drawn node and can collapse: every one but the root's, in first-drawn order. */\nexport function collapsibleGroups(graph: CallGraph, visible: VisibleGraph): string[] {\n const roots = rootGroups(graph);\n return [...new Set(visible.nodes.map((node) => node.group))].filter((group): group is string => group !== undefined && !roots.has(group));\n}\n\n/** \"10 columns\", \"2 fields\", \"3 variables\": how many members, in the words of their one kind, else \"members\". */\nfunction countWords(members: readonly CallGraphNode[], graph: CallGraph, vocabulary: CallGraphVocabulary): string {\n const [first] = members;\n const kind = first && members.every((member) => member.kind === first.kind) ? vocabulary.kindOf(graph, first) : \"member\";\n return `${members.length} ${kind}${members.length === 1 ? \"\" : \"s\"}`;\n}\n\n/** A merged edge's properties: the names of the members it stands for, gathered as columns, fields or members. */\nfunction memberProperties(members: readonly CallGraphNode[]): Record<string, string> {\n const keys: Record<string, string> = { column: \"columns\", field: \"fields\" };\n const names = new Map<string, string[]>();\n for (const member of members) {\n const key = keys[member.kind] ?? \"members\";\n names.set(key, [...(names.get(key) ?? []), member.label]);\n }\n return Object.fromEntries([...names].map(([key, list]) => [key, list.join(\", \")]));\n}\n\nfunction mergeEdges(id: string, sources: readonly CallGraphEdge[], standInOf: ReadonlyMap<string, string>, nodes: ReadonlyMap<string, CallGraphNode>): [CallGraphEdge, EdgeMerge] {\n const [first] = sources;\n if (!first) throw new Error(`call graph: merged edge \"${id}\" stands for no edge`);\n const memberIds = [...new Set(sources.flatMap((edge) => [edge.from, edge.to]).filter((end) => standInOf.has(end)))];\n const members = memberIds.map((member) => {\n const node = nodes.get(member);\n if (!node) throw new Error(`call graph: no node \"${member}\"`);\n return node;\n });\n const kind = sources.every((edge) => edge.kind === first.kind) ? first.kind : undefined;\n const edge: CallGraphEdge = {\n id, from: standInOf.get(first.from) ?? first.from, to: standInOf.get(first.to) ?? first.to, type: first.type,\n ...(kind !== undefined ? { kind } : {}),\n sites: distinctSites(sources.flatMap((source) => source.sites)),\n properties: memberProperties(members),\n };\n return [edge, { sources: [...sources], members }];\n}\n\n/** Edges with an end in a collapsed group, re-ended on its stand-in and merged per stand-in, other end and type. */\nfunction foldEdges(edges: readonly CallGraphEdge[], standInOf: ReadonlyMap<string, string>, nodes: ReadonlyMap<string, CallGraphNode>) {\n const kept: CallGraphEdge[] = [];\n const grouped = new Map<string, CallGraphEdge[]>();\n for (const edge of edges) {\n const from = standInOf.get(edge.from) ?? edge.from;\n const to = standInOf.get(edge.to) ?? edge.to;\n if (from === edge.from && to === edge.to) kept.push(edge);\n else grouped.set(`${from}|${to}|${edge.type}`, [...(grouped.get(`${from}|${to}|${edge.type}`) ?? []), edge]);\n }\n const merged = new Map([...grouped].map(([id, sources]) => mergeEdges(id, sources, standInOf, nodes)).map(([edge, merge]) => [edge.id, { edge, merge }]));\n return { edges: [...kept, ...[...merged.values()].map(({ edge }) => edge)], merged: new Map([...merged].map(([id, { merge }]) => [id, merge])) };\n}\n\n/** The node a collapsed group is drawn as: its owner's kind for a record, else its first member's, at the depth nearest the root. */\nfunction standInNode(id: string, fold: GroupFold, graph: CallGraph, records: ReadonlyMap<string, string>, edges: readonly CallGraphEdge[]): CallGraphNode {\n const [first, ...rest] = fold.members;\n if (!first) throw new Error(`call graph: collapsed group \"${fold.group}\" holds no node`);\n const nearest = rest.reduce((best, member) => (Math.abs(member.depth) < Math.abs(best.depth) ? member : best), first);\n return {\n id, identifier: {}, kind: records.get(fold.group) ?? first.kind,\n label: graph.groups?.find((group) => group.id === fold.group)?.label ?? fold.group,\n group: fold.group, depth: nearest.depth,\n in: edges.filter((edge) => edge.to === id).length, out: edges.filter((edge) => edge.from === id).length,\n };\n}\n\n/** The graph with each collapsed group's drawn members folded into one stand-in. */\nfunction foldGroups(graph: CallGraph, visible: VisibleGraph, collapsed: readonly string[], records: ReadonlyMap<string, string>): DrawnGraph {\n const roots = rootGroups(graph);\n const folds = new Map<string, GroupFold>();\n const standInOf = new Map<string, string>();\n for (const node of visible.nodes) {\n if (node.group === undefined || roots.has(node.group) || !collapsed.includes(node.group)) continue;\n const id = standInId(node.group);\n folds.set(id, { group: node.group, members: [...(folds.get(id)?.members ?? []), node] });\n standInOf.set(node.id, id);\n }\n if (folds.size === 0) return { graph, visible, folds, merged: new Map() };\n const { edges, merged } = foldEdges(graph.edges, standInOf, new Map(graph.nodes.map((node) => [node.id, node])));\n const standIns = [...folds].map(([id, fold]) => standInNode(id, fold, graph, records, edges));\n const nodes = [...visible.nodes.filter((node) => !standInOf.has(node.id)), ...standIns];\n const drawnIds = new Set(nodes.map((node) => node.id));\n return {\n graph: { ...graph, nodes: [...graph.nodes.filter((node) => !standInOf.has(node.id)), ...standIns], edges },\n visible: { nodes, edges: edges.filter((edge) => drawnIds.has(edge.from) && drawnIds.has(edge.to)) },\n folds,\n merged,\n };\n}\n\nfunction toDiagramGroup({ id, label }: CallGraphGroup, { glyphs, graph, vocabulary }: DiagramInput, drawn: DrawnGraph, records: ReadonlyMap<string, string>, collapsible: ReadonlySet<string> | undefined): DiagramGroup {\n const fold = drawn.folds.get(standInId(id));\n return {\n id, label: glyphs.group(groupCaption(label), records.get(id)), title: label,\n ...(records.has(id) ? { variant: \"record\" as const } : {}),\n ...(collapsible?.has(id) ? { collapsed: fold !== undefined } : {}),\n ...(fold ? { aside: countWords(fold.members, graph, vocabulary) } : {}),\n };\n}\n\nexport function toDiagram(input: DiagramInput): Diagram {\n const { graph, visible, options, vocabulary, collapsed } = input;\n const records = options.grouped ? recordGroups(visible, vocabulary) : new Map<string, string>();\n const drawn = options.grouped && collapsed ? foldGroups(graph, visible, collapsed, records) : { graph, visible, folds: new Map(), merged: new Map() };\n const collapsible = options.grouped && collapsed ? new Set(collapsibleGroups(graph, visible)) : undefined;\n const rank = groupRank(drawn.graph, vocabulary);\n return {\n nodes: [...drawn.visible.nodes].sort((a, b) => rank(a) - rank(b)).map((node) => toDiagramNode(node, input, drawn, records)),\n edges: drawn.visible.edges.map((edge) => toDiagramEdge(edge, input, drawn)),\n groups: options.grouped ? (graph.groups ?? []).map((group) => toDiagramGroup(group, input, drawn, records, collapsible)) : [],\n drawn,\n };\n}\n"],"names":["CALL_GRAPH_ACCESS","types","siteKey","rootGroups","mergeAccess","dataMemberAside","nodeTitle","edgeLabel","edgeTitle","isConditional","isDataMember","DATA_MEMBER_OWNER","edge","groupCaption"],"mappings":";;;;;;AAuBO,MAAM,uBAAuB;AAE7B,MAAM,2BAA2B;AAEjC,MAAM,sBAA2C,EAAE,MAAM,QAAQ,UAAU,YAAY,MAAM,QAAQ,OAAO,QAAA;AAGnH,MAAM,YAAmE,EAAE,UAAU,QAAQ,MAAM,WAAW,OAAO,UAAA;AAG9G,SAAS,aAAa,QAAoC,MAA0C;AACzG,QAAM,KAAK,CAAC,OAAO,SAAS,IAAI;AAChC,MAAI,CAAC,MAAM,SAAS,cAAc,WAAW,MAAM,EAAE,WAAW,EAAG,OAAM,IAAI,MAAM,eAAe,IAAI,6BAA6B;AACnI,SAAO,aAAa,OAAO,CAAC,UAAW,UAAU,OAAO,KAAK,OAAO,SAAS,KAAK,CAAE;AACtF;AAGA,MAAM,eAA2C,CAAC,GAAGA,MAAAA,mBAAmB,UAAU;AAG3E,SAAS,WAAW,QAAuD;AAChF,SAAO,OAAO,OAAO,CAAC,SAASA,MAAAA,k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AAc;AAC3D,QAAM,UAAU,QAAQ,UAAU,aAAa,SAAS,UAAU,wBAAQ,IAAA;AAC1E,QAAM,QAAQ,QAAQ,WAAW,YAAY,WAAW,OAAO,SAAS,WAAW,OAAO,IAAI,EAAE,OAAO,SAAS,OAAO,oBAAI,IAAA,GAAO,QAAQ,oBAAI,MAAI;AAClJ,QAAM,cAAc,QAAQ,WAAW,YAAY,IAAI,IAAI,kBAAkB,OAAO,OAAO,CAAC,IAAI;AAChG,QAAM,OAAO,UAAU,MAAM,OAAO,UAAU;AAC9C,SAAO;AAAA,IACL,OAAO,CAAC,GAAG,MAAM,QAAQ,KAAK,EAAE,KAAK,CAAC,GAAG,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,SAAS,cAAc,MAAM,OAAO,OAAO,OAAO,CAAC;AAAA,IAC1H,OAAO,MAAM,QAAQ,MAAM,IAAI,CAAC,SAAS,cAAc,MAAM,OAAO,KAAK,CAAC;AAAA,IAC1E,QAAQ,QAAQ,WAAW,MAAM,UAAU,CAAA,GAAI,IAAI,CAAC,UAAU,eAAe,OAAO,OAAO,OAAO,SAAS,WAAW,CAAC,IAAI,CAAA;AAAA,IAC3H;AAAA,EAAA;AAEJ;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DataAccess } from '../data-access.js';
|
|
3
|
+
import { GraphDiagramEdge, GraphDiagramGroup, GraphDiagramNode } from '../graph-diagram-model.js';
|
|
4
|
+
import { PillOptions } from './call-graph-labels.js';
|
|
5
|
+
import { CallGraphVocabulary } from './call-graph-vocabulary.js';
|
|
6
|
+
import { CallGraph, CallGraphAccess, CallGraphDirection, CallGraphEdge, CallGraphEdgeLabels, CallGraphEdgeType, CallGraphNode } from './types.js';
|
|
7
|
+
/** The deepest graph uir builds (graph.MaxDepth). */
|
|
8
|
+
export declare const CALL_GRAPH_MAX_DEPTH = 8;
|
|
9
|
+
/** The depth uir builds when none is asked for (graph.DefaultDepth). */
|
|
10
|
+
export declare const CALL_GRAPH_DEFAULT_DEPTH = 2;
|
|
11
|
+
export declare const DEFAULT_EDGE_LABELS: CallGraphEdgeLabels;
|
|
12
|
+
/** Turns one access type on or off, in the usual order. Turning the last one off fails: a graph follows something. */
|
|
13
|
+
export declare function toggleAccess(access: readonly CallGraphAccess[], type: CallGraphAccess): CallGraphAccess[];
|
|
14
|
+
/** The access types of `access` that are not variables, at least one of which a graph follows. */
|
|
15
|
+
export declare function baseAccess(access: readonly CallGraphAccess[]): CallGraphAccess[];
|
|
16
|
+
export interface GraphView {
|
|
17
|
+
direction: CallGraphDirection;
|
|
18
|
+
/** Nodes further than this many hops from the root are hidden. */
|
|
19
|
+
depth: number;
|
|
20
|
+
/** Node ids shown regardless of `depth`, because a `+N` expansion revealed them. */
|
|
21
|
+
revealed: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
export interface VisibleGraph {
|
|
24
|
+
nodes: CallGraphNode[];
|
|
25
|
+
edges: CallGraphEdge[];
|
|
26
|
+
}
|
|
27
|
+
export interface DiagramOptions extends PillOptions {
|
|
28
|
+
/** Box nodes by their `group`. */
|
|
29
|
+
grouped: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type DiagramNode = GraphDiagramNode & {
|
|
32
|
+
label: string;
|
|
33
|
+
level: number;
|
|
34
|
+
title: string;
|
|
35
|
+
};
|
|
36
|
+
export type DiagramEdge = GraphDiagramEdge & {
|
|
37
|
+
dashed: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type DiagramGroup = GraphDiagramGroup & {
|
|
40
|
+
title: string;
|
|
41
|
+
aside?: string;
|
|
42
|
+
};
|
|
43
|
+
export interface Diagram {
|
|
44
|
+
nodes: DiagramNode[];
|
|
45
|
+
edges: DiagramEdge[];
|
|
46
|
+
groups: DiagramGroup[];
|
|
47
|
+
/** The graph as drawn, collapsed groups folded into their stand-ins: what a selection is looked up in. */
|
|
48
|
+
drawn: DrawnGraph;
|
|
49
|
+
}
|
|
50
|
+
/** Draws the glyphs the model chooses. The component supplies icons; the tests supply strings. */
|
|
51
|
+
export interface DiagramGlyphs {
|
|
52
|
+
/** `words` is the icon's name for a screen reader, such as `external function`. */
|
|
53
|
+
node(glyph: string, words: string): ReactNode;
|
|
54
|
+
/** The pill icon of an edge type; a plain call has none. */
|
|
55
|
+
edge(type: CallGraphEdgeType): ReactNode | undefined;
|
|
56
|
+
group(caption: string, glyph?: string): ReactNode;
|
|
57
|
+
/** The mark of a node the reads and writes into it access; without it no node is marked. */
|
|
58
|
+
access?(access: DataAccess): ReactNode;
|
|
59
|
+
}
|
|
60
|
+
export interface DiagramInput {
|
|
61
|
+
graph: CallGraph;
|
|
62
|
+
visible: VisibleGraph;
|
|
63
|
+
direction: CallGraphDirection;
|
|
64
|
+
options: DiagramOptions;
|
|
65
|
+
glyphs: DiagramGlyphs;
|
|
66
|
+
vocabulary: CallGraphVocabulary;
|
|
67
|
+
edgeLabels: CallGraphEdgeLabels;
|
|
68
|
+
/**
|
|
69
|
+
* The groups drawn as their header alone, by id: each folds into one stand-in node, and its members'
|
|
70
|
+
* edges merge onto it. The root's group never folds. Leave it out and no group can collapse.
|
|
71
|
+
*/
|
|
72
|
+
collapsed?: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
export declare function requireNode(graph: CallGraph, id: string): CallGraphNode;
|
|
75
|
+
/** The nodes on the requested side within `depth`, plus revealed ones, and the edges between them. */
|
|
76
|
+
export declare function visibleGraph(graph: CallGraph, view: GraphView): VisibleGraph;
|
|
77
|
+
/** The direction a `+N` expansion of the node walks: its outer side, the side `+N` counts. */
|
|
78
|
+
export declare function expansionDirection(node: CallGraphNode): Exclude<CallGraphDirection, "both">;
|
|
79
|
+
/** The neighbours on a node's outer side that the response holds and are not drawn. */
|
|
80
|
+
export declare function hiddenNeighbours(graph: CallGraph, visible: VisibleGraph, nodeId: string): string[];
|
|
81
|
+
/**
|
|
82
|
+
* The `+N` on a node: how many more edges there are to load on its outer side. Only that side's count
|
|
83
|
+
* is a total (`out` for the root and callees, `in` for callers); the other equals the edges in the
|
|
84
|
+
* response. Excluded neighbours are in neither. From it come off the edges drawn, a merged edge counting
|
|
85
|
+
* every edge it stands for. A node without a source cannot be expanded, nor can the side the direction hides.
|
|
86
|
+
*/
|
|
87
|
+
export declare function expandCount(graph: CallGraph, visible: VisibleGraph, nodeId: string, direction: CallGraphDirection, vocabulary: Pick<CallGraphVocabulary, "hasSource">, merged?: ReadonlyMap<string, EdgeMerge>): number;
|
|
88
|
+
export interface NodeTotals {
|
|
89
|
+
callers?: number;
|
|
90
|
+
callees?: number;
|
|
91
|
+
readers?: number;
|
|
92
|
+
writers?: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A node's call totals on the sides the response walked: callees at depth >= 0, callers at depth <= 0.
|
|
96
|
+
* A data node counts who reads, writes and calls it instead.
|
|
97
|
+
*/
|
|
98
|
+
export declare function walkedTotals(graph: CallGraph, node: CallGraphNode, vocabulary: Pick<CallGraphVocabulary, "isData">): NodeTotals;
|
|
99
|
+
/**
|
|
100
|
+
* Merges a one-hop expansion into the held graph. The expansion is rooted at a held node, so its
|
|
101
|
+
* depths are re-signed from that node's depth. Held nodes keep their place; edges are keyed by
|
|
102
|
+
* `from|to|type`, gain the call sites they did not hold and keep their first non-empty properties;
|
|
103
|
+
* the held response's other fields stay.
|
|
104
|
+
*/
|
|
105
|
+
export declare function mergeGraph<T extends CallGraph>(held: T, expansion: CallGraph): T;
|
|
106
|
+
/**
|
|
107
|
+
* The gap between columns: as wide as the longest pill on an edge between two columns, so no pill
|
|
108
|
+
* covers a node. Wider gaps than the pills need make the diagram wider, and so smaller once fitted.
|
|
109
|
+
*/
|
|
110
|
+
export declare function columnGap({ nodes, edges, }: {
|
|
111
|
+
nodes: readonly Pick<DiagramNode, "id" | "level">[];
|
|
112
|
+
edges: readonly Pick<DiagramEdge, "id" | "from" | "to" | "label" | "icon">[];
|
|
113
|
+
}): number;
|
|
114
|
+
export declare function recordGroups(visible: VisibleGraph, vocabulary: CallGraphVocabulary): Map<string, string>;
|
|
115
|
+
/** A collapsed group's members, and the stand-in node drawn for them. */
|
|
116
|
+
export interface GroupFold {
|
|
117
|
+
group: string;
|
|
118
|
+
members: CallGraphNode[];
|
|
119
|
+
}
|
|
120
|
+
/** One edge drawn for the edges of several members: the edges it stands for and the members at their ends. */
|
|
121
|
+
export interface EdgeMerge {
|
|
122
|
+
sources: CallGraphEdge[];
|
|
123
|
+
members: CallGraphNode[];
|
|
124
|
+
}
|
|
125
|
+
export interface DrawnGraph {
|
|
126
|
+
graph: CallGraph;
|
|
127
|
+
visible: VisibleGraph;
|
|
128
|
+
/** By stand-in id. */
|
|
129
|
+
folds: ReadonlyMap<string, GroupFold>;
|
|
130
|
+
/** By the id of the edge drawn for them. */
|
|
131
|
+
merged: ReadonlyMap<string, EdgeMerge>;
|
|
132
|
+
}
|
|
133
|
+
/** The id of the node a collapsed group is drawn as. */
|
|
134
|
+
export declare function standInId(group: string): string;
|
|
135
|
+
/** The groups that hold a drawn node and can collapse: every one but the root's, in first-drawn order. */
|
|
136
|
+
export declare function collapsibleGroups(graph: CallGraph, visible: VisibleGraph): string[];
|
|
137
|
+
export declare function toDiagram(input: DiagramInput): Diagram;
|
|
138
|
+
//# sourceMappingURL=call-graph-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"call-graph-model.d.ts","sourceRoot":"","sources":["../../../src/data/call-graph/call-graph-model.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAO,EAAqD,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EA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