@flanksource/clicky-ui 0.3.59 → 0.3.61
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/NOTICE.md +62 -0
- package/dist/chat.cjs +7 -1
- package/dist/chat.js +4 -2
- package/dist/comments/AnnotationSurface.cjs +317 -0
- package/dist/comments/AnnotationSurface.cjs.map +1 -0
- package/dist/comments/AnnotationSurface.d.ts +19 -0
- package/dist/comments/AnnotationSurface.d.ts.map +1 -0
- package/dist/comments/AnnotationSurface.js +317 -0
- package/dist/comments/AnnotationSurface.js.map +1 -0
- package/dist/comments/CapturePin.cjs +26 -0
- package/dist/comments/CapturePin.cjs.map +1 -0
- package/dist/comments/CapturePin.d.ts +12 -0
- package/dist/comments/CapturePin.d.ts.map +1 -0
- package/dist/comments/CapturePin.js +26 -0
- package/dist/comments/CapturePin.js.map +1 -0
- package/dist/comments/CommentAuthor.cjs +17 -3
- package/dist/comments/CommentAuthor.cjs.map +1 -1
- package/dist/comments/CommentAuthor.d.ts +3 -0
- package/dist/comments/CommentAuthor.d.ts.map +1 -1
- package/dist/comments/CommentAuthor.js +18 -5
- package/dist/comments/CommentAuthor.js.map +1 -1
- package/dist/comments/CommentCard.cjs +98 -52
- package/dist/comments/CommentCard.cjs.map +1 -1
- package/dist/comments/CommentCard.d.ts +3 -0
- package/dist/comments/CommentCard.d.ts.map +1 -1
- package/dist/comments/CommentCard.js +100 -54
- package/dist/comments/CommentCard.js.map +1 -1
- package/dist/comments/CommentCardParts.cjs +76 -0
- package/dist/comments/CommentCardParts.cjs.map +1 -1
- package/dist/comments/CommentCardParts.d.ts.map +1 -1
- package/dist/comments/CommentCardParts.js +76 -0
- package/dist/comments/CommentCardParts.js.map +1 -1
- package/dist/comments/CommentComposer.cjs +71 -34
- package/dist/comments/CommentComposer.cjs.map +1 -1
- package/dist/comments/CommentComposer.d.ts +2 -1
- package/dist/comments/CommentComposer.d.ts.map +1 -1
- package/dist/comments/CommentComposer.js +72 -35
- package/dist/comments/CommentComposer.js.map +1 -1
- package/dist/comments/CommentDraftCard.cjs +68 -0
- package/dist/comments/CommentDraftCard.cjs.map +1 -0
- package/dist/comments/CommentDraftCard.d.ts +7 -0
- package/dist/comments/CommentDraftCard.d.ts.map +1 -0
- package/dist/comments/CommentDraftCard.js +68 -0
- package/dist/comments/CommentDraftCard.js.map +1 -0
- package/dist/comments/CommentDraftPopover.cjs +60 -0
- package/dist/comments/CommentDraftPopover.cjs.map +1 -0
- package/dist/comments/CommentDraftPopover.d.ts +6 -0
- package/dist/comments/CommentDraftPopover.d.ts.map +1 -0
- package/dist/comments/CommentDraftPopover.js +60 -0
- package/dist/comments/CommentDraftPopover.js.map +1 -0
- package/dist/comments/CommentEditor.cjs +350 -0
- package/dist/comments/CommentEditor.cjs.map +1 -0
- package/dist/comments/CommentEditor.d.ts +10 -0
- package/dist/comments/CommentEditor.d.ts.map +1 -0
- package/dist/comments/CommentEditor.js +350 -0
- package/dist/comments/CommentEditor.js.map +1 -0
- package/dist/comments/CommentMarkdown.cjs +28 -13
- package/dist/comments/CommentMarkdown.cjs.map +1 -1
- package/dist/comments/CommentMarkdown.d.ts +4 -1
- package/dist/comments/CommentMarkdown.d.ts.map +1 -1
- package/dist/comments/CommentMarkdown.js +28 -13
- package/dist/comments/CommentMarkdown.js.map +1 -1
- package/dist/comments/CommentPersistenceBoundary.cjs +55 -0
- package/dist/comments/CommentPersistenceBoundary.cjs.map +1 -0
- package/dist/comments/CommentPersistenceBoundary.d.ts +6 -0
- package/dist/comments/CommentPersistenceBoundary.d.ts.map +1 -0
- package/dist/comments/CommentPersistenceBoundary.js +55 -0
- package/dist/comments/CommentPersistenceBoundary.js.map +1 -0
- package/dist/comments/CommentPreview.cjs +45 -0
- package/dist/comments/CommentPreview.cjs.map +1 -0
- package/dist/comments/CommentPreview.d.ts +7 -0
- package/dist/comments/CommentPreview.d.ts.map +1 -0
- package/dist/comments/CommentPreview.js +45 -0
- package/dist/comments/CommentPreview.js.map +1 -0
- package/dist/comments/CommentProvider.cjs +34 -9
- package/dist/comments/CommentProvider.cjs.map +1 -1
- package/dist/comments/CommentProvider.d.ts +3 -1
- package/dist/comments/CommentProvider.d.ts.map +1 -1
- package/dist/comments/CommentProvider.js +34 -9
- package/dist/comments/CommentProvider.js.map +1 -1
- package/dist/comments/CommentRail.cjs +83 -0
- package/dist/comments/CommentRail.cjs.map +1 -0
- package/dist/comments/CommentRail.d.ts +18 -0
- package/dist/comments/CommentRail.d.ts.map +1 -0
- package/dist/comments/CommentRail.js +83 -0
- package/dist/comments/CommentRail.js.map +1 -0
- package/dist/comments/CommentReplyInput.cjs +73 -0
- package/dist/comments/CommentReplyInput.cjs.map +1 -0
- package/dist/comments/CommentReplyInput.d.ts +9 -0
- package/dist/comments/CommentReplyInput.d.ts.map +1 -0
- package/dist/comments/CommentReplyInput.js +73 -0
- package/dist/comments/CommentReplyInput.js.map +1 -0
- package/dist/comments/CommentSidePanel.cjs +22 -6
- package/dist/comments/CommentSidePanel.cjs.map +1 -1
- package/dist/comments/CommentSidePanel.d.ts +4 -1
- package/dist/comments/CommentSidePanel.d.ts.map +1 -1
- package/dist/comments/CommentSidePanel.js +22 -6
- package/dist/comments/CommentSidePanel.js.map +1 -1
- package/dist/comments/CommentThread.cjs +4 -1
- package/dist/comments/CommentThread.cjs.map +1 -1
- package/dist/comments/CommentThread.d.ts +3 -2
- package/dist/comments/CommentThread.d.ts.map +1 -1
- package/dist/comments/CommentThread.js +4 -1
- package/dist/comments/CommentThread.js.map +1 -1
- package/dist/comments/CommentThreadList.cjs +55 -86
- package/dist/comments/CommentThreadList.cjs.map +1 -1
- package/dist/comments/CommentThreadList.d.ts +4 -3
- package/dist/comments/CommentThreadList.d.ts.map +1 -1
- package/dist/comments/CommentThreadList.js +56 -87
- package/dist/comments/CommentThreadList.js.map +1 -1
- package/dist/comments/ElementOutline.cjs +20 -0
- package/dist/comments/ElementOutline.cjs.map +1 -0
- package/dist/comments/ElementOutline.d.ts +6 -0
- package/dist/comments/ElementOutline.d.ts.map +1 -0
- package/dist/comments/ElementOutline.js +20 -0
- package/dist/comments/ElementOutline.js.map +1 -0
- package/dist/comments/VocabularyChip.cjs +50 -0
- package/dist/comments/VocabularyChip.cjs.map +1 -0
- package/dist/comments/VocabularyChip.d.ts +6 -0
- package/dist/comments/VocabularyChip.d.ts.map +1 -0
- package/dist/comments/VocabularyChip.js +50 -0
- package/dist/comments/VocabularyChip.js.map +1 -0
- package/dist/comments/VocabularyPreview.cjs +15 -0
- package/dist/comments/VocabularyPreview.cjs.map +1 -0
- package/dist/comments/VocabularyPreview.d.ts +7 -0
- package/dist/comments/VocabularyPreview.d.ts.map +1 -0
- package/dist/comments/VocabularyPreview.js +15 -0
- package/dist/comments/VocabularyPreview.js.map +1 -0
- package/dist/comments/agent-delivery.cjs +23 -0
- package/dist/comments/agent-delivery.cjs.map +1 -0
- package/dist/comments/agent-delivery.d.ts +15 -0
- package/dist/comments/agent-delivery.d.ts.map +1 -0
- package/dist/comments/agent-delivery.js +22 -0
- package/dist/comments/agent-delivery.js.map +1 -0
- package/dist/comments/anchoring/CommentAnchorBridge.cjs +36 -0
- package/dist/comments/anchoring/CommentAnchorBridge.cjs.map +1 -0
- package/dist/comments/anchoring/CommentAnchorBridge.d.ts +8 -0
- package/dist/comments/anchoring/CommentAnchorBridge.d.ts.map +1 -0
- package/dist/comments/anchoring/CommentAnchorBridge.js +36 -0
- package/dist/comments/anchoring/CommentAnchorBridge.js.map +1 -0
- package/dist/comments/anchoring/dom-anchor.cjs +402 -0
- package/dist/comments/anchoring/dom-anchor.cjs.map +1 -0
- package/dist/comments/anchoring/dom-anchor.d.ts +82 -0
- package/dist/comments/anchoring/dom-anchor.d.ts.map +1 -0
- package/dist/comments/anchoring/dom-anchor.js +384 -0
- package/dist/comments/anchoring/dom-anchor.js.map +1 -0
- package/dist/comments/anchoring/index.d.ts +6 -0
- package/dist/comments/anchoring/index.d.ts.map +1 -0
- package/dist/comments/anchoring/markdown-anchor.cjs +188 -0
- package/dist/comments/anchoring/markdown-anchor.cjs.map +1 -0
- package/dist/comments/anchoring/markdown-anchor.d.ts +37 -0
- package/dist/comments/anchoring/markdown-anchor.d.ts.map +1 -0
- package/dist/comments/anchoring/markdown-anchor.js +181 -0
- package/dist/comments/anchoring/markdown-anchor.js.map +1 -0
- package/dist/comments/anchoring/model.cjs +11 -0
- package/dist/comments/anchoring/model.cjs.map +1 -0
- package/dist/comments/anchoring/model.d.ts +30 -0
- package/dist/comments/anchoring/model.d.ts.map +1 -0
- package/dist/comments/anchoring/model.js +8 -0
- package/dist/comments/anchoring/model.js.map +1 -0
- package/dist/comments/anchoring/patch-anchor.cjs +86 -0
- package/dist/comments/anchoring/patch-anchor.cjs.map +1 -0
- package/dist/comments/anchoring/patch-anchor.d.ts +26 -0
- package/dist/comments/anchoring/patch-anchor.d.ts.map +1 -0
- package/dist/comments/anchoring/patch-anchor.js +80 -0
- package/dist/comments/anchoring/patch-anchor.js.map +1 -0
- package/dist/comments/annotation-screenshot.cjs +191 -0
- package/dist/comments/annotation-screenshot.cjs.map +1 -0
- package/dist/comments/annotation-screenshot.d.ts +16 -0
- package/dist/comments/annotation-screenshot.d.ts.map +1 -0
- package/dist/comments/annotation-screenshot.js +189 -0
- package/dist/comments/annotation-screenshot.js.map +1 -0
- package/dist/comments/annotation-types.d.ts +36 -0
- package/dist/comments/annotation-types.d.ts.map +1 -0
- package/dist/comments/comment-context.cjs.map +1 -1
- package/dist/comments/comment-context.d.ts +1 -1
- package/dist/comments/comment-context.d.ts.map +1 -1
- package/dist/comments/comment-context.js.map +1 -1
- package/dist/comments/comment-detail.d.ts +14 -0
- package/dist/comments/comment-detail.d.ts.map +1 -0
- package/dist/comments/comment-persistence.cjs +102 -0
- package/dist/comments/comment-persistence.cjs.map +1 -0
- package/dist/comments/comment-persistence.d.ts +29 -0
- package/dist/comments/comment-persistence.d.ts.map +1 -0
- package/dist/comments/comment-persistence.js +99 -0
- package/dist/comments/comment-persistence.js.map +1 -0
- package/dist/comments/comment-types.cjs.map +1 -1
- package/dist/comments/comment-types.d.ts +18 -0
- package/dist/comments/comment-types.d.ts.map +1 -1
- package/dist/comments/comment-types.js.map +1 -1
- package/dist/comments/comment-utils.cjs +3 -1
- package/dist/comments/comment-utils.cjs.map +1 -1
- package/dist/comments/comment-utils.d.ts.map +1 -1
- package/dist/comments/comment-utils.js +3 -1
- package/dist/comments/comment-utils.js.map +1 -1
- package/dist/comments/comment-vocabulary.cjs +38 -0
- package/dist/comments/comment-vocabulary.cjs.map +1 -0
- package/dist/comments/comment-vocabulary.d.ts +33 -0
- package/dist/comments/comment-vocabulary.d.ts.map +1 -0
- package/dist/comments/comment-vocabulary.js +34 -0
- package/dist/comments/comment-vocabulary.js.map +1 -0
- package/dist/comments/element-picker.cjs +47 -0
- package/dist/comments/element-picker.cjs.map +1 -0
- package/dist/comments/element-picker.d.ts +28 -0
- package/dist/comments/element-picker.d.ts.map +1 -0
- package/dist/comments/element-picker.js +46 -0
- package/dist/comments/element-picker.js.map +1 -0
- package/dist/comments/use-comment-rail-width.cjs +28 -0
- package/dist/comments/use-comment-rail-width.cjs.map +1 -0
- package/dist/comments/use-comment-rail-width.d.ts +2 -0
- package/dist/comments/use-comment-rail-width.d.ts.map +1 -0
- package/dist/comments/use-comment-rail-width.js +28 -0
- package/dist/comments/use-comment-rail-width.js.map +1 -0
- package/dist/comments/vocabulary-capture.cjs +47 -0
- package/dist/comments/vocabulary-capture.cjs.map +1 -0
- package/dist/comments/vocabulary-capture.d.ts +10 -0
- package/dist/comments/vocabulary-capture.d.ts.map +1 -0
- package/dist/comments/vocabulary-capture.js +47 -0
- package/dist/comments/vocabulary-capture.js.map +1 -0
- package/dist/comments.cjs +87 -6
- package/dist/comments.d.ts +18 -1
- package/dist/comments.d.ts.map +1 -1
- package/dist/comments.js +26 -7
- package/dist/components/DateField.d.ts +1 -1
- package/dist/components/DatePicker.d.ts +1 -1
- package/dist/components/DateTimePicker.d.ts +1 -1
- package/dist/components/SplitButton.cjs +2 -2
- package/dist/components/SplitButton.cjs.map +1 -1
- package/dist/components/SplitButton.js +2 -2
- package/dist/components/SplitButton.js.map +1 -1
- package/dist/components/mdx-editor-callout-model.d.ts +1 -1
- package/dist/components/mdx-editor-field-plugins.cjs +11 -2
- package/dist/components/mdx-editor-field-plugins.cjs.map +1 -1
- package/dist/components/mdx-editor-field-plugins.d.ts.map +1 -1
- package/dist/components/mdx-editor-field-plugins.js +11 -2
- package/dist/components/mdx-editor-field-plugins.js.map +1 -1
- package/dist/components/mdx-editor-options.d.ts +7 -0
- package/dist/components/mdx-editor-options.d.ts.map +1 -1
- package/dist/components.cjs +2 -0
- package/dist/components.d.ts +1 -0
- package/dist/components.d.ts.map +1 -1
- package/dist/components.js +2 -1
- package/dist/data/Clicky.cjs +2 -1
- package/dist/data/Clicky.cjs.map +1 -1
- package/dist/data/Clicky.d.ts +2 -0
- package/dist/data/Clicky.d.ts.map +1 -1
- package/dist/data/Clicky.js +2 -1
- package/dist/data/Clicky.js.map +1 -1
- package/dist/data/ImagePreview.cjs +42 -0
- package/dist/data/ImagePreview.cjs.map +1 -0
- package/dist/data/ImagePreview.d.ts +13 -0
- package/dist/data/ImagePreview.d.ts.map +1 -0
- package/dist/data/ImagePreview.js +42 -0
- package/dist/data/ImagePreview.js.map +1 -0
- package/dist/data/Markdown.cjs +31 -2
- package/dist/data/Markdown.cjs.map +1 -1
- package/dist/data/Markdown.d.ts +3 -1
- package/dist/data/Markdown.d.ts.map +1 -1
- package/dist/data/Markdown.js +31 -2
- package/dist/data/Markdown.js.map +1 -1
- package/dist/data/MarkdownEditor.model.d.ts +1 -1
- package/dist/data/PromptBanner.model.cjs +10 -0
- package/dist/data/PromptBanner.model.cjs.map +1 -1
- package/dist/data/PromptBanner.model.d.ts +2 -0
- package/dist/data/PromptBanner.model.d.ts.map +1 -1
- package/dist/data/PromptBanner.model.js +10 -1
- package/dist/data/PromptBanner.model.js.map +1 -1
- package/dist/data/PromptDialog.cjs +16 -49
- package/dist/data/PromptDialog.cjs.map +1 -1
- package/dist/data/PromptDialog.d.ts +7 -1
- package/dist/data/PromptDialog.d.ts.map +1 -1
- package/dist/data/PromptDialog.js +17 -50
- package/dist/data/PromptDialog.js.map +1 -1
- package/dist/data/PromptForm.cjs +79 -0
- package/dist/data/PromptForm.cjs.map +1 -0
- package/dist/data/PromptForm.d.ts +26 -0
- package/dist/data/PromptForm.d.ts.map +1 -0
- package/dist/data/PromptForm.js +79 -0
- package/dist/data/PromptForm.js.map +1 -0
- package/dist/data/PromptIndicator.cjs +82 -0
- package/dist/data/PromptIndicator.cjs.map +1 -0
- package/dist/data/PromptIndicator.d.ts +19 -0
- package/dist/data/PromptIndicator.d.ts.map +1 -0
- package/dist/data/PromptIndicator.js +82 -0
- package/dist/data/PromptIndicator.js.map +1 -0
- package/dist/data/PromptList.cjs +67 -0
- package/dist/data/PromptList.cjs.map +1 -0
- package/dist/data/PromptList.d.ts +13 -0
- package/dist/data/PromptList.d.ts.map +1 -0
- package/dist/data/PromptList.js +67 -0
- package/dist/data/PromptList.js.map +1 -0
- package/dist/data/Tree.cjs +17 -9
- package/dist/data/Tree.cjs.map +1 -1
- package/dist/data/Tree.d.ts +5 -1
- package/dist/data/Tree.d.ts.map +1 -1
- package/dist/data/Tree.js +17 -9
- package/dist/data/Tree.js.map +1 -1
- package/dist/data/TreeNode.cjs +32 -9
- package/dist/data/TreeNode.cjs.map +1 -1
- package/dist/data/TreeNode.d.ts +5 -1
- package/dist/data/TreeNode.d.ts.map +1 -1
- package/dist/data/TreeNode.js +32 -9
- package/dist/data/TreeNode.js.map +1 -1
- package/dist/data/ai/RuntimeModePicker.cjs +1 -1
- package/dist/data/ai/RuntimeModePicker.js +1 -1
- package/dist/data/ai/SessionInspector.summary.cjs +1 -1
- package/dist/data/ai/SessionInspector.summary.js +1 -1
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.cjs +1 -1
- package/dist/data/ai/SpecRuntimeEditor/ModelSection.js +1 -1
- package/dist/data/chat/AgentIdentity.cjs +56 -0
- package/dist/data/chat/AgentIdentity.cjs.map +1 -0
- package/dist/data/chat/AgentIdentity.d.ts +17 -0
- package/dist/data/chat/AgentIdentity.d.ts.map +1 -0
- package/dist/data/chat/AgentIdentity.js +55 -0
- package/dist/data/chat/AgentIdentity.js.map +1 -0
- package/dist/data/chat/Chat.cjs +1 -1
- package/dist/data/chat/Chat.js +1 -1
- package/dist/data/chat/ContextMeter.bar.cjs +2 -2
- package/dist/data/chat/ContextMeter.bar.js +2 -2
- package/dist/data/chat/ContextMeter.model.cjs +41 -13
- package/dist/data/chat/ContextMeter.model.cjs.map +1 -1
- package/dist/data/chat/ContextMeter.model.d.ts +2 -0
- package/dist/data/chat/ContextMeter.model.d.ts.map +1 -1
- package/dist/data/chat/ContextMeter.model.js +41 -14
- package/dist/data/chat/ContextMeter.model.js.map +1 -1
- package/dist/data/chat/ModelSelector.cjs +1 -1
- package/dist/data/chat/ModelSelector.js +1 -1
- package/dist/data/chat/agent-identity-context.cjs +5 -0
- package/dist/data/chat/agent-identity-context.cjs.map +1 -0
- package/dist/data/chat/agent-identity-context.d.ts +7 -0
- package/dist/data/chat/agent-identity-context.d.ts.map +1 -0
- package/dist/data/chat/agent-identity-context.js +6 -0
- package/dist/data/chat/agent-identity-context.js.map +1 -0
- package/dist/data/chat/index.d.ts +3 -0
- package/dist/data/chat/index.d.ts.map +1 -1
- package/dist/data/diagnostics/ActionError.cjs +26 -0
- package/dist/data/diagnostics/ActionError.cjs.map +1 -0
- package/dist/data/diagnostics/ActionError.d.ts +10 -0
- package/dist/data/diagnostics/ActionError.d.ts.map +1 -0
- package/dist/data/diagnostics/ActionError.js +26 -0
- package/dist/data/diagnostics/ActionError.js.map +1 -0
- package/dist/data/diagnostics/error-diagnostics.cjs +7 -0
- package/dist/data/diagnostics/error-diagnostics.cjs.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.d.ts.map +1 -1
- package/dist/data/diagnostics/error-diagnostics.js +7 -0
- package/dist/data/diagnostics/error-diagnostics.js.map +1 -1
- package/dist/data/git/GitChangeList.cjs +11 -4
- package/dist/data/git/GitChangeList.cjs.map +1 -1
- package/dist/data/git/GitChangeList.d.ts +2 -35
- package/dist/data/git/GitChangeList.d.ts.map +1 -1
- package/dist/data/git/GitChangeList.js +11 -4
- package/dist/data/git/GitChangeList.js.map +1 -1
- package/dist/data/git/GitLink.cjs +13 -0
- package/dist/data/git/GitLink.cjs.map +1 -0
- package/dist/data/git/GitLink.d.ts +8 -0
- package/dist/data/git/GitLink.d.ts.map +1 -0
- package/dist/data/git/GitLink.js +13 -0
- package/dist/data/git/GitLink.js.map +1 -0
- package/dist/data/git/git-links.cjs +54 -0
- package/dist/data/git/git-links.cjs.map +1 -0
- package/dist/data/git/git-links.d.ts +4 -0
- package/dist/data/git/git-links.d.ts.map +1 -0
- package/dist/data/git/git-links.js +53 -0
- package/dist/data/git/git-links.js.map +1 -0
- package/dist/data/git/index.d.ts +3 -0
- package/dist/data/git/index.d.ts.map +1 -1
- package/dist/data/git/types.d.ts +54 -0
- package/dist/data/git/types.d.ts.map +1 -0
- package/dist/data/markdown-urls.cjs +14 -0
- package/dist/data/markdown-urls.cjs.map +1 -0
- package/dist/data/markdown-urls.d.ts +9 -0
- package/dist/data/markdown-urls.d.ts.map +1 -0
- package/dist/data/markdown-urls.js +14 -0
- package/dist/data/markdown-urls.js.map +1 -0
- package/dist/data/runtime/RuntimeBar.model.cjs +1 -1
- package/dist/data/runtime/RuntimeBar.model.js +1 -1
- package/dist/data/test-runner/MatrixMarks.cjs +4 -3
- package/dist/data/test-runner/MatrixMarks.cjs.map +1 -1
- package/dist/data/test-runner/MatrixMarks.d.ts +7 -4
- package/dist/data/test-runner/MatrixMarks.d.ts.map +1 -1
- package/dist/data/test-runner/MatrixMarks.js +4 -3
- package/dist/data/test-runner/MatrixMarks.js.map +1 -1
- package/dist/data/test-runner/TestRunSummary.cjs +1 -1
- package/dist/data/test-runner/TestRunSummary.cjs.map +1 -1
- package/dist/data/test-runner/TestRunSummary.js +1 -1
- package/dist/data/test-runner/TestRunSummary.js.map +1 -1
- package/dist/data/test-runner/TestTree.cjs +1 -1
- package/dist/data/test-runner/TestTree.cjs.map +1 -1
- package/dist/data/test-runner/TestTree.js +1 -1
- package/dist/data/test-runner/TestTree.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +2 -2
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +2 -2
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/adapter.cjs +7 -0
- package/dist/data/test-runner/adapter.cjs.map +1 -1
- package/dist/data/test-runner/adapter.d.ts +7 -0
- package/dist/data/test-runner/adapter.d.ts.map +1 -1
- package/dist/data/test-runner/adapter.js +7 -0
- package/dist/data/test-runner/adapter.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +1 -1
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/test-runner/marks.cjs +3 -3
- package/dist/data/test-runner/marks.cjs.map +1 -1
- package/dist/data/test-runner/marks.js +3 -3
- package/dist/data/test-runner/marks.js.map +1 -1
- package/dist/data/test-runner/matrix-marks.cjs +12 -3
- package/dist/data/test-runner/matrix-marks.cjs.map +1 -1
- package/dist/data/test-runner/matrix-marks.d.ts +13 -0
- package/dist/data/test-runner/matrix-marks.d.ts.map +1 -1
- package/dist/data/test-runner/matrix-marks.js +12 -3
- package/dist/data/test-runner/matrix-marks.js.map +1 -1
- package/dist/data/test-runner/status.cjs +1 -1
- package/dist/data/test-runner/status.cjs.map +1 -1
- package/dist/data/test-runner/status.js +1 -1
- package/dist/data/test-runner/status.js.map +1 -1
- package/dist/data/test-runner/types.d.ts +2 -0
- package/dist/data/test-runner/types.d.ts.map +1 -1
- package/dist/data/verification/adapterViews.cjs +3 -1
- package/dist/data/verification/adapterViews.cjs.map +1 -1
- package/dist/data/verification/adapterViews.d.ts +5 -2
- package/dist/data/verification/adapterViews.d.ts.map +1 -1
- package/dist/data/verification/adapterViews.js +4 -2
- package/dist/data/verification/adapterViews.js.map +1 -1
- package/dist/data/verification/adapters.cjs +28 -7
- package/dist/data/verification/adapters.cjs.map +1 -1
- package/dist/data/verification/adapters.d.ts +7 -1
- package/dist/data/verification/adapters.d.ts.map +1 -1
- package/dist/data/verification/adapters.js +28 -7
- package/dist/data/verification/adapters.js.map +1 -1
- package/dist/data/verification/stepKind.cjs +1 -0
- package/dist/data/verification/stepKind.cjs.map +1 -1
- package/dist/data/verification/stepKind.d.ts.map +1 -1
- package/dist/data/verification/stepKind.js +1 -0
- package/dist/data/verification/stepKind.js.map +1 -1
- package/dist/data/verification/stepKindViews.cjs +17 -0
- package/dist/data/verification/stepKindViews.cjs.map +1 -1
- package/dist/data/verification/stepKindViews.d.ts +4 -0
- package/dist/data/verification/stepKindViews.d.ts.map +1 -1
- package/dist/data/verification/stepKindViews.js +17 -1
- package/dist/data/verification/stepKindViews.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +124 -0
- package/dist/data.d.ts +5 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +55 -1
- package/dist/file-findings/AnnotatedCode.cjs +44 -3
- package/dist/file-findings/AnnotatedCode.cjs.map +1 -1
- package/dist/file-findings/AnnotatedCode.d.ts +7 -0
- package/dist/file-findings/AnnotatedCode.d.ts.map +1 -1
- package/dist/file-findings/AnnotatedCode.js +44 -3
- package/dist/file-findings/AnnotatedCode.js.map +1 -1
- package/dist/file-findings/FileFindingsView.cjs +188 -82
- package/dist/file-findings/FileFindingsView.cjs.map +1 -1
- package/dist/file-findings/FileFindingsView.d.ts +87 -14
- package/dist/file-findings/FileFindingsView.d.ts.map +1 -1
- package/dist/file-findings/FileFindingsView.js +189 -83
- package/dist/file-findings/FileFindingsView.js.map +1 -1
- package/dist/file-findings/FolderFindings.cjs +144 -0
- package/dist/file-findings/FolderFindings.cjs.map +1 -0
- package/dist/file-findings/FolderFindings.d.ts +39 -0
- package/dist/file-findings/FolderFindings.d.ts.map +1 -0
- package/dist/file-findings/FolderFindings.js +144 -0
- package/dist/file-findings/FolderFindings.js.map +1 -0
- package/dist/file-findings/NodeActions.cjs +50 -0
- package/dist/file-findings/NodeActions.cjs.map +1 -0
- package/dist/file-findings/NodeActions.d.ts +15 -0
- package/dist/file-findings/NodeActions.d.ts.map +1 -0
- package/dist/file-findings/NodeActions.js +50 -0
- package/dist/file-findings/NodeActions.js.map +1 -0
- package/dist/file-findings/SeverityCounts.cjs +22 -0
- package/dist/file-findings/SeverityCounts.cjs.map +1 -0
- package/dist/file-findings/SeverityCounts.d.ts +6 -0
- package/dist/file-findings/SeverityCounts.d.ts.map +1 -0
- package/dist/file-findings/SeverityCounts.js +22 -0
- package/dist/file-findings/SeverityCounts.js.map +1 -0
- package/dist/file-findings/adapters.cjs +43 -16
- package/dist/file-findings/adapters.cjs.map +1 -1
- package/dist/file-findings/adapters.d.ts +8 -7
- package/dist/file-findings/adapters.d.ts.map +1 -1
- package/dist/file-findings/adapters.js +43 -16
- package/dist/file-findings/adapters.js.map +1 -1
- package/dist/file-findings/file-review/CommentDraft.cjs +10 -43
- package/dist/file-findings/file-review/CommentDraft.cjs.map +1 -1
- package/dist/file-findings/file-review/CommentDraft.d.ts +4 -2
- package/dist/file-findings/file-review/CommentDraft.d.ts.map +1 -1
- package/dist/file-findings/file-review/CommentDraft.js +11 -44
- package/dist/file-findings/file-review/CommentDraft.js.map +1 -1
- package/dist/file-findings/file-review/EditThreads.cjs +85 -0
- package/dist/file-findings/file-review/EditThreads.cjs.map +1 -0
- package/dist/file-findings/file-review/EditThreads.d.ts +40 -0
- package/dist/file-findings/file-review/EditThreads.d.ts.map +1 -0
- package/dist/file-findings/file-review/EditThreads.js +85 -0
- package/dist/file-findings/file-review/EditThreads.js.map +1 -0
- package/dist/file-findings/file-review/FileReview.cjs +559 -54
- package/dist/file-findings/file-review/FileReview.cjs.map +1 -1
- package/dist/file-findings/file-review/FileReview.d.ts +67 -9
- package/dist/file-findings/file-review/FileReview.d.ts.map +1 -1
- package/dist/file-findings/file-review/FileReview.js +562 -57
- package/dist/file-findings/file-review/FileReview.js.map +1 -1
- package/dist/file-findings/file-review/FileThreads.cjs +96 -0
- package/dist/file-findings/file-review/FileThreads.cjs.map +1 -0
- package/dist/file-findings/file-review/FileThreads.d.ts +50 -0
- package/dist/file-findings/file-review/FileThreads.d.ts.map +1 -0
- package/dist/file-findings/file-review/FileThreads.js +94 -0
- package/dist/file-findings/file-review/FileThreads.js.map +1 -0
- package/dist/file-findings/file-review/InlineThread.cjs +2 -1
- package/dist/file-findings/file-review/InlineThread.cjs.map +1 -1
- package/dist/file-findings/file-review/InlineThread.d.ts +9 -2
- package/dist/file-findings/file-review/InlineThread.d.ts.map +1 -1
- package/dist/file-findings/file-review/InlineThread.js +2 -1
- package/dist/file-findings/file-review/InlineThread.js.map +1 -1
- package/dist/file-findings/file-review/ProblemsList.cjs +67 -56
- package/dist/file-findings/file-review/ProblemsList.cjs.map +1 -1
- package/dist/file-findings/file-review/ProblemsList.d.ts +7 -0
- package/dist/file-findings/file-review/ProblemsList.d.ts.map +1 -1
- package/dist/file-findings/file-review/ProblemsList.js +68 -58
- package/dist/file-findings/file-review/ProblemsList.js.map +1 -1
- package/dist/file-findings/file-review/SourceView.cjs +2 -1
- package/dist/file-findings/file-review/SourceView.cjs.map +1 -1
- package/dist/file-findings/file-review/SourceView.js +3 -2
- package/dist/file-findings/file-review/SourceView.js.map +1 -1
- package/dist/file-findings/file-review/geometry.cjs +36 -7
- package/dist/file-findings/file-review/geometry.cjs.map +1 -1
- package/dist/file-findings/file-review/geometry.d.ts +9 -3
- package/dist/file-findings/file-review/geometry.d.ts.map +1 -1
- package/dist/file-findings/file-review/geometry.js +36 -7
- package/dist/file-findings/file-review/geometry.js.map +1 -1
- package/dist/file-findings/file-review/hooks.cjs +36 -3
- package/dist/file-findings/file-review/hooks.cjs.map +1 -1
- package/dist/file-findings/file-review/hooks.d.ts +15 -1
- package/dist/file-findings/file-review/hooks.d.ts.map +1 -1
- package/dist/file-findings/file-review/hooks.js +37 -5
- package/dist/file-findings/file-review/hooks.js.map +1 -1
- package/dist/file-findings/file-review/patch-comments.cjs +65 -0
- package/dist/file-findings/file-review/patch-comments.cjs.map +1 -0
- package/dist/file-findings/file-review/patch-comments.d.ts +29 -0
- package/dist/file-findings/file-review/patch-comments.d.ts.map +1 -0
- package/dist/file-findings/file-review/patch-comments.js +60 -0
- package/dist/file-findings/file-review/patch-comments.js.map +1 -0
- package/dist/file-findings/file-review/post-actions.cjs +33 -0
- package/dist/file-findings/file-review/post-actions.cjs.map +1 -0
- package/dist/file-findings/file-review/post-actions.d.ts +20 -0
- package/dist/file-findings/file-review/post-actions.d.ts.map +1 -0
- package/dist/file-findings/file-review/post-actions.js +30 -0
- package/dist/file-findings/file-review/post-actions.js.map +1 -0
- package/dist/file-findings/file-review/problem-filters.cjs +6 -0
- package/dist/file-findings/file-review/problem-filters.cjs.map +1 -1
- package/dist/file-findings/file-review/problem-filters.d.ts +2 -0
- package/dist/file-findings/file-review/problem-filters.d.ts.map +1 -1
- package/dist/file-findings/file-review/problem-filters.js +6 -1
- package/dist/file-findings/file-review/problem-filters.js.map +1 -1
- package/dist/file-findings/file-review/selection-lines.cjs +47 -0
- package/dist/file-findings/file-review/selection-lines.cjs.map +1 -0
- package/dist/file-findings/file-review/selection-lines.d.ts +19 -0
- package/dist/file-findings/file-review/selection-lines.d.ts.map +1 -0
- package/dist/file-findings/file-review/selection-lines.js +46 -0
- package/dist/file-findings/file-review/selection-lines.js.map +1 -0
- package/dist/file-findings/file-review/views.cjs +16 -0
- package/dist/file-findings/file-review/views.cjs.map +1 -0
- package/dist/file-findings/file-review/views.d.ts +8 -0
- package/dist/file-findings/file-review/views.d.ts.map +1 -0
- package/dist/file-findings/file-review/views.js +14 -0
- package/dist/file-findings/file-review/views.js.map +1 -0
- package/dist/file-findings/file-urls.cjs +60 -0
- package/dist/file-findings/file-urls.cjs.map +1 -0
- package/dist/file-findings/file-urls.d.ts +20 -0
- package/dist/file-findings/file-urls.d.ts.map +1 -0
- package/dist/file-findings/file-urls.js +57 -0
- package/dist/file-findings/file-urls.js.map +1 -0
- package/dist/file-findings/types.cjs +5 -0
- package/dist/file-findings/types.cjs.map +1 -1
- package/dist/file-findings/types.d.ts +8 -2
- package/dist/file-findings/types.d.ts.map +1 -1
- package/dist/file-findings/types.js +5 -1
- package/dist/file-findings/types.js.map +1 -1
- package/dist/file-findings.cjs +24 -0
- package/dist/file-findings.d.ts +9 -4
- package/dist/file-findings.d.ts.map +1 -1
- package/dist/file-findings.js +8 -3
- package/dist/git.cjs +6 -0
- package/dist/git.d.ts +4 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +3 -0
- package/dist/hooks/use-prompts.cjs +18 -11
- package/dist/hooks/use-prompts.cjs.map +1 -1
- package/dist/hooks/use-prompts.d.ts.map +1 -1
- package/dist/hooks/use-prompts.js +18 -11
- package/dist/hooks/use-prompts.js.map +1 -1
- package/dist/icons/components/UiApi.cjs +37 -0
- package/dist/icons/components/UiApi.cjs.map +1 -0
- package/dist/icons/components/UiApi.d.ts +9 -0
- package/dist/icons/components/UiApi.d.ts.map +1 -0
- package/dist/icons/components/UiApi.js +35 -0
- package/dist/icons/components/UiApi.js.map +1 -0
- package/dist/icons/components/UiApiBridge.cjs +38 -0
- package/dist/icons/components/UiApiBridge.cjs.map +1 -0
- package/dist/icons/components/UiApiBridge.d.ts +9 -0
- package/dist/icons/components/UiApiBridge.d.ts.map +1 -0
- package/dist/icons/components/UiApiBridge.js +36 -0
- package/dist/icons/components/UiApiBridge.js.map +1 -0
- package/dist/icons/components/UiApiGateway.cjs +33 -0
- package/dist/icons/components/UiApiGateway.cjs.map +1 -0
- package/dist/icons/components/UiApiGateway.d.ts +9 -0
- package/dist/icons/components/UiApiGateway.d.ts.map +1 -0
- package/dist/icons/components/UiApiGateway.js +31 -0
- package/dist/icons/components/UiApiGateway.js.map +1 -0
- package/dist/icons/components/UiApiRequest.cjs +37 -0
- package/dist/icons/components/UiApiRequest.cjs.map +1 -0
- package/dist/icons/components/UiApiRequest.d.ts +9 -0
- package/dist/icons/components/UiApiRequest.d.ts.map +1 -0
- package/dist/icons/components/UiApiRequest.js +35 -0
- package/dist/icons/components/UiApiRequest.js.map +1 -0
- package/dist/icons/components/UiArrowDecision.cjs +51 -0
- package/dist/icons/components/UiArrowDecision.cjs.map +1 -0
- package/dist/icons/components/UiArrowDecision.d.ts +15 -0
- package/dist/icons/components/UiArrowDecision.d.ts.map +1 -0
- package/dist/icons/components/UiArrowDecision.js +48 -0
- package/dist/icons/components/UiArrowDecision.js.map +1 -0
- package/dist/icons/components/UiArrowSquareIn.cjs +51 -0
- package/dist/icons/components/UiArrowSquareIn.cjs.map +1 -0
- package/dist/icons/components/UiArrowSquareIn.d.ts +15 -0
- package/dist/icons/components/UiArrowSquareIn.d.ts.map +1 -0
- package/dist/icons/components/UiArrowSquareIn.js +48 -0
- package/dist/icons/components/UiArrowSquareIn.js.map +1 -0
- package/dist/icons/components/UiBatchCheck.cjs +55 -0
- package/dist/icons/components/UiBatchCheck.cjs.map +1 -0
- package/dist/icons/components/UiBatchCheck.d.ts +15 -0
- package/dist/icons/components/UiBatchCheck.d.ts.map +1 -0
- package/dist/icons/components/UiBatchCheck.js +52 -0
- package/dist/icons/components/UiBatchCheck.js.map +1 -0
- package/dist/icons/components/UiBatchJob.cjs +39 -0
- package/dist/icons/components/UiBatchJob.cjs.map +1 -0
- package/dist/icons/components/UiBatchJob.d.ts +9 -0
- package/dist/icons/components/UiBatchJob.d.ts.map +1 -0
- package/dist/icons/components/UiBatchJob.js +37 -0
- package/dist/icons/components/UiBatchJob.js.map +1 -0
- package/dist/icons/components/UiBatchRequest.cjs +39 -0
- package/dist/icons/components/UiBatchRequest.cjs.map +1 -0
- package/dist/icons/components/UiBatchRequest.d.ts +9 -0
- package/dist/icons/components/UiBatchRequest.d.ts.map +1 -0
- package/dist/icons/components/UiBatchRequest.js +37 -0
- package/dist/icons/components/UiBatchRequest.js.map +1 -0
- package/dist/icons/components/UiBpmnConditional.cjs +29 -0
- package/dist/icons/components/UiBpmnConditional.cjs.map +1 -0
- package/dist/icons/components/UiBpmnConditional.d.ts +9 -0
- package/dist/icons/components/UiBpmnConditional.d.ts.map +1 -0
- package/dist/icons/components/UiBpmnConditional.js +27 -0
- package/dist/icons/components/UiBpmnConditional.js.map +1 -0
- package/dist/icons/components/UiBranchFlow.cjs +33 -0
- package/dist/icons/components/UiBranchFlow.cjs.map +1 -0
- package/dist/icons/components/UiBranchFlow.d.ts +9 -0
- package/dist/icons/components/UiBranchFlow.d.ts.map +1 -0
- package/dist/icons/components/UiBranchFlow.js +31 -0
- package/dist/icons/components/UiBranchFlow.js.map +1 -0
- package/dist/icons/components/UiChecks.cjs +51 -0
- package/dist/icons/components/UiChecks.cjs.map +1 -0
- package/dist/icons/components/UiChecks.d.ts +15 -0
- package/dist/icons/components/UiChecks.d.ts.map +1 -0
- package/dist/icons/components/UiChecks.js +48 -0
- package/dist/icons/components/UiChecks.js.map +1 -0
- package/dist/icons/components/UiClassicBatch.cjs +29 -0
- package/dist/icons/components/UiClassicBatch.cjs.map +1 -0
- package/dist/icons/components/UiClassicBatch.d.ts +9 -0
- package/dist/icons/components/UiClassicBatch.d.ts.map +1 -0
- package/dist/icons/components/UiClassicBatch.js +27 -0
- package/dist/icons/components/UiClassicBatch.js.map +1 -0
- package/dist/icons/components/UiCodeFile.cjs +29 -0
- package/dist/icons/components/UiCodeFile.cjs.map +1 -0
- package/dist/icons/components/UiCodeFile.d.ts +9 -0
- package/dist/icons/components/UiCodeFile.d.ts.map +1 -0
- package/dist/icons/components/UiCodeFile.js +27 -0
- package/dist/icons/components/UiCodeFile.js.map +1 -0
- package/dist/icons/components/UiColumnsLayout.cjs +29 -0
- package/dist/icons/components/UiColumnsLayout.cjs.map +1 -0
- package/dist/icons/components/UiColumnsLayout.d.ts +9 -0
- package/dist/icons/components/UiColumnsLayout.d.ts.map +1 -0
- package/dist/icons/components/UiColumnsLayout.js +27 -0
- package/dist/icons/components/UiColumnsLayout.js.map +1 -0
- package/dist/icons/components/UiCondition.cjs +37 -0
- package/dist/icons/components/UiCondition.cjs.map +1 -0
- package/dist/icons/components/UiCondition.d.ts +9 -0
- package/dist/icons/components/UiCondition.d.ts.map +1 -0
- package/dist/icons/components/UiCondition.js +35 -0
- package/dist/icons/components/UiCondition.js.map +1 -0
- package/dist/icons/components/UiConditions.cjs +29 -0
- package/dist/icons/components/UiConditions.cjs.map +1 -0
- package/dist/icons/components/UiConditions.d.ts +9 -0
- package/dist/icons/components/UiConditions.d.ts.map +1 -0
- package/dist/icons/components/UiConditions.js +27 -0
- package/dist/icons/components/UiConditions.js.map +1 -0
- package/dist/icons/components/UiDelayQueue.cjs +40 -0
- package/dist/icons/components/UiDelayQueue.cjs.map +1 -0
- package/dist/icons/components/UiDelayQueue.d.ts +9 -0
- package/dist/icons/components/UiDelayQueue.d.ts.map +1 -0
- package/dist/icons/components/UiDelayQueue.js +38 -0
- package/dist/icons/components/UiDelayQueue.js.map +1 -0
- package/dist/icons/components/UiDynamicForm.cjs +51 -0
- package/dist/icons/components/UiDynamicForm.cjs.map +1 -0
- package/dist/icons/components/UiDynamicForm.d.ts +15 -0
- package/dist/icons/components/UiDynamicForm.d.ts.map +1 -0
- package/dist/icons/components/UiDynamicForm.js +48 -0
- package/dist/icons/components/UiDynamicForm.js.map +1 -0
- package/dist/icons/components/UiFlowArrow.cjs +51 -0
- package/dist/icons/components/UiFlowArrow.cjs.map +1 -0
- package/dist/icons/components/UiFlowArrow.d.ts +15 -0
- package/dist/icons/components/UiFlowArrow.d.ts.map +1 -0
- package/dist/icons/components/UiFlowArrow.js +48 -0
- package/dist/icons/components/UiFlowArrow.js.map +1 -0
- package/dist/icons/components/UiFormFields.cjs +33 -0
- package/dist/icons/components/UiFormFields.cjs.map +1 -0
- package/dist/icons/components/UiFormFields.d.ts +9 -0
- package/dist/icons/components/UiFormFields.d.ts.map +1 -0
- package/dist/icons/components/UiFormFields.js +31 -0
- package/dist/icons/components/UiFormFields.js.map +1 -0
- package/dist/icons/components/UiFormStep.cjs +38 -0
- package/dist/icons/components/UiFormStep.cjs.map +1 -0
- package/dist/icons/components/UiFormStep.d.ts +9 -0
- package/dist/icons/components/UiFormStep.d.ts.map +1 -0
- package/dist/icons/components/UiFormStep.js +36 -0
- package/dist/icons/components/UiFormStep.js.map +1 -0
- package/dist/icons/components/UiGatewayApi.cjs +32 -0
- package/dist/icons/components/UiGatewayApi.cjs.map +1 -0
- package/dist/icons/components/UiGatewayApi.d.ts +9 -0
- package/dist/icons/components/UiGatewayApi.d.ts.map +1 -0
- package/dist/icons/components/UiGatewayApi.js +30 -0
- package/dist/icons/components/UiGatewayApi.js.map +1 -0
- package/dist/icons/components/UiImportArrow.cjs +29 -0
- package/dist/icons/components/UiImportArrow.cjs.map +1 -0
- package/dist/icons/components/UiImportArrow.d.ts +9 -0
- package/dist/icons/components/UiImportArrow.d.ts.map +1 -0
- package/dist/icons/components/UiImportArrow.js +27 -0
- package/dist/icons/components/UiImportArrow.js.map +1 -0
- package/dist/icons/components/UiInputField.cjs +33 -0
- package/dist/icons/components/UiInputField.cjs.map +1 -0
- package/dist/icons/components/UiInputField.d.ts +9 -0
- package/dist/icons/components/UiInputField.d.ts.map +1 -0
- package/dist/icons/components/UiInputField.js +31 -0
- package/dist/icons/components/UiInputField.js.map +1 -0
- package/dist/icons/components/UiInsertTable.cjs +29 -0
- package/dist/icons/components/UiInsertTable.cjs.map +1 -0
- package/dist/icons/components/UiInsertTable.d.ts +9 -0
- package/dist/icons/components/UiInsertTable.d.ts.map +1 -0
- package/dist/icons/components/UiInsertTable.js +27 -0
- package/dist/icons/components/UiInsertTable.js.map +1 -0
- package/dist/icons/components/UiLayoutTemplate.cjs +32 -0
- package/dist/icons/components/UiLayoutTemplate.cjs.map +1 -0
- package/dist/icons/components/UiLayoutTemplate.d.ts +9 -0
- package/dist/icons/components/UiLayoutTemplate.d.ts.map +1 -0
- package/dist/icons/components/UiLayoutTemplate.js +30 -0
- package/dist/icons/components/UiLayoutTemplate.js.map +1 -0
- package/dist/icons/components/UiLayoutWindow.cjs +56 -0
- package/dist/icons/components/UiLayoutWindow.cjs.map +1 -0
- package/dist/icons/components/UiLayoutWindow.d.ts +15 -0
- package/dist/icons/components/UiLayoutWindow.d.ts.map +1 -0
- package/dist/icons/components/UiLayoutWindow.js +53 -0
- package/dist/icons/components/UiLayoutWindow.js.map +1 -0
- package/dist/icons/components/UiListEnd.cjs +33 -0
- package/dist/icons/components/UiListEnd.cjs.map +1 -0
- package/dist/icons/components/UiListEnd.d.ts +9 -0
- package/dist/icons/components/UiListEnd.d.ts.map +1 -0
- package/dist/icons/components/UiListEnd.js +31 -0
- package/dist/icons/components/UiListEnd.js.map +1 -0
- package/dist/icons/components/UiListEndLine.cjs +51 -0
- package/dist/icons/components/UiListEndLine.cjs.map +1 -0
- package/dist/icons/components/UiListEndLine.d.ts +15 -0
- package/dist/icons/components/UiListEndLine.d.ts.map +1 -0
- package/dist/icons/components/UiListEndLine.js +48 -0
- package/dist/icons/components/UiListEndLine.js.map +1 -0
- package/dist/icons/components/UiListNumbers.cjs +51 -0
- package/dist/icons/components/UiListNumbers.cjs.map +1 -0
- package/dist/icons/components/UiListNumbers.d.ts +15 -0
- package/dist/icons/components/UiListNumbers.d.ts.map +1 -0
- package/dist/icons/components/UiListNumbers.js +48 -0
- package/dist/icons/components/UiListNumbers.js.map +1 -0
- package/dist/icons/components/UiLowPriority.cjs +29 -0
- package/dist/icons/components/UiLowPriority.cjs.map +1 -0
- package/dist/icons/components/UiLowPriority.d.ts +9 -0
- package/dist/icons/components/UiLowPriority.d.ts.map +1 -0
- package/dist/icons/components/UiLowPriority.js +27 -0
- package/dist/icons/components/UiLowPriority.js.map +1 -0
- package/dist/icons/components/UiMergeQueue.cjs +38 -0
- package/dist/icons/components/UiMergeQueue.cjs.map +1 -0
- package/dist/icons/components/UiMergeQueue.d.ts +9 -0
- package/dist/icons/components/UiMergeQueue.d.ts.map +1 -0
- package/dist/icons/components/UiMergeQueue.js +36 -0
- package/dist/icons/components/UiMergeQueue.js.map +1 -0
- package/dist/icons/components/UiPaperPlaneRight.cjs +51 -0
- package/dist/icons/components/UiPaperPlaneRight.cjs.map +1 -0
- package/dist/icons/components/UiPaperPlaneRight.d.ts +15 -0
- package/dist/icons/components/UiPaperPlaneRight.d.ts.map +1 -0
- package/dist/icons/components/UiPaperPlaneRight.js +48 -0
- package/dist/icons/components/UiPaperPlaneRight.js.map +1 -0
- package/dist/icons/components/UiPipelineStage.cjs +33 -0
- package/dist/icons/components/UiPipelineStage.cjs.map +1 -0
- package/dist/icons/components/UiPipelineStage.d.ts +9 -0
- package/dist/icons/components/UiPipelineStage.d.ts.map +1 -0
- package/dist/icons/components/UiPipelineStage.js +31 -0
- package/dist/icons/components/UiPipelineStage.js.map +1 -0
- package/dist/icons/components/UiPlaylistRemove.cjs +29 -0
- package/dist/icons/components/UiPlaylistRemove.cjs.map +1 -0
- package/dist/icons/components/UiPlaylistRemove.d.ts +9 -0
- package/dist/icons/components/UiPlaylistRemove.d.ts.map +1 -0
- package/dist/icons/components/UiPlaylistRemove.js +27 -0
- package/dist/icons/components/UiPlaylistRemove.js.map +1 -0
- package/dist/icons/components/UiReportForms.cjs +51 -0
- package/dist/icons/components/UiReportForms.cjs.map +1 -0
- package/dist/icons/components/UiReportForms.d.ts +15 -0
- package/dist/icons/components/UiReportForms.d.ts.map +1 -0
- package/dist/icons/components/UiReportForms.js +48 -0
- package/dist/icons/components/UiReportForms.js.map +1 -0
- package/dist/icons/components/UiScreenTemplate.cjs +29 -0
- package/dist/icons/components/UiScreenTemplate.cjs.map +1 -0
- package/dist/icons/components/UiScreenTemplate.d.ts +9 -0
- package/dist/icons/components/UiScreenTemplate.d.ts.map +1 -0
- package/dist/icons/components/UiScreenTemplate.js +27 -0
- package/dist/icons/components/UiScreenTemplate.js.map +1 -0
- package/dist/icons/components/UiServices.cjs +29 -0
- package/dist/icons/components/UiServices.cjs.map +1 -0
- package/dist/icons/components/UiServices.d.ts +9 -0
- package/dist/icons/components/UiServices.d.ts.map +1 -0
- package/dist/icons/components/UiServices.js +27 -0
- package/dist/icons/components/UiServices.js.map +1 -0
- package/dist/icons/components/UiSkipCircle.cjs +51 -0
- package/dist/icons/components/UiSkipCircle.cjs.map +1 -0
- package/dist/icons/components/UiSkipCircle.d.ts +15 -0
- package/dist/icons/components/UiSkipCircle.d.ts.map +1 -0
- package/dist/icons/components/UiSkipCircle.js +48 -0
- package/dist/icons/components/UiSkipCircle.js.map +1 -0
- package/dist/icons/components/UiTaskBatch.cjs +33 -0
- package/dist/icons/components/UiTaskBatch.cjs.map +1 -0
- package/dist/icons/components/UiTaskBatch.d.ts +9 -0
- package/dist/icons/components/UiTaskBatch.d.ts.map +1 -0
- package/dist/icons/components/UiTaskBatch.js +31 -0
- package/dist/icons/components/UiTaskBatch.js.map +1 -0
- package/dist/icons/components/UiTodoList.cjs +29 -0
- package/dist/icons/components/UiTodoList.cjs.map +1 -0
- package/dist/icons/components/UiTodoList.d.ts +9 -0
- package/dist/icons/components/UiTodoList.d.ts.map +1 -0
- package/dist/icons/components/UiTodoList.js +27 -0
- package/dist/icons/components/UiTodoList.js.map +1 -0
- package/dist/icons/components/UiTrayArrowDown.cjs +51 -0
- package/dist/icons/components/UiTrayArrowDown.cjs.map +1 -0
- package/dist/icons/components/UiTrayArrowDown.d.ts +15 -0
- package/dist/icons/components/UiTrayArrowDown.d.ts.map +1 -0
- package/dist/icons/components/UiTrayArrowDown.js +48 -0
- package/dist/icons/components/UiTrayArrowDown.js.map +1 -0
- package/dist/icons/components/UiVault.cjs +51 -0
- package/dist/icons/components/UiVault.cjs.map +1 -0
- package/dist/icons/components/UiVault.d.ts +15 -0
- package/dist/icons/components/UiVault.d.ts.map +1 -0
- package/dist/icons/components/UiVault.js +48 -0
- package/dist/icons/components/UiVault.js.map +1 -0
- package/dist/icons/components/UiWebServiceDefinition.cjs +39 -0
- package/dist/icons/components/UiWebServiceDefinition.cjs.map +1 -0
- package/dist/icons/components/UiWebServiceDefinition.d.ts +9 -0
- package/dist/icons/components/UiWebServiceDefinition.d.ts.map +1 -0
- package/dist/icons/components/UiWebServiceDefinition.js +37 -0
- package/dist/icons/components/UiWebServiceDefinition.js.map +1 -0
- package/dist/icons/components/UiWebhook.cjs +29 -0
- package/dist/icons/components/UiWebhook.cjs.map +1 -0
- package/dist/icons/components/UiWebhook.d.ts +9 -0
- package/dist/icons/components/UiWebhook.d.ts.map +1 -0
- package/dist/icons/components/UiWebhook.js +27 -0
- package/dist/icons/components/UiWebhook.js.map +1 -0
- package/dist/icons/components/UiWebhookLine.cjs +51 -0
- package/dist/icons/components/UiWebhookLine.cjs.map +1 -0
- package/dist/icons/components/UiWebhookLine.d.ts +15 -0
- package/dist/icons/components/UiWebhookLine.d.ts.map +1 -0
- package/dist/icons/components/UiWebhookLine.js +48 -0
- package/dist/icons/components/UiWebhookLine.js.map +1 -0
- package/dist/icons/index.d.ts +62 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/icons/registry.cjs +94 -0
- package/dist/icons/registry.cjs.map +1 -1
- package/dist/icons/registry.d.ts.map +1 -1
- package/dist/icons/registry.js +94 -0
- package/dist/icons/registry.js.map +1 -1
- package/dist/icons.cjs +109 -0
- package/dist/icons.js +48 -1
- package/dist/index.cjs +213 -6
- package/dist/index.js +81 -7
- package/dist/layout/ResizeHandle.cjs +58 -0
- package/dist/layout/ResizeHandle.cjs.map +1 -0
- package/dist/layout/ResizeHandle.d.ts +13 -0
- package/dist/layout/ResizeHandle.d.ts.map +1 -0
- package/dist/layout/ResizeHandle.js +58 -0
- package/dist/layout/ResizeHandle.js.map +1 -0
- package/dist/monaco/DocumentEditor.cjs +275 -0
- package/dist/monaco/DocumentEditor.cjs.map +1 -0
- package/dist/monaco/DocumentEditor.d.ts +60 -0
- package/dist/monaco/DocumentEditor.d.ts.map +1 -0
- package/dist/monaco/DocumentEditor.js +273 -0
- package/dist/monaco/DocumentEditor.js.map +1 -0
- package/dist/monaco/document-source.cjs +122 -0
- package/dist/monaco/document-source.cjs.map +1 -0
- package/dist/monaco/document-source.d.ts +19 -0
- package/dist/monaco/document-source.d.ts.map +1 -0
- package/dist/monaco/document-source.js +120 -0
- package/dist/monaco/document-source.js.map +1 -0
- package/dist/monaco/source-comments.cjs +34 -0
- package/dist/monaco/source-comments.cjs.map +1 -0
- package/dist/monaco/source-comments.d.ts +19 -0
- package/dist/monaco/source-comments.d.ts.map +1 -0
- package/dist/monaco/source-comments.js +34 -0
- package/dist/monaco/source-comments.js.map +1 -0
- package/dist/monaco.cjs +6 -0
- package/dist/monaco.d.ts +2 -0
- package/dist/monaco.d.ts.map +1 -1
- package/dist/monaco.js +3 -1
- package/dist/overlay/DropdownMenu.cjs +17 -14
- package/dist/overlay/DropdownMenu.cjs.map +1 -1
- package/dist/overlay/DropdownMenu.d.ts +1 -0
- package/dist/overlay/DropdownMenu.d.ts.map +1 -1
- package/dist/overlay/DropdownMenu.js +18 -15
- package/dist/overlay/DropdownMenu.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +11 -1
package/dist/data/Tree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.js","names":["_Fragment"],"sources":["../../src/data/Tree.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiClose, UiCollapseAll, UiExpandAll, UiSearch } from \"../icons\";\nimport { TreeNode, type TreeKey, type TreeNodeProps } from \"./TreeNode\";\n\nexport type TreeProps<T> = Omit<\n TreeNodeProps<T>,\n \"node\" | \"depth\" | \"expandAll\" | \"forcedOpenKeys\" | \"revealPath\" | \"revealOverrides\" | \"onRevealToggle\"\n> & {\n /** Root nodes to render. */\n roots: T[];\n /** Empty-state content when no roots are provided. */\n empty?: ReactNode;\n /** Classes applied to the tree root. */\n className?: string;\n /** Accessible name applied to the tree root. */\n ariaLabel?: string;\n /**\n * Render the Expand all / Collapse all toolbar above the tree. Enabled by\n * default. Set to false to suppress when the tree is tiny or the controls\n * are owned externally.\n */\n showControls?: boolean;\n /** Keep search visible for small or empty trees. */\n showSearch?: boolean;\n /** Placeholder and accessible name of the search box, e.g. \"Filter tests\". */\n searchLabel?: string;\n /** URL or parent-controlled search query. */\n searchQuery?: string;\n onSearchQueryChange?: (query: string) => void;\n /**\n * Externally controlled expand-all state. When provided together with\n * `onExpandAllChange`, the tree is controlled; otherwise it manages the\n * toolbar state internally.\n */\n expandAll?: boolean | null;\n /** Called when the toolbar expand-all state changes. */\n onExpandAllChange?: (next: boolean | null) => void;\n /** Classes applied to the search/control toolbar. */\n toolbarClassName?: string;\n /**\n * Extra controls rendered in the toolbar's right-hand group, before Expand\n * all / Collapse all. Providing actions shows the toolbar even when the tree\n * is too small for the filter and `showControls` is off.\n */\n actions?: ReactNode;\n /**\n * Override the text the filter matches against for a given node.\n * Defaults to a recursive walk of the node's own fields (excluding\n * its `children` and any secondary children), which works for\n * plain-shape trees but leaks text from nested domain objects —\n * e.g. a SQL Table's Field rows are marked secondary, yet the\n * parent record still carries `record.fields[].field` strings that\n * the default walker would collect. Callers that need precise\n * control over search behaviour should return only the text they\n * want surfaced (the node's own display label / id / type).\n */\n getSearchText?: (node: T) => string;\n /**\n * Reveal only the path to `selected` when it changes from outside the tree\n * (initial mount or navigation). Ancestors initially show the next path node;\n * manual expansion and collapse then take precedence until the next external\n * selection. Selecting a row by clicking it never re-reveals. Off by default.\n */\n revealSelected?: boolean;\n};\n\nfunction selectionPath<T>(\n roots: T[],\n getChildren: TreeProps<T>[\"getChildren\"],\n getKey: TreeProps<T>[\"getKey\"],\n targetKey: TreeKey,\n): Map<TreeKey, TreeKey | null> | null {\n const path = new Map<TreeKey, TreeKey | null>();\n const visit = (node: T): boolean => {\n if (getKey(node) === targetKey) {\n path.set(targetKey, null);\n return true;\n }\n for (const child of getChildren(node) ?? []) {\n if (visit(child)) {\n path.set(getKey(node), getKey(child));\n return true;\n }\n }\n return false;\n };\n for (const root of roots) {\n if (visit(root)) return path;\n }\n return null;\n}\n\n// Edge counting, search-text collection and filtering all walk the tree through\n// the synchronous `getChildren` only. A lazy node (one declared via\n// `hasMoreChildren` whose children have not been fetched yet) therefore\n// contributes no edges and no search text until the operator expands it — so it\n// is invisible to \"expand all\" and to the filter while still collapsed. This is\n// intentional: we never trigger network loads from bulk/search operations.\nfunction countTreeEdges<T>(roots: T[], getChildren: TreeProps<T>[\"getChildren\"]) {\n let total = 0;\n const stack = [...roots];\n\n while (stack.length > 0) {\n const node = stack.pop()!;\n const children = getChildren(node) ?? [];\n total += children.length;\n stack.push(...children);\n }\n\n return total;\n}\n\nfunction collectTreeSearchText(\n value: unknown,\n excluded = new Set<unknown>(),\n seen = new Set<unknown>(),\n): string {\n if (value == null || excluded.has(value)) return \"\";\n\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n typeof value === \"bigint\"\n ) {\n return String(value);\n }\n\n if (typeof value !== \"object\") return \"\";\n if (seen.has(value)) return \"\";\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value\n .map((entry) => collectTreeSearchText(entry, excluded, seen))\n .filter(Boolean)\n .join(\" \");\n }\n\n const preferredKeys = [\"label\", \"name\", \"title\", \"text\", \"plain\", \"id\", \"content\"];\n const record = value as Record<string, unknown>;\n const chunks: string[] = [];\n\n for (const key of preferredKeys) {\n if (!(key in record)) continue;\n const text = collectTreeSearchText(record[key], excluded, seen);\n if (text) chunks.push(text);\n }\n\n for (const [key, entry] of Object.entries(record)) {\n if (key === \"children\" || preferredKeys.includes(key)) continue;\n const text = collectTreeSearchText(entry, excluded, seen);\n if (text) chunks.push(text);\n }\n\n return chunks.join(\" \");\n}\n\nfunction nodeSearchText<T>(node: T, children: ReturnType<TreeProps<T>[\"getChildren\"]>) {\n const excluded = new Set<unknown>();\n if (children) excluded.add(children);\n return collectTreeSearchText(node, excluded).trim().toLowerCase();\n}\n\nfunction filterTreeRoots<T>(\n roots: T[],\n getChildren: TreeProps<T>[\"getChildren\"],\n getKey: TreeProps<T>[\"getKey\"],\n query: string,\n isSecondary?: (node: T) => boolean,\n getSearchText?: (node: T) => string,\n) {\n const normalizedQuery = query.trim().toLowerCase();\n if (!normalizedQuery) {\n return {\n roots,\n filteredChildren: null as Map<string | number, T[]> | null,\n forcedOpenKeys: null as Set<string | number> | null,\n };\n }\n\n const filteredChildren = new Map<string | number, T[]>();\n const forcedOpenKeys = new Set<string | number>();\n\n function matchText(node: T, children: T[]): string {\n // Honour the caller-supplied text extractor first — it's the\n // only way to get precise control over what the filter sees when\n // the node carries domain data whose fields would otherwise leak\n // into the default walker.\n if (getSearchText) return getSearchText(node).trim().toLowerCase();\n // Match-text skips secondary children so e.g. a Table's search\n // text only draws from the Table itself, not from its Field\n // rows. The Table is primary, so its own text still counts.\n const searchChildren = children.filter((c) => !isSecondary?.(c));\n return nodeSearchText(node, searchChildren);\n }\n\n function visit(node: T): boolean {\n // A secondary node never drives a filter match — it's\n // effectively invisible to search. Still rendered when the\n // caller opens the parent manually. This is what lets a 28k-row\n // field tree stay searchable at the record level without \"field\n // name contains 'x'\" matches spamming the results.\n if (isSecondary?.(node)) return false;\n\n const key = getKey(node);\n const children = getChildren(node) ?? [];\n const childrenAllSecondary =\n children.length > 0 && children.every((child) => isSecondary?.(child));\n const matches = matchText(node, children).includes(normalizedQuery);\n const visibleChildren: T[] = [];\n\n for (const child of children) {\n if (visit(child)) visibleChildren.push(child);\n }\n\n if (matches) {\n if (children.length > 0) {\n filteredChildren.set(key, children);\n if (!childrenAllSecondary) forcedOpenKeys.add(key);\n }\n return true;\n }\n\n if (visibleChildren.length > 0) {\n filteredChildren.set(key, visibleChildren);\n forcedOpenKeys.add(key);\n return true;\n }\n\n return false;\n }\n\n return {\n roots: roots.filter((root) => visit(root)),\n filteredChildren,\n forcedOpenKeys,\n };\n}\n\nexport function Tree<T>({\n roots,\n empty,\n className,\n ariaLabel,\n showControls = true,\n showSearch = false,\n searchLabel,\n searchQuery,\n onSearchQueryChange,\n expandAll: controlledExpandAll,\n onExpandAllChange,\n toolbarClassName,\n actions,\n getSearchText,\n revealSelected = false,\n ...nodeProps\n}: TreeProps<T>) {\n const [internalExpandAll, setInternalExpandAll] = useState<boolean | null>(null);\n const [internalFilterQuery, setInternalFilterQuery] = useState(\"\");\n const filterQuery = searchQuery ?? internalFilterQuery;\n const setFilterQuery = (next: string) => {\n if (searchQuery !== undefined) onSearchQueryChange?.(next);\n else setInternalFilterQuery(next);\n };\n const basePaddingPx = nodeProps.basePaddingPx ?? 8;\n const isControlled = onExpandAllChange !== undefined;\n const expandAll = isControlled ? (controlledExpandAll ?? null) : internalExpandAll;\n const selectedKey = revealSelected && nodeProps.selected != null ? nodeProps.getKey(nodeProps.selected) : null;\n // revealKey drives the path reveal; it follows selectedKey except when the\n // selection came from clicking a row in this tree.\n const [reveal, setReveal] = useState({ selectedKey, revealKey: selectedKey, clickedKey: null as TreeKey | null });\n if (reveal.selectedKey !== selectedKey) {\n const fromTree = selectedKey !== null && selectedKey === reveal.clickedKey;\n setReveal({ selectedKey, revealKey: fromTree ? reveal.revealKey : selectedKey, clickedKey: null });\n }\n const revealKey = reveal.revealKey;\n const [revealInteraction, setRevealInteraction] = useState({\n selectedKey: null as TreeKey | null,\n overrides: new Map<TreeKey, boolean>(),\n bulk: false,\n });\n const previousExpandAll = useRef(expandAll);\n useEffect(() => {\n if (previousExpandAll.current === expandAll) return;\n previousExpandAll.current = expandAll;\n setRevealInteraction({ selectedKey: revealKey, overrides: new Map(), bulk: true });\n }, [expandAll, revealKey]);\n const totalEdges = useMemo(\n () => countTreeEdges(roots, nodeProps.getChildren),\n [roots, nodeProps.getChildren],\n );\n const showFilter = showSearch || totalEdges > 20 || Boolean(searchQuery);\n const activeFilter = showFilter ? filterQuery : \"\";\n const filteredTree = useMemo(\n () =>\n filterTreeRoots(\n roots,\n nodeProps.getChildren,\n nodeProps.getKey,\n activeFilter,\n nodeProps.isSecondary,\n getSearchText,\n ),\n [\n roots,\n nodeProps.getChildren,\n nodeProps.getKey,\n activeFilter,\n nodeProps.isSecondary,\n getSearchText,\n ],\n );\n const treeRoots = filteredTree.roots;\n const filteredChildren = filteredTree.filteredChildren;\n const revealPath = useMemo(\n () =>\n revealSelected && revealKey !== null\n ? selectionPath(roots, nodeProps.getChildren, nodeProps.getKey, revealKey)\n : null,\n [revealSelected, roots, nodeProps.getChildren, nodeProps.getKey, revealKey],\n );\n const activeReveal = !activeFilter.trim() && !(revealInteraction.selectedKey === revealKey && revealInteraction.bulk);\n const revealOverrides = revealInteraction.selectedKey === revealKey ? revealInteraction.overrides : null;\n const onSelect = nodeProps.onSelect;\n const selectFromTree = onSelect\n ? (node: T) => {\n setReveal((current) => ({ ...current, clickedKey: nodeProps.getKey(node) }));\n onSelect(node);\n }\n : undefined;\n const effectiveGetChildren = filteredChildren\n ? (node: T) => filteredChildren.get(nodeProps.getKey(node)) ?? []\n : nodeProps.getChildren;\n const effectiveExpandAll = expandAll;\n const effectiveEmpty = activeFilter.trim() ? (\n <div className=\"px-3 py-4 text-sm text-muted-foreground\">No matching tree nodes.</div>\n ) : (\n empty\n );\n const showControlButtons = showControls && roots.length > 0;\n const showVirtualRow = showFilter || showControlButtons || actions != null;\n const setExpandAll = (next: boolean | null) => {\n setRevealInteraction({ selectedKey: revealKey, overrides: new Map(), bulk: true });\n if (isControlled) onExpandAllChange?.(next);\n else setInternalExpandAll(next);\n };\n\n if (treeRoots.length === 0 && !showVirtualRow) return <>{effectiveEmpty ?? null}</>;\n\n return (\n <div className={cn(\"flex flex-col min-h-0\", className)}>\n <div className=\"min-h-0 flex-1 overflow-auto\">\n {showVirtualRow && (\n <div\n role=\"presentation\"\n className={cn(\n \"sticky top-0 z-10 flex items-center gap-1.5 border-b border-border/70 bg-background/95 py-1 pr-2 text-sm backdrop-blur supports-[backdrop-filter]:bg-background/80\",\n toolbarClassName,\n )}\n style={{ paddingLeft: `${basePaddingPx}px` }}\n >\n {showFilter ? (\n <Icon icon={UiSearch} className=\"w-3 shrink-0 text-xs text-muted-foreground\" />\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n\n {showFilter ? (\n <label className=\"flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground shadow-sm\">\n <input\n type=\"search\"\n value={filterQuery}\n onChange={(event) => setFilterQuery(event.target.value)}\n placeholder={searchLabel ?? \"Filter tree\"}\n className=\"h-5 w-full min-w-0 border-0 bg-transparent p-0 text-xs outline-none placeholder:text-placeholder [&::-webkit-search-cancel-button]:appearance-none\"\n aria-label={searchLabel ?? \"Filter tree nodes\"}\n />\n {filterQuery && (\n <button\n type=\"button\"\n onClick={() => setFilterQuery(\"\")}\n className=\"inline-flex items-center rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground\"\n aria-label=\"Clear tree filter\"\n title=\"Clear tree filter\"\n >\n <Icon icon={UiClose} className=\"text-xs\" />\n </button>\n )}\n </label>\n ) : (\n <span className=\"flex-1\" />\n )}\n\n {(showControlButtons || actions != null) && (\n <div className=\"ml-auto flex items-center gap-1\">\n {actions}\n {showControlButtons && (\n <>\n <button\n type=\"button\"\n onClick={() => setExpandAll(true)}\n aria-pressed={effectiveExpandAll === true}\n aria-label=\"Expand all\"\n title=\"Expand all\"\n disabled={activeFilter.trim().length > 0}\n className={cn(\n \"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n effectiveExpandAll === true && \"bg-accent text-accent-foreground\",\n )}\n >\n <Icon icon={UiExpandAll} className=\"text-sm\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setExpandAll(false)}\n aria-pressed={effectiveExpandAll === false}\n aria-label=\"Collapse all\"\n title=\"Collapse all\"\n disabled={activeFilter.trim().length > 0}\n className={cn(\n \"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n effectiveExpandAll === false && \"bg-accent text-accent-foreground\",\n )}\n >\n <Icon icon={UiCollapseAll} className=\"text-sm\" />\n </button>\n </>\n )}\n </div>\n )}\n </div>\n )}\n\n {treeRoots.length === 0 ? (\n (effectiveEmpty ?? null)\n ) : (\n <div role=\"tree\" aria-label={ariaLabel}>\n {treeRoots.map((root) => (\n <TreeNode<T>\n {...nodeProps}\n {...(selectFromTree ? { onSelect: selectFromTree } : {})}\n key={nodeProps.getKey(root)}\n node={root}\n expandAll={effectiveExpandAll}\n forcedOpenKeys={filteredTree.forcedOpenKeys}\n revealPath={activeReveal ? revealPath : null}\n revealOverrides={revealOverrides}\n onRevealToggle={(key, open) => setRevealInteraction((current) => {\n const overrides = new Map(current.selectedKey === revealKey ? current.overrides : []);\n overrides.set(key, open);\n return { selectedKey: revealKey, overrides, bulk: false };\n })}\n getChildren={effectiveGetChildren}\n />\n ))}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAoEA,SAAS,cACP,OACA,aACA,QACA,WACqC;CACrC,MAAM,uBAAO,IAAI,IAA6B;CAC9C,MAAM,SAAS,SAAqB;EAClC,IAAI,OAAO,IAAI,MAAM,WAAW;GAC9B,KAAK,IAAI,WAAW,IAAI;GACxB,OAAO;EACT;EACA,KAAK,MAAM,SAAS,YAAY,IAAI,KAAK,CAAC,GACxC,IAAI,MAAM,KAAK,GAAG;GAChB,KAAK,IAAI,OAAO,IAAI,GAAG,OAAO,KAAK,CAAC;GACpC,OAAO;EACT;EAEF,OAAO;CACT;CACA,KAAK,MAAM,QAAQ,OACjB,IAAI,MAAM,IAAI,GAAG,OAAO;CAE1B,OAAO;AACT;AAQA,SAAS,eAAkB,OAAY,aAA0C;CAC/E,IAAI,QAAQ;CACZ,MAAM,Q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X,OAAM;OACN,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS;OACvC,WAAW,GACT,8KACA,uBAAuB,SAAS,kCAClC;OAEA,UAAA,oBAAC,MAAD;QAAM,MAAM;QAAe,WAAU;OAAW,CAAA;MAC1C,CAAA,CACJ,EAAA,CAAA,CAED;;IAEJ;GAGN,CAAA,GAAA,UAAU,WAAW,IACnB,kBAAkB,OAEnB,oBAAC,OAAD;IAAK,MAAK;IAAO,cAAY;IAC1B,UAAA,UAAU,KAAK,SACd,8BAAC,UAAD;KACE,GAAI;KACJ,GAAK,iBAAiB,EAAE,UAAU,eAAe,IAAI,CAAC;KACtD,KAAK,UAAU,OAAO,IAAI;KAC1B,MAAM;KACN,WAAW;KACX,gBAAgB,aAAa;KAC7B,YAAY,eAAe,aAAa;KACvB;KACjB,iBAAiB,KAAK,SAAS,sBAAsB,YAAY;MAC/D,MAAM,YAAY,IAAI,IAAI,QAAQ,gBAAgB,YAAY,QAAQ,YAAY,CAAC,CAAC;MACpF,UAAU,IAAI,KAAK,IAAI;MACvB,OAAO;OAAE,aAAa;OAAW;OAAW,MAAM;MAAM;KAC1D,CAAC;KACD,aAAa;IACd,CAAA,CACF;GACE,CAAA,CAEJ;;CACF,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"Tree.js","names":["_Fragment"],"sources":["../../src/data/Tree.tsx"],"sourcesContent":["import { useEffect, useMemo, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiClose, UiCollapseAll, UiExpandAll, UiSearch } from \"../icons\";\nimport { TreeNode, type TreeKey, type TreeNodeProps } from \"./TreeNode\";\n\nexport type TreeProps<T> = Omit<\n TreeNodeProps<T>,\n \"node\" | \"depth\" | \"expandAll\" | \"forcedOpenKeys\" | \"revealPath\" | \"revealOverrides\" | \"onRevealToggle\"\n> & {\n /** Root nodes to render. */\n roots: T[];\n /** Empty-state content when no roots are provided. */\n empty?: ReactNode;\n /** Classes applied to the tree root. */\n className?: string;\n /** Accessible name applied to the tree root. */\n ariaLabel?: string;\n /**\n * Render the Expand all / Collapse all toolbar above the tree. Enabled by\n * default. Set to false to suppress when the tree is tiny or the controls\n * are owned externally.\n */\n showControls?: boolean;\n /**\n * Search box visibility. Omitted: shown for trees with more than 20 edges or\n * a `searchQuery`. `true`: always shown. `false`: never shown — a parent that\n * owns the filter input still filters through `searchQuery`.\n */\n showSearch?: boolean;\n /** Placeholder and accessible name of the search box, e.g. \"Filter tests\". */\n searchLabel?: string;\n /** URL or parent-controlled search query. */\n searchQuery?: string;\n onSearchQueryChange?: (query: string) => void;\n /**\n * Externally controlled expand-all state. When provided together with\n * `onExpandAllChange`, the tree is controlled; otherwise it manages the\n * toolbar state internally.\n */\n expandAll?: boolean | null;\n /** Called when the toolbar expand-all state changes. */\n onExpandAllChange?: (next: boolean | null) => void;\n /** Classes applied to the search/control toolbar. */\n toolbarClassName?: string;\n /**\n * Extra controls rendered in the toolbar's right-hand group, before Expand\n * all / Collapse all. Providing actions shows the toolbar even when the tree\n * is too small for the filter and `showControls` is off.\n */\n actions?: ReactNode;\n /**\n * Override the text the filter matches against for a given node.\n * Defaults to a recursive walk of the node's own fields (excluding\n * its `children` and any secondary children), which works for\n * plain-shape trees but leaks text from nested domain objects —\n * e.g. a SQL Table's Field rows are marked secondary, yet the\n * parent record still carries `record.fields[].field` strings that\n * the default walker would collect. Callers that need precise\n * control over search behaviour should return only the text they\n * want surfaced (the node's own display label / id / type).\n */\n getSearchText?: (node: T) => string;\n /**\n * Reveal only the path to `selected` when it changes from outside the tree\n * (initial mount or navigation). Ancestors initially show the next path node;\n * manual expansion and collapse then take precedence until the next external\n * selection. Selecting a row by clicking it never re-reveals. Off by default.\n */\n revealSelected?: boolean;\n};\n\nfunction selectionPath<T>(\n roots: T[],\n getChildren: TreeProps<T>[\"getChildren\"],\n getKey: TreeProps<T>[\"getKey\"],\n targetKey: TreeKey,\n): Map<TreeKey, TreeKey | null> | null {\n const path = new Map<TreeKey, TreeKey | null>();\n const visit = (node: T): boolean => {\n if (getKey(node) === targetKey) {\n path.set(targetKey, null);\n return true;\n }\n for (const child of getChildren(node) ?? []) {\n if (visit(child)) {\n path.set(getKey(node), getKey(child));\n return true;\n }\n }\n return false;\n };\n for (const root of roots) {\n if (visit(root)) return path;\n }\n return null;\n}\n\n// Edge counting, search-text collection and filtering all walk the tree through\n// the synchronous `getChildren` only. A lazy node (one declared via\n// `hasMoreChildren` whose children have not been fetched yet) therefore\n// contributes no edges and no search text until the operator expands it — so it\n// is invisible to \"expand all\" and to the filter while still collapsed. This is\n// intentional: we never trigger network loads from bulk/search operations.\nfunction countTreeEdges<T>(roots: T[], getChildren: TreeProps<T>[\"getChildren\"]) {\n let total = 0;\n const stack = [...roots];\n\n while (stack.length > 0) {\n const node = stack.pop()!;\n const children = getChildren(node) ?? [];\n total += children.length;\n stack.push(...children);\n }\n\n return total;\n}\n\nfunction collectTreeSearchText(\n value: unknown,\n excluded = new Set<unknown>(),\n seen = new Set<unknown>(),\n): string {\n if (value == null || excluded.has(value)) return \"\";\n\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n typeof value === \"bigint\"\n ) {\n return String(value);\n }\n\n if (typeof value !== \"object\") return \"\";\n if (seen.has(value)) return \"\";\n seen.add(value);\n\n if (Array.isArray(value)) {\n return value\n .map((entry) => collectTreeSearchText(entry, excluded, seen))\n .filter(Boolean)\n .join(\" \");\n }\n\n const preferredKeys = [\"label\", \"name\", \"title\", \"text\", \"plain\", \"id\", \"content\"];\n const record = value as Record<string, unknown>;\n const chunks: string[] = [];\n\n for (const key of preferredKeys) {\n if (!(key in record)) continue;\n const text = collectTreeSearchText(record[key], excluded, seen);\n if (text) chunks.push(text);\n }\n\n for (const [key, entry] of Object.entries(record)) {\n if (key === \"children\" || preferredKeys.includes(key)) continue;\n const text = collectTreeSearchText(entry, excluded, seen);\n if (text) chunks.push(text);\n }\n\n return chunks.join(\" \");\n}\n\nfunction nodeSearchText<T>(node: T, children: ReturnType<TreeProps<T>[\"getChildren\"]>) {\n const excluded = new Set<unknown>();\n if (children) excluded.add(children);\n return collectTreeSearchText(node, excluded).trim().toLowerCase();\n}\n\nfunction filterTreeRoots<T>(\n roots: T[],\n getChildren: TreeProps<T>[\"getChildren\"],\n getKey: TreeProps<T>[\"getKey\"],\n query: string,\n isSecondary?: (node: T) => boolean,\n getSearchText?: (node: T) => string,\n) {\n const normalizedQuery = query.trim().toLowerCase();\n if (!normalizedQuery) {\n return {\n roots,\n filteredChildren: null as Map<string | number, T[]> | null,\n forcedOpenKeys: null as Set<string | number> | null,\n };\n }\n\n const filteredChildren = new Map<string | number, T[]>();\n const forcedOpenKeys = new Set<string | number>();\n\n function matchText(node: T, children: T[]): string {\n // Honour the caller-supplied text extractor first — it's the\n // only way to get precise control over what the filter sees when\n // the node carries domain data whose fields would otherwise leak\n // into the default walker.\n if (getSearchText) return getSearchText(node).trim().toLowerCase();\n // Match-text skips secondary children so e.g. a Table's search\n // text only draws from the Table itself, not from its Field\n // rows. The Table is primary, so its own text still counts.\n const searchChildren = children.filter((c) => !isSecondary?.(c));\n return nodeSearchText(node, searchChildren);\n }\n\n function visit(node: T): boolean {\n // A secondary node never drives a filter match — it's\n // effectively invisible to search. Still rendered when the\n // caller opens the parent manually. This is what lets a 28k-row\n // field tree stay searchable at the record level without \"field\n // name contains 'x'\" matches spamming the results.\n if (isSecondary?.(node)) return false;\n\n const key = getKey(node);\n const children = getChildren(node) ?? [];\n const childrenAllSecondary =\n children.length > 0 && children.every((child) => isSecondary?.(child));\n const matches = matchText(node, children).includes(normalizedQuery);\n const visibleChildren: T[] = [];\n\n for (const child of children) {\n if (visit(child)) visibleChildren.push(child);\n }\n\n if (matches) {\n if (children.length > 0) {\n filteredChildren.set(key, children);\n if (!childrenAllSecondary) forcedOpenKeys.add(key);\n }\n return true;\n }\n\n if (visibleChildren.length > 0) {\n filteredChildren.set(key, visibleChildren);\n forcedOpenKeys.add(key);\n return true;\n }\n\n return false;\n }\n\n return {\n roots: roots.filter((root) => visit(root)),\n filteredChildren,\n forcedOpenKeys,\n };\n}\n\nexport function Tree<T>({\n roots,\n empty,\n className,\n ariaLabel,\n showControls = true,\n showSearch,\n searchLabel,\n searchQuery,\n onSearchQueryChange,\n expandAll: controlledExpandAll,\n onExpandAllChange,\n toolbarClassName,\n actions,\n getSearchText,\n revealSelected = false,\n ...nodeProps\n}: TreeProps<T>) {\n const [internalExpandAll, setInternalExpandAll] = useState<boolean | null>(null);\n const [internalFilterQuery, setInternalFilterQuery] = useState(\"\");\n const filterQuery = searchQuery ?? internalFilterQuery;\n const setFilterQuery = (next: string) => {\n if (searchQuery !== undefined) onSearchQueryChange?.(next);\n else setInternalFilterQuery(next);\n };\n const basePaddingPx = nodeProps.basePaddingPx ?? 8;\n const isControlled = onExpandAllChange !== undefined;\n const expandAll = isControlled ? (controlledExpandAll ?? null) : internalExpandAll;\n const selectedKey = revealSelected && nodeProps.selected != null ? nodeProps.getKey(nodeProps.selected) : null;\n // revealKey drives the path reveal; it follows selectedKey except when the\n // selection came from clicking a row in this tree.\n const [reveal, setReveal] = useState({ selectedKey, revealKey: selectedKey, clickedKey: null as TreeKey | null });\n const [revealInteraction, setRevealInteraction] = useState({\n selectedKey: null as TreeKey | null,\n overrides: new Map<TreeKey, boolean>(),\n bulk: false,\n });\n if (reveal.selectedKey !== selectedKey) {\n const fromTree = selectedKey !== null && selectedKey === reveal.clickedKey;\n setReveal({ selectedKey, revealKey: fromTree ? reveal.revealKey : selectedKey, clickedKey: null });\n // An external selection is a fresh reveal: toggles and bulk controls made\n // for an earlier visit to the same key no longer apply.\n if (!fromTree) setRevealInteraction({ selectedKey: null, overrides: new Map(), bulk: false });\n }\n const revealKey = reveal.revealKey;\n const previousExpandAll = useRef(expandAll);\n useEffect(() => {\n if (previousExpandAll.current === expandAll) return;\n previousExpandAll.current = expandAll;\n setRevealInteraction({ selectedKey: revealKey, overrides: new Map(), bulk: true });\n }, [expandAll, revealKey]);\n const totalEdges = useMemo(\n () => countTreeEdges(roots, nodeProps.getChildren),\n [roots, nodeProps.getChildren],\n );\n const showFilter = showSearch ?? (totalEdges > 20 || Boolean(searchQuery));\n const activeFilter = showFilter || showSearch === false ? filterQuery : \"\";\n const filteredTree = useMemo(\n () =>\n filterTreeRoots(\n roots,\n nodeProps.getChildren,\n nodeProps.getKey,\n activeFilter,\n nodeProps.isSecondary,\n getSearchText,\n ),\n [\n roots,\n nodeProps.getChildren,\n nodeProps.getKey,\n activeFilter,\n nodeProps.isSecondary,\n getSearchText,\n ],\n );\n const treeRoots = filteredTree.roots;\n const filteredChildren = filteredTree.filteredChildren;\n const revealPath = useMemo(\n () =>\n revealSelected && revealKey !== null\n ? selectionPath(roots, nodeProps.getChildren, nodeProps.getKey, revealKey)\n : null,\n [revealSelected, roots, nodeProps.getChildren, nodeProps.getKey, revealKey],\n );\n const activeReveal = !activeFilter.trim() && !(revealInteraction.selectedKey === revealKey && revealInteraction.bulk);\n const revealOverrides = revealInteraction.selectedKey === revealKey ? revealInteraction.overrides : null;\n const onSelect = nodeProps.onSelect;\n const selectFromTree = onSelect\n ? (node: T) => {\n setReveal((current) => ({ ...current, clickedKey: nodeProps.getKey(node) }));\n onSelect(node);\n }\n : undefined;\n const effectiveGetChildren = filteredChildren\n ? (node: T) => filteredChildren.get(nodeProps.getKey(node)) ?? []\n : nodeProps.getChildren;\n const effectiveExpandAll = expandAll;\n const effectiveEmpty = activeFilter.trim() ? (\n <div className=\"px-3 py-4 text-sm text-muted-foreground\">No matching tree nodes.</div>\n ) : (\n empty\n );\n const showControlButtons = showControls && roots.length > 0;\n const showVirtualRow = showFilter || showControlButtons || actions != null;\n const setExpandAll = (next: boolean | null) => {\n setRevealInteraction({ selectedKey: revealKey, overrides: new Map(), bulk: true });\n if (isControlled) onExpandAllChange?.(next);\n else setInternalExpandAll(next);\n };\n\n if (treeRoots.length === 0 && !showVirtualRow) return <>{effectiveEmpty ?? null}</>;\n\n return (\n <div className={cn(\"flex flex-col min-h-0\", className)}>\n <div className=\"min-h-0 flex-1 overflow-auto\">\n {showVirtualRow && (\n <div\n role=\"presentation\"\n className={cn(\n \"sticky top-0 z-10 flex items-center gap-1.5 border-b border-border/70 bg-background/95 py-1 pr-2 text-sm backdrop-blur supports-[backdrop-filter]:bg-background/80\",\n toolbarClassName,\n )}\n style={{ paddingLeft: `${basePaddingPx}px` }}\n >\n {showFilter ? (\n <Icon icon={UiSearch} className=\"w-3 shrink-0 text-xs text-muted-foreground\" />\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n\n {showFilter ? (\n <label className=\"flex min-w-0 flex-1 items-center gap-2 rounded-md border border-border bg-background px-2 py-1 text-xs text-foreground shadow-sm\">\n <input\n type=\"search\"\n value={filterQuery}\n onChange={(event) => setFilterQuery(event.target.value)}\n placeholder={searchLabel ?? \"Filter tree\"}\n className=\"h-5 w-full min-w-0 border-0 bg-transparent p-0 text-xs outline-none placeholder:text-placeholder [&::-webkit-search-cancel-button]:appearance-none\"\n aria-label={searchLabel ?? \"Filter tree nodes\"}\n />\n {filterQuery && (\n <button\n type=\"button\"\n onClick={() => setFilterQuery(\"\")}\n className=\"inline-flex items-center rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground\"\n aria-label=\"Clear tree filter\"\n title=\"Clear tree filter\"\n >\n <Icon icon={UiClose} className=\"text-xs\" />\n </button>\n )}\n </label>\n ) : (\n <span className=\"flex-1\" />\n )}\n\n {(showControlButtons || actions != null) && (\n <div className=\"ml-auto flex items-center gap-1\">\n {actions}\n {showControlButtons && (\n <>\n <button\n type=\"button\"\n onClick={() => setExpandAll(true)}\n aria-pressed={effectiveExpandAll === true}\n aria-label=\"Expand all\"\n title=\"Expand all\"\n disabled={activeFilter.trim().length > 0}\n className={cn(\n \"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n effectiveExpandAll === true && \"bg-accent text-accent-foreground\",\n )}\n >\n <Icon icon={UiExpandAll} className=\"text-sm\" />\n </button>\n <button\n type=\"button\"\n onClick={() => setExpandAll(false)}\n aria-pressed={effectiveExpandAll === false}\n aria-label=\"Collapse all\"\n title=\"Collapse all\"\n disabled={activeFilter.trim().length > 0}\n className={cn(\n \"inline-flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:cursor-not-allowed disabled:opacity-50\",\n effectiveExpandAll === false && \"bg-accent text-accent-foreground\",\n )}\n >\n <Icon icon={UiCollapseAll} className=\"text-sm\" />\n </button>\n </>\n )}\n </div>\n )}\n </div>\n )}\n\n {treeRoots.length === 0 ? (\n (effectiveEmpty ?? null)\n ) : (\n <div role=\"tree\" aria-label={ariaLabel}>\n {treeRoots.map((root) => (\n <TreeNode<T>\n {...nodeProps}\n {...(selectFromTree ? { onSelect: selectFromTree } : {})}\n key={nodeProps.getKey(root)}\n node={root}\n expandAll={effectiveExpandAll}\n forcedOpenKeys={filteredTree.forcedOpenKeys}\n revealPath={activeReveal ? revealPath : null}\n revealOverrides={revealOverrides}\n onRevealToggle={(key, open) => setRevealInteraction((current) => {\n const overrides = new Map(current.selectedKey === revealKey ? current.overrides : []);\n overrides.set(key, open);\n return { selectedKey: revealKey, overrides, bulk: false };\n })}\n getChildren={effectiveGetChildren}\n />\n ))}\n </div>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAwEA,SAAS,cACP,OACA,aACA,QACA,WACqC;CACrC,MAAM,uBAAO,IAAI,IAA6B;CAC9C,MAAM,SAAS,SAAqB;EAClC,IAAI,OAAO,IAAI,MAAM,WAAW;GAC9B,KAAK,IAAI,WAAW,IAAI;GACxB,OAAO;EACT;EACA,KAAK,MAAM,SAAS,YAAY,IAAI,KAAK,CAAC,GACxC,IAAI,MAAM,KAAK,GAAG;GAChB,KAAK,IAAI,OAAO,IAAI,GAAG,OAAO,KAAK,CAAC;GACpC,OAAO;EAC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I;OAChC,gBAAc,uBAAuB;OACrC,cAAW;OACX,OAAM;OACN,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS;OACvC,WAAW,GACT,8KACA,uBAAuB,QAAQ,kCACjC;OAEA,UAAA,oBAAC,MAAD;QAAM,MAAM;QAAa,WAAU;OAAW,CAAA;MACxC,CAAA,GACR,oBAAC,UAAD;OACE,MAAK;OACL,eAAe,aAAa,KAAK;OACjC,gBAAc,uBAAuB;OACrC,cAAW;OACX,OAAM;OACN,UAAU,aAAa,KAAK,CAAC,CAAC,SAAS;OACvC,WAAW,GACT,8KACA,uBAAuB,SAAS,kCAClC;OAEA,UAAA,oBAAC,MAAD;QAAM,MAAM;QAAe,WAAU;OAAW,CAAA;MAC1C,CAAA,CACJ,EAAA,CAAA,CAED;;IAEJ;GAGN,CAAA,GAAA,UAAU,WAAW,IACnB,kBAAkB,OAEnB,oBAAC,OAAD;IAAK,MAAK;IAAO,cAAY;IAC1B,UAAA,UAAU,KAAK,SACd,8BAAC,UAAD;KACE,GAAI;KACJ,GAAK,iBAAiB,EAAE,UAAU,eAAe,IAAI,CAAC;KACtD,KAAK,UAAU,OAAO,IAAI;KAC1B,MAAM;KACN,WAAW;KACX,gBAAgB,aAAa;KAC7B,YAAY,eAAe,aAAa;KACvB;KACjB,iBAAiB,KAAK,SAAS,sBAAsB,YAAY;MAC/D,MAAM,YAAY,IAAI,IAAI,QAAQ,gBAAgB,YAAY,QAAQ,YAAY,CAAC,CAAC;MACpF,UAAU,IAAI,KAAK,IAAI;MACvB,OAAO;OAAE,aAAa;OAAW;OAAW,MAAM;MAAM;KAC1D,CAAC;KACD,aAAa;IACd,CAAA,CACF;GACE,CAAA,CAEJ;;CACF,CAAA;AAET"}
|
package/dist/data/TreeNode.cjs
CHANGED
|
@@ -6,16 +6,22 @@ let react = require("react");
|
|
|
6
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
7
|
// src/data/TreeNode.tsx
|
|
8
8
|
var ROW_CONTENT_OFFSET_PX = 18;
|
|
9
|
-
function
|
|
9
|
+
function mergeChildrenByKey(loaded, sync, getKey) {
|
|
10
|
+
if (!sync?.length) return loaded;
|
|
11
|
+
const current = new Map(sync.map((child) => [getKey(child), child]));
|
|
12
|
+
const loadedKeys = new Set(loaded.map(getKey));
|
|
13
|
+
return [...loaded.map((child) => current.get(getKey(child)) ?? child), ...sync.filter((child) => !loadedKeys.has(getKey(child)))];
|
|
14
|
+
}
|
|
15
|
+
function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, revealPath = null, revealOverrides = null, onRevealToggle, selected = null, defaultOpen, getExpanded, onExpandedChange, getChildren, getKey, getAriaLabel, onSelect, renderRow, renderDetail, renderAfterChildren, rowClass, indentPx = 16, basePaddingPx = 8, isSecondary, hasMoreChildren, loadChildren, reloadOnOpen = false, getChildrenVersion }) {
|
|
10
16
|
if (getExpanded && !onExpandedChange) throw new Error("Controlled tree expansion requires onExpandedChange");
|
|
11
17
|
const [loadedChildren, setLoadedChildren] = (0, react.useState)(null);
|
|
12
18
|
const [loading, setLoading] = (0, react.useState)(false);
|
|
13
19
|
const [error, setError] = (0, react.useState)(null);
|
|
14
20
|
const syncChildren = getChildren(node);
|
|
15
|
-
const children = loadedChildren
|
|
21
|
+
const children = loadedChildren === null ? syncChildren : mergeChildrenByKey(loadedChildren, syncChildren, getKey);
|
|
16
22
|
const hasChildren = (children?.length ?? 0) > 0;
|
|
17
23
|
const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;
|
|
18
|
-
const expandable = hasChildren || lazyUnloaded;
|
|
24
|
+
const expandable = hasChildren || lazyUnloaded || Boolean(reloadOnOpen && hasMoreChildren?.(node));
|
|
19
25
|
const secondaryNode = isSecondary?.(node) ?? false;
|
|
20
26
|
const childrenAllSecondary = hasChildren && isSecondary != null && children.every((c) => isSecondary(c));
|
|
21
27
|
const skipExpandAll = secondaryNode || childrenAllSecondary || expandAll === true && lazyUnloaded;
|
|
@@ -28,8 +34,8 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
28
34
|
const revealNextKey = revealPath?.get(key) ?? null;
|
|
29
35
|
const isOnRevealPath = revealNextKey !== null;
|
|
30
36
|
const revealOverride = revealOverrides?.get(key);
|
|
31
|
-
const pathOnly = isOnRevealPath && revealOverride === void 0;
|
|
32
37
|
const ownOpen = getExpanded ? getExpanded(node) : open;
|
|
38
|
+
const pathOnly = isOnRevealPath && revealOverride === void 0 && !ownOpen;
|
|
33
39
|
const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);
|
|
34
40
|
(0, react.useEffect)(() => {
|
|
35
41
|
if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {
|
|
@@ -47,18 +53,22 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
47
53
|
const loadRequested = (0, react.useRef)(false);
|
|
48
54
|
const nodeKey = getKey(node);
|
|
49
55
|
const loadKeyRef = (0, react.useRef)(nodeKey);
|
|
56
|
+
const loadGeneration = (0, react.useRef)(0);
|
|
57
|
+
const childrenVersion = getChildrenVersion?.(node);
|
|
58
|
+
const previousChildrenVersion = (0, react.useRef)(childrenVersion);
|
|
50
59
|
function loadLazyChildren() {
|
|
51
60
|
if (!loadChildren || loadRequested.current) return;
|
|
52
61
|
loadRequested.current = true;
|
|
62
|
+
const generation = ++loadGeneration.current;
|
|
53
63
|
loadKeyRef.current = nodeKey;
|
|
54
64
|
setLoading(true);
|
|
55
65
|
setError(null);
|
|
56
66
|
loadChildren(node).then((kids) => {
|
|
57
|
-
if (loadKeyRef.current !== nodeKey) return;
|
|
67
|
+
if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;
|
|
58
68
|
setLoadedChildren(kids);
|
|
59
69
|
setLoading(false);
|
|
60
70
|
}).catch((err) => {
|
|
61
|
-
if (loadKeyRef.current !== nodeKey) return;
|
|
71
|
+
if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;
|
|
62
72
|
loadRequested.current = false;
|
|
63
73
|
setError(err);
|
|
64
74
|
setLoading(false);
|
|
@@ -71,17 +81,28 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
71
81
|
lazyUnloaded,
|
|
72
82
|
error
|
|
73
83
|
]);
|
|
84
|
+
(0, react.useEffect)(() => {
|
|
85
|
+
if (!getChildrenVersion || previousChildrenVersion.current === childrenVersion) return;
|
|
86
|
+
previousChildrenVersion.current = childrenVersion;
|
|
87
|
+
loadRequested.current = false;
|
|
88
|
+
if (isOpen && hasMoreChildren?.(node)) loadLazyChildren();
|
|
89
|
+
}, [childrenVersion]);
|
|
90
|
+
(0, react.useEffect)(() => () => {
|
|
91
|
+
loadGeneration.current++;
|
|
92
|
+
loadRequested.current = false;
|
|
93
|
+
}, []);
|
|
74
94
|
function toggle() {
|
|
75
95
|
if (!expandable) return;
|
|
76
96
|
if (isOnRevealPath) {
|
|
77
97
|
if (!onRevealToggle) throw new Error("A revealed tree path requires onRevealToggle");
|
|
78
|
-
const next = pathOnly || !revealOverride;
|
|
98
|
+
const next = pathOnly || !(revealOverride ?? ownOpen);
|
|
79
99
|
if (next && lazyUnloaded) loadLazyChildren();
|
|
80
100
|
onRevealToggle(key, next);
|
|
81
101
|
return;
|
|
82
102
|
}
|
|
83
103
|
const next = !ownOpen;
|
|
84
|
-
if (next &&
|
|
104
|
+
if (next && reloadOnOpen && hasMoreChildren?.(node)) loadRequested.current = false;
|
|
105
|
+
if (next && (lazyUnloaded || reloadOnOpen)) loadLazyChildren();
|
|
85
106
|
if (getExpanded) onExpandedChange(node, next);
|
|
86
107
|
else setOpen(next);
|
|
87
108
|
}
|
|
@@ -161,7 +182,9 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
161
182
|
...rowClass ? { rowClass } : {},
|
|
162
183
|
...isSecondary ? { isSecondary } : {},
|
|
163
184
|
...hasMoreChildren ? { hasMoreChildren } : {},
|
|
164
|
-
...loadChildren ? { loadChildren } : {}
|
|
185
|
+
...loadChildren ? { loadChildren } : {},
|
|
186
|
+
reloadOnOpen,
|
|
187
|
+
...getChildrenVersion ? { getChildrenVersion } : {}
|
|
165
188
|
}, getKey(child)))
|
|
166
189
|
}),
|
|
167
190
|
afterChildren != null && afterChildren !== false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.cjs","names":["useState","useRef","cn","Icon","UiChevronDown","UiChevronRight"],"sources":["../../src/data/TreeNode.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiChevronDown, UiChevronRight } from \"../icons\";\n\n// A row's content column starts after the chevron (`w-3`, 12px) plus the row's\n// `gap-1.5` (6px) — fixed regardless of indentPx/basePaddingPx, since the\n// chevron/spacer width and gap are not configurable. renderDetail's wrapper\n// adds this on top of the row's own paddingLeft so it lines up under the label.\nconst ROW_CONTENT_OFFSET_PX = 18;\nexport type TreeKey = string | number;\n\nexport type TreeRowContext<T> = {\n node: T;\n depth: number;\n open: boolean;\n selected: boolean;\n hasChildren: boolean;\n toggle: () => void;\n /** True while this node's lazy children are being fetched via loadChildren. */\n loading: boolean;\n /** The rejection value from loadChildren, or null when there was no error. */\n error: unknown;\n};\n\nexport type TreeNodeProps<T> = {\n node: T;\n depth?: number;\n expandAll?: boolean | null;\n forcedOpenKeys?: Set<string | number> | null;\n revealPath?: Map<TreeKey, TreeKey | null> | null;\n revealOverrides?: Map<TreeKey, boolean> | null;\n onRevealToggle?: (key: TreeKey, open: boolean) => void;\n selected?: T | null;\n defaultOpen?: (node: T, depth: number) => boolean;\n /** Controlled expansion, shared between tree instances. Requires onExpandedChange. */\n getExpanded?: (node: T) => boolean;\n /** Receives user and bulk expansion changes for controlled trees. */\n onExpandedChange?: (node: T, expanded: boolean) => void;\n getChildren: (node: T) => T[] | undefined;\n getKey: (node: T) => string | number;\n getAriaLabel?: (node: T) => string;\n onSelect?: (node: T) => void;\n renderRow: (ctx: TreeRowContext<T>) => ReactNode;\n /**\n * Render extra content beneath a node's row and above its children (e.g. the\n * decompiled source line a call was made from). Rendered for leaf and parent\n * nodes alike, regardless of open/collapsed state, and left-aligned with the\n * row's content column (after the depth indent and chevron). Returning\n * `null`/`undefined`/`false` renders nothing — no wrapper, no extra spacing.\n * A click or keydown inside it is stopped from propagating, so it can never\n * toggle the row's expand/collapse state.\n */\n renderDetail?: (node: T) => ReactNode;\n /** Render a node's result after its children, including when the children are collapsed. */\n renderAfterChildren?: (node: T) => ReactNode;\n rowClass?: (node: T, selected: boolean) => string;\n indentPx?: number;\n basePaddingPx?: number;\n /**\n * Reports that a node has children that are not yet loaded — it renders an\n * expand chevron even when `getChildren` returns nothing. On the first open\n * the node fetches them via `loadChildren`. Without this (the default), a\n * node is expandable only when `getChildren` already returns children.\n */\n hasMoreChildren?: (node: T) => boolean;\n /**\n * Lazily fetch a node's children the first time it is opened. Resolves to the\n * child nodes (which may themselves be lazy). A rejection is surfaced to\n * `renderRow` via `ctx.error` and is not retried until the node is collapsed\n * and reopened. Required for any node `hasMoreChildren` returns true for.\n */\n loadChildren?: (node: T) => Promise<T[]>;\n /**\n * Marks a node as a **secondary child** of its parent. Secondary\n * children keep the full tree structure (they render, they can be\n * opened manually) but opt out of the bulk behaviours a caller\n * typically wants when they click the toolbar:\n *\n * - Tree-wide filter: their text is skipped during match detection\n * so typing in the search box never surfaces a row because one\n * of its secondary children happened to match.\n * - Expand all: secondary nodes stay at their default-open state\n * instead of being forced open, preventing 28k field rows from\n * flooding the viewport when an operator hits the button on a\n * schema with hundreds of tables.\n *\n * Default: every node is primary (returns false).\n */\n isSecondary?: (node: T) => boolean;\n};\n\nexport function TreeNode<T>({\n node,\n depth = 0,\n expandAll = null,\n forcedOpenKeys = null,\n revealPath = null,\n revealOverrides = null,\n onRevealToggle,\n selected = null,\n defaultOpen,\n getExpanded,\n onExpandedChange,\n getChildren,\n getKey,\n getAriaLabel,\n onSelect,\n renderRow,\n renderDetail,\n renderAfterChildren,\n rowClass,\n indentPx = 16,\n basePaddingPx = 8,\n isSecondary,\n hasMoreChildren,\n loadChildren,\n}: TreeNodeProps<T>) {\n if (getExpanded && !onExpandedChange) throw new Error(\"Controlled tree expansion requires onExpandedChange\");\n // Lazily-fetched children take precedence over the synchronous ones once a\n // load has resolved; until then `loadedChildren` is null and we fall back to\n // getChildren. A node can be \"lazy\" (hasMoreChildren) with no sync children.\n const [loadedChildren, setLoadedChildren] = useState<T[] | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const syncChildren = getChildren(node);\n const children = loadedChildren ?? syncChildren;\n const hasChildren = (children?.length ?? 0) > 0;\n const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;\n // The chevron shows when there is something to reveal: either real children\n // are present, or the node is lazy and has not been loaded yet.\n const expandable = hasChildren || lazyUnloaded;\n // A node opts out of bulk expand-all in two distinct cases:\n //\n // 1. The node itself is secondary (its edge from the parent is\n // secondary) — rare at the root, but the rule is symmetric.\n // 2. All of the node's children are secondary — the common case.\n // This is what keeps an \"Expand all\" on a schema tree from\n // flooding the viewport with every table's field rows: the\n // table opens to nothing structural worth seeing in bulk, so\n // we leave it closed until the operator clicks it manually.\n //\n // In both cases the manual toggle still works, and filter matches\n // still force the row open via forcedOpenKeys, so users never\n // lose access — they just don't get auto-flooded.\n const secondaryNode = isSecondary?.(node) ?? false;\n const childrenAllSecondary =\n hasChildren && isSecondary != null && children!.every((c) => isSecondary(c));\n // An unloaded lazy node never opens in bulk either: opening it would fetch,\n // and bulk operations never trigger loads. Collapse-all still closes it.\n const skipExpandAll = secondaryNode || childrenAllSecondary || (expandAll === true && lazyUnloaded);\n // A non-null `expandAll` is a live bulk state, not just a one-off change\n // signal: a node mounted *while* expand-all is active (because an ancestor\n // just opened) inherits it as its initial open state, so opening a parent\n // cascades all the way down — expand/collapse-all are recursive. The\n // skipExpandAll guard keeps secondary subtrees from auto-flooding. When\n // expandAll is null (before any toolbar click) we fall back to defaultOpen.\n const initialOpen =\n expandAll !== null && !skipExpandAll\n ? expandAll\n : defaultOpen\n ? defaultOpen(node, depth)\n : depth < 1;\n const [open, setOpen] = useState(initialOpen);\n const prevExpandAll = useRef(getExpanded ? null : expandAll);\n const key = getKey(node);\n const isSelected = selected != null && getKey(selected) === key;\n const isForcedOpen = forcedOpenKeys?.has(key) ?? false;\n // Only the selection's ancestors are on the reveal path; the selected node\n // itself (mapped to null) keeps its own expansion.\n const revealNextKey = revealPath?.get(key) ?? null;\n const isOnRevealPath = revealNextKey !== null;\n const revealOverride = revealOverrides?.get(key);\n const pathOnly = isOnRevealPath && revealOverride === undefined;\n const ownOpen = getExpanded ? getExpanded(node) : open;\n const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);\n\n useEffect(() => {\n if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {\n if (getExpanded) onExpandedChange!(node, expandAll);\n else setOpen(expandAll);\n }\n prevExpandAll.current = expandAll;\n }, [expandAll, skipExpandAll, getExpanded, onExpandedChange, node]);\n\n // Guards a lazy fetch so a node loads its children at most once per mount and\n // a resolution arriving after the node was reused (key changed) is ignored.\n const loadRequested = useRef(false);\n const nodeKey = getKey(node);\n const loadKeyRef = useRef(nodeKey);\n\n function loadLazyChildren() {\n if (!loadChildren || loadRequested.current) return;\n loadRequested.current = true;\n loadKeyRef.current = nodeKey;\n setLoading(true);\n setError(null);\n loadChildren(node)\n .then((kids) => {\n if (loadKeyRef.current !== nodeKey) return;\n setLoadedChildren(kids);\n setLoading(false);\n })\n .catch((err) => {\n if (loadKeyRef.current !== nodeKey) return;\n // Surfaced to renderRow via ctx.error; allow a retry on re-toggle.\n loadRequested.current = false;\n setError(err);\n setLoading(false);\n });\n }\n\n // A lazy node can be open without ever having been clicked — defaultOpen said\n // so, expand-all did, or the filter forced it open to reveal a match. Loading\n // only on the open transition would leave every one of those showing a caret\n // over nothing.\n //\n // A node that already failed is skipped: loadLazyChildren clears its own retry\n // guard on failure so a re-toggle can try again, and re-running here would\n // turn that into an unbounded retry loop instead.\n useEffect(() => {\n if (isOpen && lazyUnloaded && error === null) loadLazyChildren();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, lazyUnloaded, error]);\n\n function toggle() {\n if (!expandable) return;\n if (isOnRevealPath) {\n if (!onRevealToggle) throw new Error(\"A revealed tree path requires onRevealToggle\");\n const next = pathOnly || !revealOverride;\n if (next && lazyUnloaded) loadLazyChildren();\n onRevealToggle(key, next);\n return;\n }\n const next = !ownOpen;\n if (next && lazyUnloaded) loadLazyChildren();\n if (getExpanded) onExpandedChange!(node, next);\n else setOpen(next);\n }\n\n const defaultRowBg = isSelected ? \"bg-primary/10 border-l-2 border-primary\" : \"hover:bg-accent\";\n const rowClassName = rowClass ? rowClass(node, isSelected) : defaultRowBg;\n const detail = renderDetail?.(node);\n const afterChildren = renderAfterChildren?.(node);\n\n return (\n <div\n role=\"treeitem\"\n aria-label={getAriaLabel?.(node)}\n aria-expanded={expandable ? isOpen : undefined}\n aria-selected={isSelected}\n >\n <div\n className={cn(\"flex items-center gap-1.5 py-1 px-2 cursor-pointer text-sm\", rowClassName)}\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx}px` }}\n onClick={(e) => {\n e.stopPropagation();\n onSelect?.(node);\n toggle();\n }}\n >\n {expandable ? (\n <button\n type=\"button\"\n aria-label={pathOnly ? \"Show all children\" : isOpen ? \"Collapse\" : \"Expand\"}\n // The caret only toggles expansion — stopPropagation keeps the row's\n // onClick (which selects) from firing, so expanding a node never\n // selects it.\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n className=\"flex shrink-0 items-center text-muted-foreground\"\n >\n <Icon icon={isOpen && !pathOnly ? UiChevronDown : UiChevronRight} className=\"text-xs w-3\" />\n </button>\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n {renderRow({\n node,\n depth,\n open: isOpen,\n selected: isSelected,\n hasChildren,\n toggle,\n loading,\n error,\n })}\n </div>\n {detail != null && detail !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {detail}\n </div>\n )}\n {isOpen && hasChildren && (\n <div role=\"group\">\n {(pathOnly ? children!.filter((child) => getKey(child) === revealNextKey) : children!).map((child) => (\n <TreeNode\n key={getKey(child)}\n node={child}\n depth={depth + 1}\n expandAll={expandAll}\n forcedOpenKeys={forcedOpenKeys}\n revealPath={revealPath}\n revealOverrides={revealOverrides}\n {...(onRevealToggle ? { onRevealToggle } : {})}\n selected={selected}\n getChildren={getChildren}\n getKey={getKey}\n renderRow={renderRow}\n indentPx={indentPx}\n basePaddingPx={basePaddingPx}\n {...(defaultOpen ? { defaultOpen } : {})}\n {...(getExpanded ? { getExpanded } : {})}\n {...(onExpandedChange ? { onExpandedChange } : {})}\n {...(renderDetail ? { renderDetail } : {})}\n {...(renderAfterChildren ? { renderAfterChildren } : {})}\n {...(getAriaLabel ? { getAriaLabel } : {})}\n {...(onSelect ? { onSelect } : {})}\n {...(rowClass ? { rowClass } : {})}\n {...(isSecondary ? { isSecondary } : {})}\n {...(hasMoreChildren ? { hasMoreChildren } : {})}\n {...(loadChildren ? { loadChildren } : {})}\n />\n ))}\n </div>\n )}\n {afterChildren != null && afterChildren !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {afterChildren}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AASA,IAAM,wBAAwB;AAmF9B,SAAgB,SAAY,EAC1B,MACA,QAAQ,GACR,YAAY,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on","UiChevronDown","UiChevronRight"],"sources":["../../src/data/TreeNode.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiChevronDown, UiChevronRight } from \"../icons\";\n\n// A row's content column starts after the chevron (`w-3`, 12px) plus the row's\n// `gap-1.5` (6px) — fixed regardless of indentPx/basePaddingPx, since the\n// chevron/spacer width and gap are not configurable. renderDetail's wrapper\n// adds this on top of the row's own paddingLeft so it lines up under the label.\nconst ROW_CONTENT_OFFSET_PX = 18;\nexport type TreeKey = string | number;\n\nexport type TreeRowContext<T> = {\n node: T;\n depth: number;\n open: boolean;\n selected: boolean;\n hasChildren: boolean;\n toggle: () => void;\n /** True while this node's lazy children are being fetched via loadChildren. */\n loading: boolean;\n /** The rejection value from loadChildren, or null when there was no error. */\n error: unknown;\n};\n\nexport type TreeNodeProps<T> = {\n node: T;\n depth?: number;\n expandAll?: boolean | null;\n forcedOpenKeys?: Set<string | number> | null;\n revealPath?: Map<TreeKey, TreeKey | null> | null;\n revealOverrides?: Map<TreeKey, boolean> | null;\n onRevealToggle?: (key: TreeKey, open: boolean) => void;\n selected?: T | null;\n defaultOpen?: (node: T, depth: number) => boolean;\n /** Controlled expansion, shared between tree instances. Requires onExpandedChange. */\n getExpanded?: (node: T) => boolean;\n /** Receives user and bulk expansion changes for controlled trees. */\n onExpandedChange?: (node: T, expanded: boolean) => void;\n getChildren: (node: T) => T[] | undefined;\n getKey: (node: T) => string | number;\n getAriaLabel?: (node: T) => string;\n onSelect?: (node: T) => void;\n renderRow: (ctx: TreeRowContext<T>) => ReactNode;\n /**\n * Render extra content beneath a node's row and above its children (e.g. the\n * decompiled source line a call was made from). Rendered for leaf and parent\n * nodes alike, regardless of open/collapsed state, and left-aligned with the\n * row's content column (after the depth indent and chevron). Returning\n * `null`/`undefined`/`false` renders nothing — no wrapper, no extra spacing.\n * A click or keydown inside it is stopped from propagating, so it can never\n * toggle the row's expand/collapse state.\n */\n renderDetail?: (node: T) => ReactNode;\n /** Render a node's result after its children, including when the children are collapsed. */\n renderAfterChildren?: (node: T) => ReactNode;\n rowClass?: (node: T, selected: boolean) => string;\n indentPx?: number;\n basePaddingPx?: number;\n /**\n * Reports that a node has children that are not yet loaded — it renders an\n * expand chevron even when `getChildren` returns nothing. On the first open\n * the node fetches them via `loadChildren`. Without this (the default), a\n * node is expandable only when `getChildren` already returns children.\n */\n hasMoreChildren?: (node: T) => boolean;\n /**\n * Lazily fetch a node's children the first time it is opened. Resolves to the\n * child nodes (which may themselves be lazy). A rejection is surfaced to\n * `renderRow` via `ctx.error` and is not retried until the node is collapsed\n * and reopened. Required for any node `hasMoreChildren` returns true for.\n */\n loadChildren?: (node: T) => Promise<T[]>;\n /** Refresh lazy children on each manual reopen, retaining the row and its children while loading. */\n reloadOnOpen?: boolean;\n /** Host-controlled invalidation; open nodes refresh when their version changes. */\n getChildrenVersion?: (node: T) => string | number;\n /**\n * Marks a node as a **secondary child** of its parent. Secondary\n * children keep the full tree structure (they render, they can be\n * opened manually) but opt out of the bulk behaviours a caller\n * typically wants when they click the toolbar:\n *\n * - Tree-wide filter: their text is skipped during match detection\n * so typing in the search box never surfaces a row because one\n * of its secondary children happened to match.\n * - Expand all: secondary nodes stay at their default-open state\n * instead of being forced open, preventing 28k field rows from\n * flooding the viewport when an operator hits the button on a\n * schema with hundreds of tables.\n *\n * Default: every node is primary (returns false).\n */\n isSecondary?: (node: T) => boolean;\n};\n\nfunction mergeChildrenByKey<T>(loaded: T[], sync: T[] | undefined, getKey: (node: T) => TreeKey): T[] {\n if (!sync?.length) return loaded;\n const current = new Map(sync.map((child) => [getKey(child), child]));\n const loadedKeys = new Set(loaded.map(getKey));\n return [...loaded.map((child) => current.get(getKey(child)) ?? child), ...sync.filter((child) => !loadedKeys.has(getKey(child)))];\n}\n\nexport function TreeNode<T>({\n node,\n depth = 0,\n expandAll = null,\n forcedOpenKeys = null,\n revealPath = null,\n revealOverrides = null,\n onRevealToggle,\n selected = null,\n defaultOpen,\n getExpanded,\n onExpandedChange,\n getChildren,\n getKey,\n getAriaLabel,\n onSelect,\n renderRow,\n renderDetail,\n renderAfterChildren,\n rowClass,\n indentPx = 16,\n basePaddingPx = 8,\n isSecondary,\n hasMoreChildren,\n loadChildren,\n reloadOnOpen = false,\n getChildrenVersion,\n}: TreeNodeProps<T>) {\n if (getExpanded && !onExpandedChange) throw new Error(\"Controlled tree expansion requires onExpandedChange\");\n // Lazily-fetched children are the base set once a load has resolved; until\n // then `loadedChildren` is null and we use getChildren. A node can be \"lazy\"\n // (hasMoreChildren) with no sync children. The loaded copy is a snapshot, so\n // the host's current sync children win by key (fresh `active`, `to`, ...) and\n // sync-only children are appended rather than hidden behind the stale snapshot.\n const [loadedChildren, setLoadedChildren] = useState<T[] | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const syncChildren = getChildren(node);\n const children = loadedChildren === null ? syncChildren : mergeChildrenByKey(loadedChildren, syncChildren, getKey);\n const hasChildren = (children?.length ?? 0) > 0;\n const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;\n // The chevron shows when there is something to reveal: either real children\n // are present, or the node is lazy and has not been loaded yet.\n const expandable = hasChildren || lazyUnloaded || Boolean(reloadOnOpen && hasMoreChildren?.(node));\n // A node opts out of bulk expand-all in two distinct cases:\n //\n // 1. The node itself is secondary (its edge from the parent is\n // secondary) — rare at the root, but the rule is symmetric.\n // 2. All of the node's children are secondary — the common case.\n // This is what keeps an \"Expand all\" on a schema tree from\n // flooding the viewport with every table's field rows: the\n // table opens to nothing structural worth seeing in bulk, so\n // we leave it closed until the operator clicks it manually.\n //\n // In both cases the manual toggle still works, and filter matches\n // still force the row open via forcedOpenKeys, so users never\n // lose access — they just don't get auto-flooded.\n const secondaryNode = isSecondary?.(node) ?? false;\n const childrenAllSecondary =\n hasChildren && isSecondary != null && children!.every((c) => isSecondary(c));\n // An unloaded lazy node never opens in bulk either: opening it would fetch,\n // and bulk operations never trigger loads. Collapse-all still closes it.\n const skipExpandAll = secondaryNode || childrenAllSecondary || (expandAll === true && lazyUnloaded);\n // A non-null `expandAll` is a live bulk state, not just a one-off change\n // signal: a node mounted *while* expand-all is active (because an ancestor\n // just opened) inherits it as its initial open state, so opening a parent\n // cascades all the way down — expand/collapse-all are recursive. The\n // skipExpandAll guard keeps secondary subtrees from auto-flooding. When\n // expandAll is null (before any toolbar click) we fall back to defaultOpen.\n const initialOpen =\n expandAll !== null && !skipExpandAll\n ? expandAll\n : defaultOpen\n ? defaultOpen(node, depth)\n : depth < 1;\n const [open, setOpen] = useState(initialOpen);\n const prevExpandAll = useRef(getExpanded ? null : expandAll);\n const key = getKey(node);\n const isSelected = selected != null && getKey(selected) === key;\n const isForcedOpen = forcedOpenKeys?.has(key) ?? false;\n // Only the selection's ancestors are on the reveal path; the selected node\n // itself (mapped to null) keeps its own expansion.\n const revealNextKey = revealPath?.get(key) ?? null;\n const isOnRevealPath = revealNextKey !== null;\n const revealOverride = revealOverrides?.get(key);\n const ownOpen = getExpanded ? getExpanded(node) : open;\n // An ancestor that is already open keeps all its children; only a closed one\n // opens to just the next path node.\n const pathOnly = isOnRevealPath && revealOverride === undefined && !ownOpen;\n const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);\n\n useEffect(() => {\n if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {\n if (getExpanded) onExpandedChange!(node, expandAll);\n else setOpen(expandAll);\n }\n prevExpandAll.current = expandAll;\n }, [expandAll, skipExpandAll, getExpanded, onExpandedChange, node]);\n\n // Guards a lazy fetch so a node loads its children at most once per mount and\n // a resolution arriving after the node was reused (key changed) is ignored.\n const loadRequested = useRef(false);\n const nodeKey = getKey(node);\n const loadKeyRef = useRef(nodeKey);\n const loadGeneration = useRef(0);\n const childrenVersion = getChildrenVersion?.(node);\n const previousChildrenVersion = useRef(childrenVersion);\n\n function loadLazyChildren() {\n if (!loadChildren || loadRequested.current) return;\n loadRequested.current = true;\n const generation = ++loadGeneration.current;\n loadKeyRef.current = nodeKey;\n setLoading(true);\n setError(null);\n loadChildren(node)\n .then((kids) => {\n if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;\n setLoadedChildren(kids);\n setLoading(false);\n })\n .catch((err) => {\n if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;\n // Surfaced to renderRow via ctx.error; allow a retry on re-toggle.\n loadRequested.current = false;\n setError(err);\n setLoading(false);\n });\n }\n\n // A lazy node can be open without ever having been clicked — defaultOpen said\n // so, expand-all did, or the filter forced it open to reveal a match. Loading\n // only on the open transition would leave every one of those showing a caret\n // over nothing.\n //\n // A node that already failed is skipped: loadLazyChildren clears its own retry\n // guard on failure so a re-toggle can try again, and re-running here would\n // turn that into an unbounded retry loop instead.\n useEffect(() => {\n if (isOpen && lazyUnloaded && error === null) loadLazyChildren();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, lazyUnloaded, error]);\n\n useEffect(() => {\n if (!getChildrenVersion || previousChildrenVersion.current === childrenVersion) return;\n previousChildrenVersion.current = childrenVersion;\n loadRequested.current = false;\n if (isOpen && hasMoreChildren?.(node)) loadLazyChildren();\n // The host version, rather than callback identity, invalidates this node.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [childrenVersion]);\n\n useEffect(() => () => { loadGeneration.current++; loadRequested.current = false; }, []);\n\n function toggle() {\n if (!expandable) return;\n if (isOnRevealPath) {\n if (!onRevealToggle) throw new Error(\"A revealed tree path requires onRevealToggle\");\n const next = pathOnly || !(revealOverride ?? ownOpen);\n if (next && lazyUnloaded) loadLazyChildren();\n onRevealToggle(key, next);\n return;\n }\n const next = !ownOpen;\n if (next && reloadOnOpen && hasMoreChildren?.(node)) loadRequested.current = false;\n if (next && (lazyUnloaded || reloadOnOpen)) loadLazyChildren();\n if (getExpanded) onExpandedChange!(node, next);\n else setOpen(next);\n }\n\n const defaultRowBg = isSelected ? \"bg-primary/10 border-l-2 border-primary\" : \"hover:bg-accent\";\n const rowClassName = rowClass ? rowClass(node, isSelected) : defaultRowBg;\n const detail = renderDetail?.(node);\n const afterChildren = renderAfterChildren?.(node);\n\n return (\n <div\n role=\"treeitem\"\n aria-label={getAriaLabel?.(node)}\n aria-expanded={expandable ? isOpen : undefined}\n aria-selected={isSelected}\n >\n <div\n className={cn(\"flex items-center gap-1.5 py-1 px-2 cursor-pointer text-sm\", rowClassName)}\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx}px` }}\n onClick={(e) => {\n e.stopPropagation();\n onSelect?.(node);\n toggle();\n }}\n >\n {expandable ? (\n <button\n type=\"button\"\n aria-label={pathOnly ? \"Show all children\" : isOpen ? \"Collapse\" : \"Expand\"}\n // The caret only toggles expansion — stopPropagation keeps the row's\n // onClick (which selects) from firing, so expanding a node never\n // selects it.\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n className=\"flex shrink-0 items-center text-muted-foreground\"\n >\n <Icon icon={isOpen && !pathOnly ? UiChevronDown : UiChevronRight} className=\"text-xs w-3\" />\n </button>\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n {renderRow({\n node,\n depth,\n open: isOpen,\n selected: isSelected,\n hasChildren,\n toggle,\n loading,\n error,\n })}\n </div>\n {detail != null && detail !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {detail}\n </div>\n )}\n {isOpen && hasChildren && (\n <div role=\"group\">\n {(pathOnly ? children!.filter((child) => getKey(child) === revealNextKey) : children!).map((child) => (\n <TreeNode\n key={getKey(child)}\n node={child}\n depth={depth + 1}\n expandAll={expandAll}\n forcedOpenKeys={forcedOpenKeys}\n revealPath={revealPath}\n revealOverrides={revealOverrides}\n {...(onRevealToggle ? { onRevealToggle } : {})}\n selected={selected}\n getChildren={getChildren}\n getKey={getKey}\n renderRow={renderRow}\n indentPx={indentPx}\n basePaddingPx={basePaddingPx}\n {...(defaultOpen ? { defaultOpen } : {})}\n {...(getExpanded ? { getExpanded } : {})}\n {...(onExpandedChange ? { onExpandedChange } : {})}\n {...(renderDetail ? { renderDetail } : {})}\n {...(renderAfterChildren ? { renderAfterChildren } : {})}\n {...(getAriaLabel ? { getAriaLabel } : {})}\n {...(onSelect ? { onSelect } : {})}\n {...(rowClass ? { rowClass } : {})}\n {...(isSecondary ? { isSecondary } : {})}\n {...(hasMoreChildren ? { hasMoreChildren } : {})}\n {...(loadChildren ? { loadChildren } : {})}\n reloadOnOpen={reloadOnOpen}\n {...(getChildrenVersion ? { getChildrenVersion } : {})}\n />\n ))}\n </div>\n )}\n {afterChildren != null && afterChildren !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {afterChildren}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AASA,IAAM,wBAAwB;AAuF9B,SAAS,mBAAsB,QAAa,MAAuB,QAAmC;CACpG,IAAI,CAAC,MAAM,QAAQ,OAAO;CAC1B,MAAM,UAAU,IAAI,IAAI,KAAK,KAAK,UAAU,CAAC,OAAO,KAAK,GAAG,KAAK,CAAC,CAAC;CACnE,MAAM,aAAa,IAAI,IAAI,OAAO,IAAI,MAAM,CAAC;CAC7C,OAAO,CAAC,GAAG,OAAO,KAAK,UAAU,QAAQ,IAAI,OAAO,KAAK,CAAC,KAAK,KAAK,GAAG,GAAG,KAAK,QAAQ,UAAU,CAAC,WAAW,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC;AAClI;AAEA,SAAgB,SAAY,EAC1B,MACA,QAAQ,GACR,YAAY,MACZ,iBAAiB,MACjB,aAAa,MACb,kBAAkB,MAClB,gBACA,WAAW,MACX,aACA,aACA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AAI,CAAC;KACtD,GAAK,eAAe,EAAE,aAAa,IAAI,CAAC;KACxC,GAAK,WAAW,EAAE,SAAS,IAAI,CAAC;KAChC,GAAK,WAAW,EAAE,SAAS,IAAI,CAAC;KAChC,GAAK,cAAc,EAAE,YAAY,IAAI,CAAC;KACtC,GAAK,kBAAkB,EAAE,gBAAgB,IAAI,CAAC;KAC9C,GAAK,eAAe,EAAE,aAAa,IAAI,CAAC;KAC1B;KACd,GAAK,qBAAqB,EAAE,mBAAmB,IAAI,CAAC;IACrD,GA3BM,OAAO,KAAK,CA2BlB,CACF;GACE,CAAA;GAEN,iBAAiB,QAAQ,kBAAkB,SAC1C,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;IACE,WAAU;IACV,OAAO,EAAE,aAAa,GAAG,QAAQ,WAAW,gBAAgB,sBAAsB,IAAI;IACtF,UAAU,MAAM,EAAE,gBAAgB;IAClC,YAAY,MAAM,EAAE,gBAAgB;IAEnC,UAAA;GACE,CAAA;EAEJ;;AAET"}
|
package/dist/data/TreeNode.d.ts
CHANGED
|
@@ -60,6 +60,10 @@ export type TreeNodeProps<T> = {
|
|
|
60
60
|
* and reopened. Required for any node `hasMoreChildren` returns true for.
|
|
61
61
|
*/
|
|
62
62
|
loadChildren?: (node: T) => Promise<T[]>;
|
|
63
|
+
/** Refresh lazy children on each manual reopen, retaining the row and its children while loading. */
|
|
64
|
+
reloadOnOpen?: boolean;
|
|
65
|
+
/** Host-controlled invalidation; open nodes refresh when their version changes. */
|
|
66
|
+
getChildrenVersion?: (node: T) => string | number;
|
|
63
67
|
/**
|
|
64
68
|
* Marks a node as a **secondary child** of its parent. Secondary
|
|
65
69
|
* children keep the full tree structure (they render, they can be
|
|
@@ -78,5 +82,5 @@ export type TreeNodeProps<T> = {
|
|
|
78
82
|
*/
|
|
79
83
|
isSecondary?: (node: T) => boolean;
|
|
80
84
|
};
|
|
81
|
-
export declare function TreeNode<T>({ node, depth, expandAll, forcedOpenKeys, revealPath, revealOverrides, onRevealToggle, selected, defaultOpen, getExpanded, onExpandedChange, getChildren, getKey, getAriaLabel, onSelect, renderRow, renderDetail, renderAfterChildren, rowClass, indentPx, basePaddingPx, isSecondary, hasMoreChildren, loadChildren, }: TreeNodeProps<T>): import("react").JSX.Element;
|
|
85
|
+
export declare function TreeNode<T>({ node, depth, expandAll, forcedOpenKeys, revealPath, revealOverrides, onRevealToggle, selected, defaultOpen, getExpanded, onExpandedChange, getChildren, getKey, getAriaLabel, onSelect, renderRow, renderDetail, renderAfterChildren, rowClass, indentPx, basePaddingPx, isSecondary, hasMoreChildren, loadChildren, reloadOnOpen, getChildrenVersion, }: TreeNodeProps<T>): import("react").JSX.Element;
|
|
82
86
|
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.d.ts","sourceRoot":"","sources":["../../src/data/TreeNode.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUpE,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;IAC9B,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,+EAA+E;IAC/E,OAAO,EAAE,OAAO,CAAC;IACjB,8EAA8E;IAC9E,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;IAC7B,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC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AE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACzC,qGAAqG;IACrG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;IAClD;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;CACpC,CAAC;AASF,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAC1B,IAAI,EACJ,KAAS,EACT,SAAgB,EAChB,cAAqB,EACrB,UAAiB,EACjB,eAAsB,EACtB,cAAc,EACd,QAAe,EACf,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,QAAQ,EACR,QAAa,EACb,aAAiB,EACjB,WAAW,EACX,eAAe,EACf,YAAY,EACZ,YAAoB,EACpB,kBAAkB,GACnB,EAAE,aAAa,CAAC,CAAC,CAAC,+BA0PlB"}
|
package/dist/data/TreeNode.js
CHANGED
|
@@ -6,16 +6,22 @@ import { useEffect, useRef, useState } from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
// src/data/TreeNode.tsx
|
|
8
8
|
var ROW_CONTENT_OFFSET_PX = 18;
|
|
9
|
-
function
|
|
9
|
+
function mergeChildrenByKey(loaded, sync, getKey) {
|
|
10
|
+
if (!sync?.length) return loaded;
|
|
11
|
+
const current = new Map(sync.map((child) => [getKey(child), child]));
|
|
12
|
+
const loadedKeys = new Set(loaded.map(getKey));
|
|
13
|
+
return [...loaded.map((child) => current.get(getKey(child)) ?? child), ...sync.filter((child) => !loadedKeys.has(getKey(child)))];
|
|
14
|
+
}
|
|
15
|
+
function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, revealPath = null, revealOverrides = null, onRevealToggle, selected = null, defaultOpen, getExpanded, onExpandedChange, getChildren, getKey, getAriaLabel, onSelect, renderRow, renderDetail, renderAfterChildren, rowClass, indentPx = 16, basePaddingPx = 8, isSecondary, hasMoreChildren, loadChildren, reloadOnOpen = false, getChildrenVersion }) {
|
|
10
16
|
if (getExpanded && !onExpandedChange) throw new Error("Controlled tree expansion requires onExpandedChange");
|
|
11
17
|
const [loadedChildren, setLoadedChildren] = useState(null);
|
|
12
18
|
const [loading, setLoading] = useState(false);
|
|
13
19
|
const [error, setError] = useState(null);
|
|
14
20
|
const syncChildren = getChildren(node);
|
|
15
|
-
const children = loadedChildren
|
|
21
|
+
const children = loadedChildren === null ? syncChildren : mergeChildrenByKey(loadedChildren, syncChildren, getKey);
|
|
16
22
|
const hasChildren = (children?.length ?? 0) > 0;
|
|
17
23
|
const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;
|
|
18
|
-
const expandable = hasChildren || lazyUnloaded;
|
|
24
|
+
const expandable = hasChildren || lazyUnloaded || Boolean(reloadOnOpen && hasMoreChildren?.(node));
|
|
19
25
|
const secondaryNode = isSecondary?.(node) ?? false;
|
|
20
26
|
const childrenAllSecondary = hasChildren && isSecondary != null && children.every((c) => isSecondary(c));
|
|
21
27
|
const skipExpandAll = secondaryNode || childrenAllSecondary || expandAll === true && lazyUnloaded;
|
|
@@ -28,8 +34,8 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
28
34
|
const revealNextKey = revealPath?.get(key) ?? null;
|
|
29
35
|
const isOnRevealPath = revealNextKey !== null;
|
|
30
36
|
const revealOverride = revealOverrides?.get(key);
|
|
31
|
-
const pathOnly = isOnRevealPath && revealOverride === void 0;
|
|
32
37
|
const ownOpen = getExpanded ? getExpanded(node) : open;
|
|
38
|
+
const pathOnly = isOnRevealPath && revealOverride === void 0 && !ownOpen;
|
|
33
39
|
const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);
|
|
34
40
|
useEffect(() => {
|
|
35
41
|
if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {
|
|
@@ -47,18 +53,22 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
47
53
|
const loadRequested = useRef(false);
|
|
48
54
|
const nodeKey = getKey(node);
|
|
49
55
|
const loadKeyRef = useRef(nodeKey);
|
|
56
|
+
const loadGeneration = useRef(0);
|
|
57
|
+
const childrenVersion = getChildrenVersion?.(node);
|
|
58
|
+
const previousChildrenVersion = useRef(childrenVersion);
|
|
50
59
|
function loadLazyChildren() {
|
|
51
60
|
if (!loadChildren || loadRequested.current) return;
|
|
52
61
|
loadRequested.current = true;
|
|
62
|
+
const generation = ++loadGeneration.current;
|
|
53
63
|
loadKeyRef.current = nodeKey;
|
|
54
64
|
setLoading(true);
|
|
55
65
|
setError(null);
|
|
56
66
|
loadChildren(node).then((kids) => {
|
|
57
|
-
if (loadKeyRef.current !== nodeKey) return;
|
|
67
|
+
if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;
|
|
58
68
|
setLoadedChildren(kids);
|
|
59
69
|
setLoading(false);
|
|
60
70
|
}).catch((err) => {
|
|
61
|
-
if (loadKeyRef.current !== nodeKey) return;
|
|
71
|
+
if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;
|
|
62
72
|
loadRequested.current = false;
|
|
63
73
|
setError(err);
|
|
64
74
|
setLoading(false);
|
|
@@ -71,17 +81,28 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
71
81
|
lazyUnloaded,
|
|
72
82
|
error
|
|
73
83
|
]);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (!getChildrenVersion || previousChildrenVersion.current === childrenVersion) return;
|
|
86
|
+
previousChildrenVersion.current = childrenVersion;
|
|
87
|
+
loadRequested.current = false;
|
|
88
|
+
if (isOpen && hasMoreChildren?.(node)) loadLazyChildren();
|
|
89
|
+
}, [childrenVersion]);
|
|
90
|
+
useEffect(() => () => {
|
|
91
|
+
loadGeneration.current++;
|
|
92
|
+
loadRequested.current = false;
|
|
93
|
+
}, []);
|
|
74
94
|
function toggle() {
|
|
75
95
|
if (!expandable) return;
|
|
76
96
|
if (isOnRevealPath) {
|
|
77
97
|
if (!onRevealToggle) throw new Error("A revealed tree path requires onRevealToggle");
|
|
78
|
-
const next = pathOnly || !revealOverride;
|
|
98
|
+
const next = pathOnly || !(revealOverride ?? ownOpen);
|
|
79
99
|
if (next && lazyUnloaded) loadLazyChildren();
|
|
80
100
|
onRevealToggle(key, next);
|
|
81
101
|
return;
|
|
82
102
|
}
|
|
83
103
|
const next = !ownOpen;
|
|
84
|
-
if (next &&
|
|
104
|
+
if (next && reloadOnOpen && hasMoreChildren?.(node)) loadRequested.current = false;
|
|
105
|
+
if (next && (lazyUnloaded || reloadOnOpen)) loadLazyChildren();
|
|
85
106
|
if (getExpanded) onExpandedChange(node, next);
|
|
86
107
|
else setOpen(next);
|
|
87
108
|
}
|
|
@@ -161,7 +182,9 @@ function TreeNode({ node, depth = 0, expandAll = null, forcedOpenKeys = null, re
|
|
|
161
182
|
...rowClass ? { rowClass } : {},
|
|
162
183
|
...isSecondary ? { isSecondary } : {},
|
|
163
184
|
...hasMoreChildren ? { hasMoreChildren } : {},
|
|
164
|
-
...loadChildren ? { loadChildren } : {}
|
|
185
|
+
...loadChildren ? { loadChildren } : {},
|
|
186
|
+
reloadOnOpen,
|
|
187
|
+
...getChildrenVersion ? { getChildrenVersion } : {}
|
|
165
188
|
}, getKey(child)))
|
|
166
189
|
}),
|
|
167
190
|
afterChildren != null && afterChildren !== false && /* @__PURE__ */ jsx("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.js","names":[],"sources":["../../src/data/TreeNode.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiChevronDown, UiChevronRight } from \"../icons\";\n\n// A row's content column starts after the chevron (`w-3`, 12px) plus the row's\n// `gap-1.5` (6px) — fixed regardless of indentPx/basePaddingPx, since the\n// chevron/spacer width and gap are not configurable. renderDetail's wrapper\n// adds this on top of the row's own paddingLeft so it lines up under the label.\nconst ROW_CONTENT_OFFSET_PX = 18;\nexport type TreeKey = string | number;\n\nexport type TreeRowContext<T> = {\n node: T;\n depth: number;\n open: boolean;\n selected: boolean;\n hasChildren: boolean;\n toggle: () => void;\n /** True while this node's lazy children are being fetched via loadChildren. */\n loading: boolean;\n /** The rejection value from loadChildren, or null when there was no error. */\n error: unknown;\n};\n\nexport type TreeNodeProps<T> = {\n node: T;\n depth?: number;\n expandAll?: boolean | null;\n forcedOpenKeys?: Set<string | number> | null;\n revealPath?: Map<TreeKey, TreeKey | null> | null;\n revealOverrides?: Map<TreeKey, boolean> | null;\n onRevealToggle?: (key: TreeKey, open: boolean) => void;\n selected?: T | null;\n defaultOpen?: (node: T, depth: number) => boolean;\n /** Controlled expansion, shared between tree instances. Requires onExpandedChange. */\n getExpanded?: (node: T) => boolean;\n /** Receives user and bulk expansion changes for controlled trees. */\n onExpandedChange?: (node: T, expanded: boolean) => void;\n getChildren: (node: T) => T[] | undefined;\n getKey: (node: T) => string | number;\n getAriaLabel?: (node: T) => string;\n onSelect?: (node: T) => void;\n renderRow: (ctx: TreeRowContext<T>) => ReactNode;\n /**\n * Render extra content beneath a node's row and above its children (e.g. the\n * decompiled source line a call was made from). Rendered for leaf and parent\n * nodes alike, regardless of open/collapsed state, and left-aligned with the\n * row's content column (after the depth indent and chevron). Returning\n * `null`/`undefined`/`false` renders nothing — no wrapper, no extra spacing.\n * A click or keydown inside it is stopped from propagating, so it can never\n * toggle the row's expand/collapse state.\n */\n renderDetail?: (node: T) => ReactNode;\n /** Render a node's result after its children, including when the children are collapsed. */\n renderAfterChildren?: (node: T) => ReactNode;\n rowClass?: (node: T, selected: boolean) => string;\n indentPx?: number;\n basePaddingPx?: number;\n /**\n * Reports that a node has children that are not yet loaded — it renders an\n * expand chevron even when `getChildren` returns nothing. On the first open\n * the node fetches them via `loadChildren`. Without this (the default), a\n * node is expandable only when `getChildren` already returns children.\n */\n hasMoreChildren?: (node: T) => boolean;\n /**\n * Lazily fetch a node's children the first time it is opened. Resolves to the\n * child nodes (which may themselves be lazy). A rejection is surfaced to\n * `renderRow` via `ctx.error` and is not retried until the node is collapsed\n * and reopened. Required for any node `hasMoreChildren` returns true for.\n */\n loadChildren?: (node: T) => Promise<T[]>;\n /**\n * Marks a node as a **secondary child** of its parent. Secondary\n * children keep the full tree structure (they render, they can be\n * opened manually) but opt out of the bulk behaviours a caller\n * typically wants when they click the toolbar:\n *\n * - Tree-wide filter: their text is skipped during match detection\n * so typing in the search box never surfaces a row because one\n * of its secondary children happened to match.\n * - Expand all: secondary nodes stay at their default-open state\n * instead of being forced open, preventing 28k field rows from\n * flooding the viewport when an operator hits the button on a\n * schema with hundreds of tables.\n *\n * Default: every node is primary (returns false).\n */\n isSecondary?: (node: T) => boolean;\n};\n\nexport function TreeNode<T>({\n node,\n depth = 0,\n expandAll = null,\n forcedOpenKeys = null,\n revealPath = null,\n revealOverrides = null,\n onRevealToggle,\n selected = null,\n defaultOpen,\n getExpanded,\n onExpandedChange,\n getChildren,\n getKey,\n getAriaLabel,\n onSelect,\n renderRow,\n renderDetail,\n renderAfterChildren,\n rowClass,\n indentPx = 16,\n basePaddingPx = 8,\n isSecondary,\n hasMoreChildren,\n loadChildren,\n}: TreeNodeProps<T>) {\n if (getExpanded && !onExpandedChange) throw new Error(\"Controlled tree expansion requires onExpandedChange\");\n // Lazily-fetched children take precedence over the synchronous ones once a\n // load has resolved; until then `loadedChildren` is null and we fall back to\n // getChildren. A node can be \"lazy\" (hasMoreChildren) with no sync children.\n const [loadedChildren, setLoadedChildren] = useState<T[] | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const syncChildren = getChildren(node);\n const children = loadedChildren ?? syncChildren;\n const hasChildren = (children?.length ?? 0) > 0;\n const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;\n // The chevron shows when there is something to reveal: either real children\n // are present, or the node is lazy and has not been loaded yet.\n const expandable = hasChildren || lazyUnloaded;\n // A node opts out of bulk expand-all in two distinct cases:\n //\n // 1. The node itself is secondary (its edge from the parent is\n // secondary) — rare at the root, but the rule is symmetric.\n // 2. All of the node's children are secondary — the common case.\n // This is what keeps an \"Expand all\" on a schema tree from\n // flooding the viewport with every table's field rows: the\n // table opens to nothing structural worth seeing in bulk, so\n // we leave it closed until the operator clicks it manually.\n //\n // In both cases the manual toggle still works, and filter matches\n // still force the row open via forcedOpenKeys, so users never\n // lose access — they just don't get auto-flooded.\n const secondaryNode = isSecondary?.(node) ?? false;\n const childrenAllSecondary =\n hasChildren && isSecondary != null && children!.every((c) => isSecondary(c));\n // An unloaded lazy node never opens in bulk either: opening it would fetch,\n // and bulk operations never trigger loads. Collapse-all still closes it.\n const skipExpandAll = secondaryNode || childrenAllSecondary || (expandAll === true && lazyUnloaded);\n // A non-null `expandAll` is a live bulk state, not just a one-off change\n // signal: a node mounted *while* expand-all is active (because an ancestor\n // just opened) inherits it as its initial open state, so opening a parent\n // cascades all the way down — expand/collapse-all are recursive. The\n // skipExpandAll guard keeps secondary subtrees from auto-flooding. When\n // expandAll is null (before any toolbar click) we fall back to defaultOpen.\n const initialOpen =\n expandAll !== null && !skipExpandAll\n ? expandAll\n : defaultOpen\n ? defaultOpen(node, depth)\n : depth < 1;\n const [open, setOpen] = useState(initialOpen);\n const prevExpandAll = useRef(getExpanded ? null : expandAll);\n const key = getKey(node);\n const isSelected = selected != null && getKey(selected) === key;\n const isForcedOpen = forcedOpenKeys?.has(key) ?? false;\n // Only the selection's ancestors are on the reveal path; the selected node\n // itself (mapped to null) keeps its own expansion.\n const revealNextKey = revealPath?.get(key) ?? null;\n const isOnRevealPath = revealNextKey !== null;\n const revealOverride = revealOverrides?.get(key);\n const pathOnly = isOnRevealPath && revealOverride === undefined;\n const ownOpen = getExpanded ? getExpanded(node) : open;\n const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);\n\n useEffect(() => {\n if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {\n if (getExpanded) onExpandedChange!(node, expandAll);\n else setOpen(expandAll);\n }\n prevExpandAll.current = expandAll;\n }, [expandAll, skipExpandAll, getExpanded, onExpandedChange, node]);\n\n // Guards a lazy fetch so a node loads its children at most once per mount and\n // a resolution arriving after the node was reused (key changed) is ignored.\n const loadRequested = useRef(false);\n const nodeKey = getKey(node);\n const loadKeyRef = useRef(nodeKey);\n\n function loadLazyChildren() {\n if (!loadChildren || loadRequested.current) return;\n loadRequested.current = true;\n loadKeyRef.current = nodeKey;\n setLoading(true);\n setError(null);\n loadChildren(node)\n .then((kids) => {\n if (loadKeyRef.current !== nodeKey) return;\n setLoadedChildren(kids);\n setLoading(false);\n })\n .catch((err) => {\n if (loadKeyRef.current !== nodeKey) return;\n // Surfaced to renderRow via ctx.error; allow a retry on re-toggle.\n loadRequested.current = false;\n setError(err);\n setLoading(false);\n });\n }\n\n // A lazy node can be open without ever having been clicked — defaultOpen said\n // so, expand-all did, or the filter forced it open to reveal a match. Loading\n // only on the open transition would leave every one of those showing a caret\n // over nothing.\n //\n // A node that already failed is skipped: loadLazyChildren clears its own retry\n // guard on failure so a re-toggle can try again, and re-running here would\n // turn that into an unbounded retry loop instead.\n useEffect(() => {\n if (isOpen && lazyUnloaded && error === null) loadLazyChildren();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, lazyUnloaded, error]);\n\n function toggle() {\n if (!expandable) return;\n if (isOnRevealPath) {\n if (!onRevealToggle) throw new Error(\"A revealed tree path requires onRevealToggle\");\n const next = pathOnly || !revealOverride;\n if (next && lazyUnloaded) loadLazyChildren();\n onRevealToggle(key, next);\n return;\n }\n const next = !ownOpen;\n if (next && lazyUnloaded) loadLazyChildren();\n if (getExpanded) onExpandedChange!(node, next);\n else setOpen(next);\n }\n\n const defaultRowBg = isSelected ? \"bg-primary/10 border-l-2 border-primary\" : \"hover:bg-accent\";\n const rowClassName = rowClass ? rowClass(node, isSelected) : defaultRowBg;\n const detail = renderDetail?.(node);\n const afterChildren = renderAfterChildren?.(node);\n\n return (\n <div\n role=\"treeitem\"\n aria-label={getAriaLabel?.(node)}\n aria-expanded={expandable ? isOpen : undefined}\n aria-selected={isSelected}\n >\n <div\n className={cn(\"flex items-center gap-1.5 py-1 px-2 cursor-pointer text-sm\", rowClassName)}\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx}px` }}\n onClick={(e) => {\n e.stopPropagation();\n onSelect?.(node);\n toggle();\n }}\n >\n {expandable ? (\n <button\n type=\"button\"\n aria-label={pathOnly ? \"Show all children\" : isOpen ? \"Collapse\" : \"Expand\"}\n // The caret only toggles expansion — stopPropagation keeps the row's\n // onClick (which selects) from firing, so expanding a node never\n // selects it.\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n className=\"flex shrink-0 items-center text-muted-foreground\"\n >\n <Icon icon={isOpen && !pathOnly ? UiChevronDown : UiChevronRight} className=\"text-xs w-3\" />\n </button>\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n {renderRow({\n node,\n depth,\n open: isOpen,\n selected: isSelected,\n hasChildren,\n toggle,\n loading,\n error,\n })}\n </div>\n {detail != null && detail !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {detail}\n </div>\n )}\n {isOpen && hasChildren && (\n <div role=\"group\">\n {(pathOnly ? children!.filter((child) => getKey(child) === revealNextKey) : children!).map((child) => (\n <TreeNode\n key={getKey(child)}\n node={child}\n depth={depth + 1}\n expandAll={expandAll}\n forcedOpenKeys={forcedOpenKeys}\n revealPath={revealPath}\n revealOverrides={revealOverrides}\n {...(onRevealToggle ? { onRevealToggle } : {})}\n selected={selected}\n getChildren={getChildren}\n getKey={getKey}\n renderRow={renderRow}\n indentPx={indentPx}\n basePaddingPx={basePaddingPx}\n {...(defaultOpen ? { defaultOpen } : {})}\n {...(getExpanded ? { getExpanded } : {})}\n {...(onExpandedChange ? { onExpandedChange } : {})}\n {...(renderDetail ? { renderDetail } : {})}\n {...(renderAfterChildren ? { renderAfterChildren } : {})}\n {...(getAriaLabel ? { getAriaLabel } : {})}\n {...(onSelect ? { onSelect } : {})}\n {...(rowClass ? { rowClass } : {})}\n {...(isSecondary ? { isSecondary } : {})}\n {...(hasMoreChildren ? { hasMoreChildren } : {})}\n {...(loadChildren ? { loadChildren } : {})}\n />\n ))}\n </div>\n )}\n {afterChildren != null && afterChildren !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {afterChildren}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AASA,IAAM,wBAAwB;AAmF9B,SAAgB,SAAY,EAC1B,MACA,QAAQ,GACR,YAAY,MACZ,iBAAiB,MACjB,aAAa,MACb,kBAAkB,MAClB,gBACA,WAAW,MACX,aACA,aACA,kBACA,aACA,QACA,cACA,UACA,WACA,cACA,qBACA,UACA,WAAW,IACX,gBAAgB,GAChB,aACA,iBACA,gBACmB;CACnB,IAAI,eAAe,CAAC,kBAAkB,MAAM,IAAI,MAAM,qDAAqD;CAI3G,MAAM,CAAC,gBAAgB,qBAAqB,SAAqB,IAAI;CACrE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,OAAO,YAAY,SAAkB,IAAI;CAChD,MAAM,eAAe,YAAY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gB,IAAI,CAAC;KAC9C,GAAK,eAAe,EAAE,aAAa,IAAI,CAAC;IACzC,GAzBM,OAAO,KAAK,CAyBlB,CACF;GACE,CAAA;GAEN,iBAAiB,QAAQ,kBAAkB,SAC1C,oBAAC,OAAD;IACE,WAAU;IACV,OAAO,EAAE,aAAa,GAAG,QAAQ,WAAW,gBAAgB,sBAAsB,IAAI;IACtF,UAAU,MAAM,EAAE,gBAAgB;IAClC,YAAY,MAAM,EAAE,gBAAgB;IAEnC,UAAA;GACE,CAAA;EAEJ;;AAET"}
|
|
1
|
+
{"version":3,"file":"TreeNode.js","names":[],"sources":["../../src/data/TreeNode.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { cn } from \"../lib/utils\";\nimport { Icon } from \"./Icon\";\nimport { UiChevronDown, UiChevronRight } from \"../icons\";\n\n// A row's content column starts after the chevron (`w-3`, 12px) plus the row's\n// `gap-1.5` (6px) — fixed regardless of indentPx/basePaddingPx, since the\n// chevron/spacer width and gap are not configurable. renderDetail's wrapper\n// adds this on top of the row's own paddingLeft so it lines up under the label.\nconst ROW_CONTENT_OFFSET_PX = 18;\nexport type TreeKey = string | number;\n\nexport type TreeRowContext<T> = {\n node: T;\n depth: number;\n open: boolean;\n selected: boolean;\n hasChildren: boolean;\n toggle: () => void;\n /** True while this node's lazy children are being fetched via loadChildren. */\n loading: boolean;\n /** The rejection value from loadChildren, or null when there was no error. */\n error: unknown;\n};\n\nexport type TreeNodeProps<T> = {\n node: T;\n depth?: number;\n expandAll?: boolean | null;\n forcedOpenKeys?: Set<string | number> | null;\n revealPath?: Map<TreeKey, TreeKey | null> | null;\n revealOverrides?: Map<TreeKey, boolean> | null;\n onRevealToggle?: (key: TreeKey, open: boolean) => void;\n selected?: T | null;\n defaultOpen?: (node: T, depth: number) => boolean;\n /** Controlled expansion, shared between tree instances. Requires onExpandedChange. */\n getExpanded?: (node: T) => boolean;\n /** Receives user and bulk expansion changes for controlled trees. */\n onExpandedChange?: (node: T, expanded: boolean) => void;\n getChildren: (node: T) => T[] | undefined;\n getKey: (node: T) => string | number;\n getAriaLabel?: (node: T) => string;\n onSelect?: (node: T) => void;\n renderRow: (ctx: TreeRowContext<T>) => ReactNode;\n /**\n * Render extra content beneath a node's row and above its children (e.g. the\n * decompiled source line a call was made from). Rendered for leaf and parent\n * nodes alike, regardless of open/collapsed state, and left-aligned with the\n * row's content column (after the depth indent and chevron). Returning\n * `null`/`undefined`/`false` renders nothing — no wrapper, no extra spacing.\n * A click or keydown inside it is stopped from propagating, so it can never\n * toggle the row's expand/collapse state.\n */\n renderDetail?: (node: T) => ReactNode;\n /** Render a node's result after its children, including when the children are collapsed. */\n renderAfterChildren?: (node: T) => ReactNode;\n rowClass?: (node: T, selected: boolean) => string;\n indentPx?: number;\n basePaddingPx?: number;\n /**\n * Reports that a node has children that are not yet loaded — it renders an\n * expand chevron even when `getChildren` returns nothing. On the first open\n * the node fetches them via `loadChildren`. Without this (the default), a\n * node is expandable only when `getChildren` already returns children.\n */\n hasMoreChildren?: (node: T) => boolean;\n /**\n * Lazily fetch a node's children the first time it is opened. Resolves to the\n * child nodes (which may themselves be lazy). A rejection is surfaced to\n * `renderRow` via `ctx.error` and is not retried until the node is collapsed\n * and reopened. Required for any node `hasMoreChildren` returns true for.\n */\n loadChildren?: (node: T) => Promise<T[]>;\n /** Refresh lazy children on each manual reopen, retaining the row and its children while loading. */\n reloadOnOpen?: boolean;\n /** Host-controlled invalidation; open nodes refresh when their version changes. */\n getChildrenVersion?: (node: T) => string | number;\n /**\n * Marks a node as a **secondary child** of its parent. Secondary\n * children keep the full tree structure (they render, they can be\n * opened manually) but opt out of the bulk behaviours a caller\n * typically wants when they click the toolbar:\n *\n * - Tree-wide filter: their text is skipped during match detection\n * so typing in the search box never surfaces a row because one\n * of its secondary children happened to match.\n * - Expand all: secondary nodes stay at their default-open state\n * instead of being forced open, preventing 28k field rows from\n * flooding the viewport when an operator hits the button on a\n * schema with hundreds of tables.\n *\n * Default: every node is primary (returns false).\n */\n isSecondary?: (node: T) => boolean;\n};\n\nfunction mergeChildrenByKey<T>(loaded: T[], sync: T[] | undefined, getKey: (node: T) => TreeKey): T[] {\n if (!sync?.length) return loaded;\n const current = new Map(sync.map((child) => [getKey(child), child]));\n const loadedKeys = new Set(loaded.map(getKey));\n return [...loaded.map((child) => current.get(getKey(child)) ?? child), ...sync.filter((child) => !loadedKeys.has(getKey(child)))];\n}\n\nexport function TreeNode<T>({\n node,\n depth = 0,\n expandAll = null,\n forcedOpenKeys = null,\n revealPath = null,\n revealOverrides = null,\n onRevealToggle,\n selected = null,\n defaultOpen,\n getExpanded,\n onExpandedChange,\n getChildren,\n getKey,\n getAriaLabel,\n onSelect,\n renderRow,\n renderDetail,\n renderAfterChildren,\n rowClass,\n indentPx = 16,\n basePaddingPx = 8,\n isSecondary,\n hasMoreChildren,\n loadChildren,\n reloadOnOpen = false,\n getChildrenVersion,\n}: TreeNodeProps<T>) {\n if (getExpanded && !onExpandedChange) throw new Error(\"Controlled tree expansion requires onExpandedChange\");\n // Lazily-fetched children are the base set once a load has resolved; until\n // then `loadedChildren` is null and we use getChildren. A node can be \"lazy\"\n // (hasMoreChildren) with no sync children. The loaded copy is a snapshot, so\n // the host's current sync children win by key (fresh `active`, `to`, ...) and\n // sync-only children are appended rather than hidden behind the stale snapshot.\n const [loadedChildren, setLoadedChildren] = useState<T[] | null>(null);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<unknown>(null);\n const syncChildren = getChildren(node);\n const children = loadedChildren === null ? syncChildren : mergeChildrenByKey(loadedChildren, syncChildren, getKey);\n const hasChildren = (children?.length ?? 0) > 0;\n const lazyUnloaded = (hasMoreChildren?.(node) ?? false) && loadedChildren === null;\n // The chevron shows when there is something to reveal: either real children\n // are present, or the node is lazy and has not been loaded yet.\n const expandable = hasChildren || lazyUnloaded || Boolean(reloadOnOpen && hasMoreChildren?.(node));\n // A node opts out of bulk expand-all in two distinct cases:\n //\n // 1. The node itself is secondary (its edge from the parent is\n // secondary) — rare at the root, but the rule is symmetric.\n // 2. All of the node's children are secondary — the common case.\n // This is what keeps an \"Expand all\" on a schema tree from\n // flooding the viewport with every table's field rows: the\n // table opens to nothing structural worth seeing in bulk, so\n // we leave it closed until the operator clicks it manually.\n //\n // In both cases the manual toggle still works, and filter matches\n // still force the row open via forcedOpenKeys, so users never\n // lose access — they just don't get auto-flooded.\n const secondaryNode = isSecondary?.(node) ?? false;\n const childrenAllSecondary =\n hasChildren && isSecondary != null && children!.every((c) => isSecondary(c));\n // An unloaded lazy node never opens in bulk either: opening it would fetch,\n // and bulk operations never trigger loads. Collapse-all still closes it.\n const skipExpandAll = secondaryNode || childrenAllSecondary || (expandAll === true && lazyUnloaded);\n // A non-null `expandAll` is a live bulk state, not just a one-off change\n // signal: a node mounted *while* expand-all is active (because an ancestor\n // just opened) inherits it as its initial open state, so opening a parent\n // cascades all the way down — expand/collapse-all are recursive. The\n // skipExpandAll guard keeps secondary subtrees from auto-flooding. When\n // expandAll is null (before any toolbar click) we fall back to defaultOpen.\n const initialOpen =\n expandAll !== null && !skipExpandAll\n ? expandAll\n : defaultOpen\n ? defaultOpen(node, depth)\n : depth < 1;\n const [open, setOpen] = useState(initialOpen);\n const prevExpandAll = useRef(getExpanded ? null : expandAll);\n const key = getKey(node);\n const isSelected = selected != null && getKey(selected) === key;\n const isForcedOpen = forcedOpenKeys?.has(key) ?? false;\n // Only the selection's ancestors are on the reveal path; the selected node\n // itself (mapped to null) keeps its own expansion.\n const revealNextKey = revealPath?.get(key) ?? null;\n const isOnRevealPath = revealNextKey !== null;\n const revealOverride = revealOverrides?.get(key);\n const ownOpen = getExpanded ? getExpanded(node) : open;\n // An ancestor that is already open keeps all its children; only a closed one\n // opens to just the next path node.\n const pathOnly = isOnRevealPath && revealOverride === undefined && !ownOpen;\n const isOpen = isForcedOpen || pathOnly || (revealOverride ?? ownOpen);\n\n useEffect(() => {\n if (expandAll !== null && expandAll !== prevExpandAll.current && !skipExpandAll) {\n if (getExpanded) onExpandedChange!(node, expandAll);\n else setOpen(expandAll);\n }\n prevExpandAll.current = expandAll;\n }, [expandAll, skipExpandAll, getExpanded, onExpandedChange, node]);\n\n // Guards a lazy fetch so a node loads its children at most once per mount and\n // a resolution arriving after the node was reused (key changed) is ignored.\n const loadRequested = useRef(false);\n const nodeKey = getKey(node);\n const loadKeyRef = useRef(nodeKey);\n const loadGeneration = useRef(0);\n const childrenVersion = getChildrenVersion?.(node);\n const previousChildrenVersion = useRef(childrenVersion);\n\n function loadLazyChildren() {\n if (!loadChildren || loadRequested.current) return;\n loadRequested.current = true;\n const generation = ++loadGeneration.current;\n loadKeyRef.current = nodeKey;\n setLoading(true);\n setError(null);\n loadChildren(node)\n .then((kids) => {\n if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;\n setLoadedChildren(kids);\n setLoading(false);\n })\n .catch((err) => {\n if (loadKeyRef.current !== nodeKey || generation !== loadGeneration.current) return;\n // Surfaced to renderRow via ctx.error; allow a retry on re-toggle.\n loadRequested.current = false;\n setError(err);\n setLoading(false);\n });\n }\n\n // A lazy node can be open without ever having been clicked — defaultOpen said\n // so, expand-all did, or the filter forced it open to reveal a match. Loading\n // only on the open transition would leave every one of those showing a caret\n // over nothing.\n //\n // A node that already failed is skipped: loadLazyChildren clears its own retry\n // guard on failure so a re-toggle can try again, and re-running here would\n // turn that into an unbounded retry loop instead.\n useEffect(() => {\n if (isOpen && lazyUnloaded && error === null) loadLazyChildren();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, lazyUnloaded, error]);\n\n useEffect(() => {\n if (!getChildrenVersion || previousChildrenVersion.current === childrenVersion) return;\n previousChildrenVersion.current = childrenVersion;\n loadRequested.current = false;\n if (isOpen && hasMoreChildren?.(node)) loadLazyChildren();\n // The host version, rather than callback identity, invalidates this node.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [childrenVersion]);\n\n useEffect(() => () => { loadGeneration.current++; loadRequested.current = false; }, []);\n\n function toggle() {\n if (!expandable) return;\n if (isOnRevealPath) {\n if (!onRevealToggle) throw new Error(\"A revealed tree path requires onRevealToggle\");\n const next = pathOnly || !(revealOverride ?? ownOpen);\n if (next && lazyUnloaded) loadLazyChildren();\n onRevealToggle(key, next);\n return;\n }\n const next = !ownOpen;\n if (next && reloadOnOpen && hasMoreChildren?.(node)) loadRequested.current = false;\n if (next && (lazyUnloaded || reloadOnOpen)) loadLazyChildren();\n if (getExpanded) onExpandedChange!(node, next);\n else setOpen(next);\n }\n\n const defaultRowBg = isSelected ? \"bg-primary/10 border-l-2 border-primary\" : \"hover:bg-accent\";\n const rowClassName = rowClass ? rowClass(node, isSelected) : defaultRowBg;\n const detail = renderDetail?.(node);\n const afterChildren = renderAfterChildren?.(node);\n\n return (\n <div\n role=\"treeitem\"\n aria-label={getAriaLabel?.(node)}\n aria-expanded={expandable ? isOpen : undefined}\n aria-selected={isSelected}\n >\n <div\n className={cn(\"flex items-center gap-1.5 py-1 px-2 cursor-pointer text-sm\", rowClassName)}\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx}px` }}\n onClick={(e) => {\n e.stopPropagation();\n onSelect?.(node);\n toggle();\n }}\n >\n {expandable ? (\n <button\n type=\"button\"\n aria-label={pathOnly ? \"Show all children\" : isOpen ? \"Collapse\" : \"Expand\"}\n // The caret only toggles expansion — stopPropagation keeps the row's\n // onClick (which selects) from firing, so expanding a node never\n // selects it.\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n className=\"flex shrink-0 items-center text-muted-foreground\"\n >\n <Icon icon={isOpen && !pathOnly ? UiChevronDown : UiChevronRight} className=\"text-xs w-3\" />\n </button>\n ) : (\n <span className=\"w-3 shrink-0\" aria-hidden />\n )}\n {renderRow({\n node,\n depth,\n open: isOpen,\n selected: isSelected,\n hasChildren,\n toggle,\n loading,\n error,\n })}\n </div>\n {detail != null && detail !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {detail}\n </div>\n )}\n {isOpen && hasChildren && (\n <div role=\"group\">\n {(pathOnly ? children!.filter((child) => getKey(child) === revealNextKey) : children!).map((child) => (\n <TreeNode\n key={getKey(child)}\n node={child}\n depth={depth + 1}\n expandAll={expandAll}\n forcedOpenKeys={forcedOpenKeys}\n revealPath={revealPath}\n revealOverrides={revealOverrides}\n {...(onRevealToggle ? { onRevealToggle } : {})}\n selected={selected}\n getChildren={getChildren}\n getKey={getKey}\n renderRow={renderRow}\n indentPx={indentPx}\n basePaddingPx={basePaddingPx}\n {...(defaultOpen ? { defaultOpen } : {})}\n {...(getExpanded ? { getExpanded } : {})}\n {...(onExpandedChange ? { onExpandedChange } : {})}\n {...(renderDetail ? { renderDetail } : {})}\n {...(renderAfterChildren ? { renderAfterChildren } : {})}\n {...(getAriaLabel ? { getAriaLabel } : {})}\n {...(onSelect ? { onSelect } : {})}\n {...(rowClass ? { rowClass } : {})}\n {...(isSecondary ? { isSecondary } : {})}\n {...(hasMoreChildren ? { hasMoreChildren } : {})}\n {...(loadChildren ? { loadChildren } : {})}\n reloadOnOpen={reloadOnOpen}\n {...(getChildrenVersion ? { getChildrenVersion } : {})}\n />\n ))}\n </div>\n )}\n {afterChildren != null && afterChildren !== false && (\n <div\n className=\"pb-1 pr-2\"\n style={{ paddingLeft: `${depth * indentPx + basePaddingPx + ROW_CONTENT_OFFSET_PX}px` }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => e.stopPropagation()}\n >\n {afterChildren}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;AASA,IAAM,wBAAwB;AAuF9B,SAAS,mBAAsB,QAAa,MAAuB,QAAmC;CACpG,IAAI,CAAC,MAAM,QAAQ,OAAO;CAC1B,MAAM,UAAU,IAAI,IAAI,KAAK,KAAK,UAAU,CAAC,OAAO,KAAK,GAAG,KAAK,CAA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AAI,CAAC;KACtC,GAAK,kBAAkB,EAAE,gBAAgB,IAAI,CAAC;KAC9C,GAAK,eAAe,EAAE,aAAa,IAAI,CAAC;KAC1B;KACd,GAAK,qBAAqB,EAAE,mBAAmB,IAAI,CAAC;IACrD,GA3BM,OAAO,KAAK,CA2BlB,CACF;GACE,CAAA;GAEN,iBAAiB,QAAQ,kBAAkB,SAC1C,oBAAC,OAAD;IACE,WAAU;IACV,OAAO,EAAE,aAAa,GAAG,QAAQ,WAAW,gBAAgB,sBAAsB,IAAI;IACtF,UAAU,MAAM,EAAE,gBAAgB;IAClC,YAAY,MAAM,EAAE,gBAAgB;IAEnC,UAAA;GACE,CAAA;EAEJ;;AAET"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_runtime_mode = require("../runtime/runtime-mode.cjs");
|
|
2
2
|
const require_SegmentedControl = require("../../components/SegmentedControl.cjs");
|
|
3
|
-
const require_effort_icons = require("../chat/effort-icons.cjs");
|
|
4
3
|
const require_provider_icons = require("../chat/provider-icons.cjs");
|
|
4
|
+
const require_effort_icons = require("../chat/effort-icons.cjs");
|
|
5
5
|
const require_RuntimeBar_model = require("../runtime/RuntimeBar.model.cjs");
|
|
6
6
|
const require_fields = require("./SpecRuntimeEditor/fields.cjs");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SPEC_RUNTIME_FAMILIES, familyById, firstMode, selectionForRuntime } from "../runtime/runtime-mode.js";
|
|
2
2
|
import { SegmentedControl } from "../../components/SegmentedControl.js";
|
|
3
|
-
import { DEFAULT_REASONING_EFFORTS } from "../chat/effort-icons.js";
|
|
4
3
|
import { providerIcon } from "../chat/provider-icons.js";
|
|
4
|
+
import { DEFAULT_REASONING_EFFORTS } from "../chat/effort-icons.js";
|
|
5
5
|
import { applyRuntimeMode } from "../runtime/RuntimeBar.model.js";
|
|
6
6
|
import { SpecField } from "./SpecRuntimeEditor/fields.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -2,8 +2,8 @@ const require_UiTimer = require("../../icons/components/UiTimer.cjs");
|
|
|
2
2
|
const require_UiRobotAi = require("../../icons/components/UiRobotAi.cjs");
|
|
3
3
|
const require_Icon = require("../Icon.cjs");
|
|
4
4
|
const require_Markdown = require("../Markdown.cjs");
|
|
5
|
-
const require_effort_icons = require("../chat/effort-icons.cjs");
|
|
6
5
|
const require_provider_icons = require("../chat/provider-icons.cjs");
|
|
6
|
+
const require_effort_icons = require("../chat/effort-icons.cjs");
|
|
7
7
|
const require_agent_action_icons = require("./agent-action-icons.cjs");
|
|
8
8
|
const require_SessionViewer_header = require("./SessionViewer.header.cjs");
|
|
9
9
|
const require_SessionViewer_model = require("./SessionViewer.model.cjs");
|