@adea-ai/ui 0.140.0 → 0.142.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/composites/appearance-editor/appearance-editor.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +56 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +117 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -0
- package/dist/components/composites/chain-of-thought/index.d.ts +2 -0
- package/dist/components/composites/chain-of-thought/index.d.ts.map +1 -0
- package/dist/components/composites/chain-of-thought/index.js +2 -0
- package/dist/components/composites/chat/chat.d.ts +67 -0
- package/dist/components/composites/chat/chat.d.ts.map +1 -0
- package/dist/components/composites/chat/chat.js +179 -0
- package/dist/components/composites/chat/chat.js.map +1 -0
- package/dist/components/composites/chat/index.d.ts +2 -0
- package/dist/components/composites/chat/index.d.ts.map +1 -0
- package/dist/components/composites/chat/index.js +2 -0
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +34 -0
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint-model.js +48 -0
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint.d.ts +48 -0
- package/dist/components/composites/checkpoint/checkpoint.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint.js +160 -0
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -0
- package/dist/components/composites/checkpoint/index.d.ts +3 -0
- package/dist/components/composites/checkpoint/index.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/index.js +3 -0
- package/dist/components/composites/confirmation/confirmation-model.d.ts +45 -0
- package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -0
- package/dist/components/composites/confirmation/confirmation-model.js +51 -0
- package/dist/components/composites/confirmation/confirmation-model.js.map +1 -0
- package/dist/components/composites/confirmation/confirmation.d.ts +72 -0
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -0
- package/dist/components/composites/confirmation/confirmation.js +300 -0
- package/dist/components/composites/confirmation/confirmation.js.map +1 -0
- package/dist/components/composites/confirmation/index.d.ts +3 -0
- package/dist/components/composites/confirmation/index.d.ts.map +1 -0
- package/dist/components/composites/confirmation/index.js +3 -0
- package/dist/components/composites/context/context-model.d.ts +69 -0
- package/dist/components/composites/context/context-model.d.ts.map +1 -0
- package/dist/components/composites/context/context-model.js +122 -0
- package/dist/components/composites/context/context-model.js.map +1 -0
- package/dist/components/composites/context/context.d.ts +38 -0
- package/dist/components/composites/context/context.d.ts.map +1 -0
- package/dist/components/composites/context/context.js +234 -0
- package/dist/components/composites/context/context.js.map +1 -0
- package/dist/components/composites/context/index.d.ts +3 -0
- package/dist/components/composites/context/index.d.ts.map +1 -0
- package/dist/components/composites/context/index.js +3 -0
- package/dist/components/composites/file-tree/build-file-tree.d.ts +138 -0
- package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -0
- package/dist/components/composites/file-tree/build-file-tree.js +325 -0
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -0
- package/dist/components/composites/file-tree/file-tree.d.ts +74 -0
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -0
- package/dist/components/composites/file-tree/file-tree.js +389 -0
- package/dist/components/composites/file-tree/file-tree.js.map +1 -0
- package/dist/components/composites/file-tree/index.d.ts +3 -0
- package/dist/components/composites/file-tree/index.d.ts.map +1 -0
- package/dist/components/composites/file-tree/index.js +3 -0
- package/dist/components/composites/inline-citation/citation.d.ts +37 -0
- package/dist/components/composites/inline-citation/citation.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/citation.js +52 -0
- package/dist/components/composites/inline-citation/citation.js.map +1 -0
- package/dist/components/composites/inline-citation/index.d.ts +3 -0
- package/dist/components/composites/inline-citation/index.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/index.js +3 -0
- package/dist/components/composites/inline-citation/inline-citation.d.ts +64 -0
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/inline-citation.js +272 -0
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -0
- package/dist/components/composites/message-scroller/index.d.ts +3 -0
- package/dist/components/composites/message-scroller/index.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/index.js +3 -0
- package/dist/components/composites/message-scroller/message-scroller.d.ts +55 -0
- package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/message-scroller.js +201 -0
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -0
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts +66 -0
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/scroll-anchor.js +122 -0
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -0
- package/dist/components/composites/model-selector/index.d.ts +3 -0
- package/dist/components/composites/model-selector/index.d.ts.map +1 -0
- package/dist/components/composites/model-selector/index.js +3 -0
- package/dist/components/composites/model-selector/model-selector.d.ts +55 -0
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -0
- package/dist/components/composites/model-selector/model-selector.js +490 -0
- package/dist/components/composites/model-selector/model-selector.js.map +1 -0
- package/dist/components/composites/model-selector/models.d.ts +51 -0
- package/dist/components/composites/model-selector/models.d.ts.map +1 -0
- package/dist/components/composites/model-selector/models.js +71 -0
- package/dist/components/composites/model-selector/models.js.map +1 -0
- package/dist/components/composites/plan/index.d.ts +2 -0
- package/dist/components/composites/plan/index.d.ts.map +1 -0
- package/dist/components/composites/plan/index.js +2 -0
- package/dist/components/composites/plan/plan.d.ts +61 -0
- package/dist/components/composites/plan/plan.d.ts.map +1 -0
- package/dist/components/composites/plan/plan.js +130 -0
- package/dist/components/composites/plan/plan.js.map +1 -0
- package/dist/components/composites/queue/index.d.ts +2 -0
- package/dist/components/composites/queue/index.d.ts.map +1 -0
- package/dist/components/composites/queue/index.js +2 -0
- package/dist/components/composites/queue/queue.d.ts +77 -0
- package/dist/components/composites/queue/queue.d.ts.map +1 -0
- package/dist/components/composites/queue/queue.js +271 -0
- package/dist/components/composites/queue/queue.js.map +1 -0
- package/dist/components/composites/reasoning/index.d.ts +2 -0
- package/dist/components/composites/reasoning/index.d.ts.map +1 -0
- package/dist/components/composites/reasoning/index.js +2 -0
- package/dist/components/composites/reasoning/reasoning.d.ts +62 -0
- package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -0
- package/dist/components/composites/reasoning/reasoning.js +156 -0
- package/dist/components/composites/reasoning/reasoning.js.map +1 -0
- package/dist/components/composites/sources/index.d.ts +3 -0
- package/dist/components/composites/sources/index.d.ts.map +1 -0
- package/dist/components/composites/sources/index.js +3 -0
- package/dist/components/composites/sources/source.d.ts +46 -0
- package/dist/components/composites/sources/source.d.ts.map +1 -0
- package/dist/components/composites/sources/source.js +74 -0
- package/dist/components/composites/sources/source.js.map +1 -0
- package/dist/components/composites/sources/sources.d.ts +45 -0
- package/dist/components/composites/sources/sources.d.ts.map +1 -0
- package/dist/components/composites/sources/sources.js +175 -0
- package/dist/components/composites/sources/sources.js.map +1 -0
- package/dist/components/composites/stack-trace/index.d.ts +3 -0
- package/dist/components/composites/stack-trace/index.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/index.js +3 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +118 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.js +376 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -0
- package/dist/components/composites/stack-trace/stack-trace.d.ts +63 -0
- package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/stack-trace.js +491 -0
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -0
- package/dist/components/composites/subagent/index.d.ts +2 -0
- package/dist/components/composites/subagent/index.d.ts.map +1 -0
- package/dist/components/composites/subagent/index.js +2 -0
- package/dist/components/composites/subagent/subagent.d.ts +55 -0
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -0
- package/dist/components/composites/subagent/subagent.js +138 -0
- package/dist/components/composites/subagent/subagent.js.map +1 -0
- package/dist/components/composites/suggestion/index.d.ts +2 -0
- package/dist/components/composites/suggestion/index.d.ts.map +1 -0
- package/dist/components/composites/suggestion/index.js +2 -0
- package/dist/components/composites/suggestion/suggestion.d.ts +37 -0
- package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -0
- package/dist/components/composites/suggestion/suggestion.js +100 -0
- package/dist/components/composites/suggestion/suggestion.js.map +1 -0
- package/dist/components/composites/task/index.d.ts +2 -0
- package/dist/components/composites/task/index.d.ts.map +1 -0
- package/dist/components/composites/task/index.js +2 -0
- package/dist/components/composites/task/task.d.ts +96 -0
- package/dist/components/composites/task/task.d.ts.map +1 -0
- package/dist/components/composites/task/task.js +311 -0
- package/dist/components/composites/task/task.js.map +1 -0
- package/dist/components/composites/terminal/ansi.d.ts +101 -0
- package/dist/components/composites/terminal/ansi.d.ts.map +1 -0
- package/dist/components/composites/terminal/ansi.js +544 -0
- package/dist/components/composites/terminal/ansi.js.map +1 -0
- package/dist/components/composites/terminal/index.d.ts +4 -0
- package/dist/components/composites/terminal/index.d.ts.map +1 -0
- package/dist/components/composites/terminal/index.js +4 -0
- package/dist/components/composites/terminal/terminal-model.d.ts +63 -0
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -0
- package/dist/components/composites/terminal/terminal-model.js +69 -0
- package/dist/components/composites/terminal/terminal-model.js.map +1 -0
- package/dist/components/composites/terminal/terminal.d.ts +88 -0
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -0
- package/dist/components/composites/terminal/terminal.js +500 -0
- package/dist/components/composites/terminal/terminal.js.map +1 -0
- package/dist/components/composites/test-results/index.d.ts +3 -0
- package/dist/components/composites/test-results/index.d.ts.map +1 -0
- package/dist/components/composites/test-results/index.js +3 -0
- package/dist/components/composites/test-results/test-results-model.d.ts +154 -0
- package/dist/components/composites/test-results/test-results-model.d.ts.map +1 -0
- package/dist/components/composites/test-results/test-results-model.js +252 -0
- package/dist/components/composites/test-results/test-results-model.js.map +1 -0
- package/dist/components/composites/test-results/test-results.d.ts +60 -0
- package/dist/components/composites/test-results/test-results.d.ts.map +1 -0
- package/dist/components/composites/test-results/test-results.js +631 -0
- package/dist/components/composites/test-results/test-results.js.map +1 -0
- package/dist/components/composites/tool/format-tool-value.d.ts +37 -0
- package/dist/components/composites/tool/format-tool-value.d.ts.map +1 -0
- package/dist/components/composites/tool/format-tool-value.js +135 -0
- package/dist/components/composites/tool/format-tool-value.js.map +1 -0
- package/dist/components/composites/tool/index.d.ts +3 -0
- package/dist/components/composites/tool/index.d.ts.map +1 -0
- package/dist/components/composites/tool/index.js +3 -0
- package/dist/components/composites/tool/tool.d.ts +69 -0
- package/dist/components/composites/tool/tool.d.ts.map +1 -0
- package/dist/components/composites/tool/tool.js +214 -0
- package/dist/components/composites/tool/tool.js.map +1 -0
- package/dist/components/composites/update-dialog/update-dialog.js +1 -1
- package/dist/components/conversation/conversation-surface.d.ts +7 -0
- package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
- package/dist/components/conversation/conversation-surface.js +2 -0
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +24 -0
- package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow-core.js +23 -1
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts +3 -0
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +80 -1
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/ui/attachment/attachment.d.ts +58 -0
- package/dist/components/ui/attachment/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment/attachment.js +279 -0
- package/dist/components/ui/attachment/attachment.js.map +1 -0
- package/dist/components/ui/attachment/index.d.ts +2 -0
- package/dist/components/ui/attachment/index.d.ts.map +1 -0
- package/dist/components/ui/attachment/index.js +2 -0
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/bubble/bubble.d.ts +33 -0
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble/bubble.js +95 -0
- package/dist/components/ui/bubble/bubble.js.map +1 -0
- package/dist/components/ui/bubble/index.d.ts +2 -0
- package/dist/components/ui/bubble/index.d.ts.map +1 -0
- package/dist/components/ui/bubble/index.js +2 -0
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/code-block/code-block.d.ts +56 -3
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +231 -50
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/code-block/index.d.ts +1 -1
- package/dist/components/ui/code-block/index.d.ts.map +1 -1
- package/dist/components/ui/code-block/index.js +2 -2
- package/dist/components/ui/field/number-field.d.ts +21 -4
- package/dist/components/ui/field/number-field.d.ts.map +1 -1
- package/dist/components/ui/field/number-field.js +22 -11
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/marker/index.d.ts +2 -0
- package/dist/components/ui/marker/index.d.ts.map +1 -0
- package/dist/components/ui/marker/index.js +2 -0
- package/dist/components/ui/marker/marker.d.ts +35 -0
- package/dist/components/ui/marker/marker.d.ts.map +1 -0
- package/dist/components/ui/marker/marker.js +123 -0
- package/dist/components/ui/marker/marker.js.map +1 -0
- package/dist/components/ui/message/cite-ranges.d.ts +42 -0
- package/dist/components/ui/message/cite-ranges.d.ts.map +1 -0
- package/dist/components/ui/message/cite-ranges.js +105 -0
- package/dist/components/ui/message/cite-ranges.js.map +1 -0
- package/dist/components/ui/message/index.d.ts +4 -0
- package/dist/components/ui/message/index.d.ts.map +1 -0
- package/dist/components/ui/message/index.js +4 -0
- package/dist/components/ui/message/message.d.ts +95 -0
- package/dist/components/ui/message/message.d.ts.map +1 -0
- package/dist/components/ui/message/message.js +443 -0
- package/dist/components/ui/message/message.js.map +1 -0
- package/dist/components/ui/message/parse-message-text.d.ts +93 -0
- package/dist/components/ui/message/parse-message-text.d.ts.map +1 -0
- package/dist/components/ui/message/parse-message-text.js +365 -0
- package/dist/components/ui/message/parse-message-text.js.map +1 -0
- package/dist/components/ui/questionnaire/index.d.ts +2 -0
- package/dist/components/ui/questionnaire/index.d.ts.map +1 -0
- package/dist/components/ui/questionnaire/index.js +2 -0
- package/dist/components/ui/questionnaire/questionnaire.d.ts +83 -0
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire/questionnaire.js +470 -0
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -0
- package/dist/components/ui/status-chip/status-chip.d.ts +1 -1
- package/dist/components/ui/switch/switch.js +11 -11
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/trace/index.d.ts +2 -0
- package/dist/components/ui/trace/index.d.ts.map +1 -0
- package/dist/components/ui/trace/index.js +2 -0
- package/dist/components/ui/trace/trace.d.ts +72 -0
- package/dist/components/ui/trace/trace.d.ts.map +1 -0
- package/dist/components/ui/trace/trace.js +340 -0
- package/dist/components/ui/trace/trace.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -5
- package/dist/r/attachment.json +25 -0
- package/dist/r/bubble.json +22 -0
- package/dist/r/chain-of-thought.json +26 -0
- package/dist/r/chat.json +24 -0
- package/dist/r/checkpoint.json +35 -0
- package/dist/r/confirmation.json +34 -0
- package/dist/r/context.json +33 -0
- package/dist/r/file-tree.json +32 -0
- package/dist/r/inline-citation.json +35 -0
- package/dist/r/marker.json +22 -0
- package/dist/r/message-scroller.json +31 -0
- package/dist/r/message.json +33 -0
- package/dist/r/model-selector.json +34 -0
- package/dist/r/plan.json +26 -0
- package/dist/r/questionnaire.json +28 -0
- package/dist/r/queue.json +26 -0
- package/dist/r/reasoning.json +26 -0
- package/dist/r/registry.json +811 -52
- package/dist/r/sources.json +32 -0
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
- package/dist/r/src/components/composites/chain-of-thought/index.ts +11 -0
- package/dist/r/src/components/composites/chat/chat.tsx +190 -0
- package/dist/r/src/components/composites/chat/index.ts +11 -0
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +214 -0
- package/dist/r/src/components/composites/checkpoint/index.ts +8 -0
- package/dist/r/src/components/composites/confirmation/confirmation-model.ts +83 -0
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +311 -0
- package/dist/r/src/components/composites/confirmation/index.ts +9 -0
- package/dist/r/src/components/composites/context/context-model.ts +168 -0
- package/dist/r/src/components/composites/context/context.tsx +187 -0
- package/dist/r/src/components/composites/context/index.ts +18 -0
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +456 -0
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +405 -0
- package/dist/r/src/components/composites/file-tree/index.ts +25 -0
- package/dist/r/src/components/composites/inline-citation/citation.ts +78 -0
- package/dist/r/src/components/composites/inline-citation/index.ts +9 -0
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +285 -0
- package/dist/r/src/components/composites/message-scroller/index.ts +2 -0
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +301 -0
- package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
- package/dist/r/src/components/composites/model-selector/index.ts +14 -0
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +420 -0
- package/dist/r/src/components/composites/model-selector/models.ts +103 -0
- package/dist/r/src/components/composites/plan/index.ts +1 -0
- package/dist/r/src/components/composites/plan/plan.tsx +155 -0
- package/dist/r/src/components/composites/queue/index.ts +10 -0
- package/dist/r/src/components/composites/queue/queue.tsx +264 -0
- package/dist/r/src/components/composites/reasoning/index.ts +1 -0
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +176 -0
- package/dist/r/src/components/composites/sources/index.ts +11 -0
- package/dist/r/src/components/composites/sources/source.ts +116 -0
- package/dist/r/src/components/composites/sources/sources.tsx +163 -0
- package/dist/r/src/components/composites/stack-trace/index.ts +19 -0
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +395 -0
- package/dist/r/src/components/composites/subagent/index.ts +1 -0
- package/dist/r/src/components/composites/subagent/subagent.tsx +159 -0
- package/dist/r/src/components/composites/suggestion/index.ts +1 -0
- package/dist/r/src/components/composites/suggestion/suggestion.tsx +140 -0
- package/dist/r/src/components/composites/task/index.ts +14 -0
- package/dist/r/src/components/composites/task/task.tsx +317 -0
- package/dist/r/src/components/composites/terminal/ansi.ts +674 -0
- package/dist/r/src/components/composites/terminal/index.ts +20 -0
- package/dist/r/src/components/composites/terminal/terminal-model.ts +111 -0
- package/dist/r/src/components/composites/terminal/terminal.tsx +574 -0
- package/dist/r/src/components/composites/test-results/index.ts +20 -0
- package/dist/r/src/components/composites/test-results/test-results-model.ts +368 -0
- package/dist/r/src/components/composites/test-results/test-results.tsx +586 -0
- package/dist/r/src/components/composites/tool/format-tool-value.ts +221 -0
- package/dist/r/src/components/composites/tool/index.ts +2 -0
- package/dist/r/src/components/composites/tool/tool.tsx +228 -0
- package/dist/r/src/components/conversation/conversation-surface.tsx +9 -0
- package/dist/r/src/components/conversation/scroll-follow-core.ts +31 -0
- package/dist/r/src/components/conversation/scroll-follow.ts +92 -0
- package/dist/r/src/components/ui/attachment/attachment.tsx +282 -0
- package/dist/r/src/components/ui/attachment/index.ts +10 -0
- package/dist/r/src/components/ui/bubble/bubble.tsx +86 -0
- package/dist/r/src/components/ui/bubble/index.ts +1 -0
- package/dist/r/src/components/ui/code-block/code-block.tsx +256 -26
- package/dist/r/src/components/ui/code-block/index.ts +9 -1
- package/dist/r/src/components/ui/field/number-field.tsx +51 -14
- package/dist/r/src/components/ui/marker/index.ts +1 -0
- package/dist/r/src/components/ui/marker/marker.tsx +90 -0
- package/dist/r/src/components/ui/message/cite-ranges.ts +144 -0
- package/dist/r/src/components/ui/message/index.ts +23 -0
- package/dist/r/src/components/ui/message/message.tsx +434 -0
- package/dist/r/src/components/ui/message/parse-message-text.ts +450 -0
- package/dist/r/src/components/ui/questionnaire/index.ts +10 -0
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +446 -0
- package/dist/r/src/components/ui/trace/index.ts +9 -0
- package/dist/r/src/components/ui/trace/trace.tsx +334 -0
- package/dist/r/src/styles/base.css +34 -0
- package/dist/r/stack-trace.json +32 -0
- package/dist/r/subagent.json +27 -0
- package/dist/r/suggestion.json +24 -0
- package/dist/r/task.json +28 -0
- package/dist/r/terminal.json +35 -0
- package/dist/r/test-results.json +33 -0
- package/dist/r/tool.json +31 -0
- package/dist/r/trace.json +25 -0
- package/package.json +6 -3
- package/registry.json +811 -52
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
- package/src/components/composites/chain-of-thought/index.ts +11 -0
- package/src/components/composites/chat/chat.tsx +190 -0
- package/src/components/composites/chat/index.ts +11 -0
- package/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
- package/src/components/composites/checkpoint/checkpoint.tsx +214 -0
- package/src/components/composites/checkpoint/index.ts +8 -0
- package/src/components/composites/confirmation/confirmation-model.ts +83 -0
- package/src/components/composites/confirmation/confirmation.tsx +311 -0
- package/src/components/composites/confirmation/index.ts +9 -0
- package/src/components/composites/context/context-model.ts +168 -0
- package/src/components/composites/context/context.tsx +187 -0
- package/src/components/composites/context/index.ts +18 -0
- package/src/components/composites/file-tree/build-file-tree.ts +456 -0
- package/src/components/composites/file-tree/file-tree.tsx +405 -0
- package/src/components/composites/file-tree/index.ts +25 -0
- package/src/components/composites/inline-citation/citation.ts +78 -0
- package/src/components/composites/inline-citation/index.ts +9 -0
- package/src/components/composites/inline-citation/inline-citation.tsx +285 -0
- package/src/components/composites/message-scroller/index.ts +2 -0
- package/src/components/composites/message-scroller/message-scroller.tsx +301 -0
- package/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
- package/src/components/composites/model-selector/index.ts +14 -0
- package/src/components/composites/model-selector/model-selector.tsx +420 -0
- package/src/components/composites/model-selector/models.ts +103 -0
- package/src/components/composites/plan/index.ts +1 -0
- package/src/components/composites/plan/plan.tsx +155 -0
- package/src/components/composites/queue/index.ts +10 -0
- package/src/components/composites/queue/queue.tsx +264 -0
- package/src/components/composites/reasoning/index.ts +1 -0
- package/src/components/composites/reasoning/reasoning.tsx +176 -0
- package/src/components/composites/sources/index.ts +11 -0
- package/src/components/composites/sources/source.ts +116 -0
- package/src/components/composites/sources/sources.tsx +163 -0
- package/src/components/composites/stack-trace/index.ts +19 -0
- package/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
- package/src/components/composites/stack-trace/stack-trace.tsx +395 -0
- package/src/components/composites/subagent/index.ts +1 -0
- package/src/components/composites/subagent/subagent.tsx +159 -0
- package/src/components/composites/suggestion/index.ts +1 -0
- package/src/components/composites/suggestion/suggestion.tsx +140 -0
- package/src/components/composites/task/index.ts +14 -0
- package/src/components/composites/task/task.tsx +317 -0
- package/src/components/composites/terminal/ansi.ts +674 -0
- package/src/components/composites/terminal/index.ts +20 -0
- package/src/components/composites/terminal/terminal-model.ts +111 -0
- package/src/components/composites/terminal/terminal.tsx +574 -0
- package/src/components/composites/test-results/index.ts +20 -0
- package/src/components/composites/test-results/test-results-model.ts +368 -0
- package/src/components/composites/test-results/test-results.tsx +586 -0
- package/src/components/composites/tool/format-tool-value.ts +221 -0
- package/src/components/composites/tool/index.ts +2 -0
- package/src/components/composites/tool/tool.tsx +228 -0
- package/src/components/conversation/conversation-surface.tsx +9 -0
- package/src/components/conversation/scroll-follow-core.ts +31 -0
- package/src/components/conversation/scroll-follow.ts +92 -0
- package/src/components/ui/attachment/attachment.tsx +282 -0
- package/src/components/ui/attachment/index.ts +10 -0
- package/src/components/ui/bubble/bubble.tsx +86 -0
- package/src/components/ui/bubble/index.ts +1 -0
- package/src/components/ui/code-block/code-block.tsx +256 -26
- package/src/components/ui/code-block/index.ts +9 -1
- package/src/components/ui/field/number-field.tsx +51 -14
- package/src/components/ui/marker/index.ts +1 -0
- package/src/components/ui/marker/marker.tsx +90 -0
- package/src/components/ui/message/cite-ranges.ts +144 -0
- package/src/components/ui/message/index.ts +23 -0
- package/src/components/ui/message/message.tsx +434 -0
- package/src/components/ui/message/parse-message-text.ts +450 -0
- package/src/components/ui/questionnaire/index.ts +10 -0
- package/src/components/ui/questionnaire/questionnaire.tsx +446 -0
- package/src/components/ui/trace/index.ts +9 -0
- package/src/components/ui/trace/trace.tsx +334 -0
- package/src/index.ts +26 -0
- package/src/styles/base.css +34 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { Button } from "../../ui/button/button.js";
|
|
3
|
+
import { Badge } from "../../ui/badge/badge.js";
|
|
4
|
+
import { keyedRows } from "../../../lib/keyed-rows.js";
|
|
5
|
+
import { Tree, TreeRow } from "../tree/tree.js";
|
|
6
|
+
import { FILE_CHANGE_LABELS, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, revealInWindow, typeaheadIndex } from "./build-file-tree.js";
|
|
7
|
+
import { className, createComponent, delegateEvents, effect, insert, memo, mergeProps, setAttribute, setStyleProperty, spread, template, use } from "solid-js/web";
|
|
8
|
+
import { File, Folder, FolderOpen } from "lucide-solid";
|
|
9
|
+
import { For, Show, createComputed, createMemo, createSignal, onCleanup, splitProps, untrack } from "solid-js";
|
|
10
|
+
//#region src/components/composites/file-tree/file-tree.tsx
|
|
11
|
+
var _tmpl$ = /*#__PURE__*/ template(`<span>`);
|
|
12
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<span class=sr-only>, renamed from `);
|
|
13
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<span class=text-foreground>+`);
|
|
14
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<span class=text-foreground>−`);
|
|
15
|
+
var _tmpl$5 = /*#__PURE__*/ template(`<span class="font-code text-2xs tabular-nums"> `);
|
|
16
|
+
var _tmpl$6 = /*#__PURE__*/ template(`<span class="text-2xs tabular-nums"> `);
|
|
17
|
+
var _tmpl$7 = /*#__PURE__*/ template(`<p data-slot=file-tree-summary class="m-0 text-xs text-muted-foreground">`);
|
|
18
|
+
var _tmpl$8 = /*#__PURE__*/ template(`<p class="m-0 text-xs text-muted-foreground">No changed files`);
|
|
19
|
+
var _tmpl$9 = /*#__PURE__*/ template(`<div>`);
|
|
20
|
+
var _tmpl$0 = /*#__PURE__*/ template(`<div class="scroll-fade overflow-auto rounded-md">`);
|
|
21
|
+
var _tmpl$1 = /*#__PURE__*/ template(`<div data-slot=file-tree>`);
|
|
22
|
+
var FILE_TREE_MAX_ROWS = 500;
|
|
23
|
+
var CHANGE_VARIANT = {
|
|
24
|
+
added: "success",
|
|
25
|
+
modified: "warning",
|
|
26
|
+
deleted: "destructive",
|
|
27
|
+
renamed: "info"
|
|
28
|
+
};
|
|
29
|
+
function descriptor(row) {
|
|
30
|
+
return {
|
|
31
|
+
id: row.node.id,
|
|
32
|
+
parentId: row.parentId,
|
|
33
|
+
level: row.level,
|
|
34
|
+
expandable: row.node.kind === "directory",
|
|
35
|
+
expanded: row.expanded
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function RowContent(props) {
|
|
39
|
+
const node = () => props.row.node;
|
|
40
|
+
return [(() => {
|
|
41
|
+
var _el$ = _tmpl$();
|
|
42
|
+
insert(_el$, () => node().name);
|
|
43
|
+
effect((_p$) => {
|
|
44
|
+
var _v$ = cn("truncate", { "text-muted-foreground line-through": node().change === "deleted" }), _v$2 = node().id;
|
|
45
|
+
_v$ !== _p$.e && className(_el$, _p$.e = _v$);
|
|
46
|
+
_v$2 !== _p$.t && setAttribute(_el$, "title", _p$.t = _v$2);
|
|
47
|
+
return _p$;
|
|
48
|
+
}, {
|
|
49
|
+
e: void 0,
|
|
50
|
+
t: void 0
|
|
51
|
+
});
|
|
52
|
+
return _el$;
|
|
53
|
+
})(), createComponent(Show, {
|
|
54
|
+
get when() {
|
|
55
|
+
return node().renamedFrom;
|
|
56
|
+
},
|
|
57
|
+
get children() {
|
|
58
|
+
var _el$2 = _tmpl$2();
|
|
59
|
+
_el$2.firstChild;
|
|
60
|
+
insert(_el$2, () => node().renamedFrom, null);
|
|
61
|
+
return _el$2;
|
|
62
|
+
}
|
|
63
|
+
})];
|
|
64
|
+
}
|
|
65
|
+
function RowTrailing(props) {
|
|
66
|
+
const node = () => props.row.node;
|
|
67
|
+
return [
|
|
68
|
+
createComponent(Show, {
|
|
69
|
+
get when() {
|
|
70
|
+
return memo(() => node().kind === "file")() && (node().additions || node().deletions);
|
|
71
|
+
},
|
|
72
|
+
get children() {
|
|
73
|
+
var _el$4 = _tmpl$5(), _el$7 = _el$4.firstChild;
|
|
74
|
+
insert(_el$4, createComponent(Show, {
|
|
75
|
+
get when() {
|
|
76
|
+
return node().additions !== void 0;
|
|
77
|
+
},
|
|
78
|
+
get children() {
|
|
79
|
+
var _el$5 = _tmpl$3();
|
|
80
|
+
_el$5.firstChild;
|
|
81
|
+
insert(_el$5, () => node().additions, null);
|
|
82
|
+
return _el$5;
|
|
83
|
+
}
|
|
84
|
+
}), _el$7);
|
|
85
|
+
insert(_el$4, createComponent(Show, {
|
|
86
|
+
get when() {
|
|
87
|
+
return node().deletions !== void 0;
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
var _el$8 = _tmpl$4();
|
|
91
|
+
_el$8.firstChild;
|
|
92
|
+
insert(_el$8, () => node().deletions, null);
|
|
93
|
+
return _el$8;
|
|
94
|
+
}
|
|
95
|
+
}), null);
|
|
96
|
+
return _el$4;
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
createComponent(Show, {
|
|
100
|
+
get when() {
|
|
101
|
+
return memo(() => node().kind === "directory")() && !props.row.expanded;
|
|
102
|
+
},
|
|
103
|
+
get children() {
|
|
104
|
+
var _el$0 = _tmpl$6(), _el$1 = _el$0.firstChild;
|
|
105
|
+
insert(_el$0, () => node().fileCount.toLocaleString(), _el$1);
|
|
106
|
+
insert(_el$0, () => node().fileCount === 1 ? "file" : "files", null);
|
|
107
|
+
return _el$0;
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
createComponent(Show, {
|
|
111
|
+
get when() {
|
|
112
|
+
return node().change;
|
|
113
|
+
},
|
|
114
|
+
children: (change) => createComponent(Badge, {
|
|
115
|
+
get variant() {
|
|
116
|
+
return CHANGE_VARIANT[change()];
|
|
117
|
+
},
|
|
118
|
+
size: "sm",
|
|
119
|
+
get children() {
|
|
120
|
+
return FILE_CHANGE_LABELS[change()];
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
function FileTree(props) {
|
|
127
|
+
const [local, rest] = splitProps(props, [
|
|
128
|
+
"files",
|
|
129
|
+
"label",
|
|
130
|
+
"defaultExpanded",
|
|
131
|
+
"compact",
|
|
132
|
+
"selected",
|
|
133
|
+
"onSelect",
|
|
134
|
+
"maxHeight",
|
|
135
|
+
"maxRows",
|
|
136
|
+
"showSummary",
|
|
137
|
+
"class"
|
|
138
|
+
]);
|
|
139
|
+
const build = createMemo(() => buildFileTree(local.files, { compact: local.compact }));
|
|
140
|
+
const nodes = createMemo(() => indexFileTree(build().roots));
|
|
141
|
+
const counts = createMemo(() => countChanges(build().roots));
|
|
142
|
+
const [expanded, setExpanded] = createSignal(/* @__PURE__ */ new Set());
|
|
143
|
+
let seen = /* @__PURE__ */ new Set();
|
|
144
|
+
createComputed(() => {
|
|
145
|
+
const { roots, fileCount } = build();
|
|
146
|
+
const wanted = initialExpanded(roots, local.defaultExpanded, fileCount);
|
|
147
|
+
const folders = /* @__PURE__ */ new Set();
|
|
148
|
+
for (const [id, node] of nodes()) if (node.kind === "directory") folders.add(id);
|
|
149
|
+
untrack(() => {
|
|
150
|
+
const next = new Set([...expanded()].filter((id) => folders.has(id)));
|
|
151
|
+
for (const id of wanted) if (!seen.has(id)) next.add(id);
|
|
152
|
+
seen = folders;
|
|
153
|
+
setExpanded(next);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
const rows = createMemo(() => flattenFileTree(build().roots, expanded()));
|
|
157
|
+
const pageSize = () => Math.max(1, Math.floor(local.maxRows ?? 500));
|
|
158
|
+
const [requested, setRequested] = createSignal({
|
|
159
|
+
start: 0,
|
|
160
|
+
end: 0
|
|
161
|
+
});
|
|
162
|
+
const mountedWindow = createMemo(() => clampWindow(requested().end === 0 ? {
|
|
163
|
+
start: 0,
|
|
164
|
+
end: pageSize()
|
|
165
|
+
} : requested(), rows().length, pageSize()));
|
|
166
|
+
const items = createMemo(() => rows().map(descriptor));
|
|
167
|
+
const mounted = keyedRows(() => rows().slice(mountedWindow().start, mountedWindow().end), (row) => row.node.id);
|
|
168
|
+
const rowsBefore = () => mountedWindow().start;
|
|
169
|
+
const rowsAfter = () => Math.max(0, rows().length - mountedWindow().end);
|
|
170
|
+
const [activeId, setActiveId] = createSignal(null);
|
|
171
|
+
const selectable = () => local.onSelect !== void 0;
|
|
172
|
+
const toggle = (id, open) => {
|
|
173
|
+
setExpanded((current) => {
|
|
174
|
+
const next = new Set(current);
|
|
175
|
+
if (open) next.add(id);
|
|
176
|
+
else next.delete(id);
|
|
177
|
+
return next;
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
/** Mount the rows around one the keyboard is moving to, so focus can land on it. */
|
|
181
|
+
const reveal = (id) => {
|
|
182
|
+
const index = rows().findIndex((row) => row.node.id === id);
|
|
183
|
+
setRequested(revealInWindow(mountedWindow(), index, rows().length, pageSize()));
|
|
184
|
+
};
|
|
185
|
+
const select = (id) => {
|
|
186
|
+
const node = nodes().get(id);
|
|
187
|
+
if (node) local.onSelect?.(id, node);
|
|
188
|
+
};
|
|
189
|
+
const activate = (id) => {
|
|
190
|
+
const node = nodes().get(id);
|
|
191
|
+
if (!node) return;
|
|
192
|
+
if (node.kind === "directory") toggle(id, !expanded().has(id));
|
|
193
|
+
else select(id);
|
|
194
|
+
};
|
|
195
|
+
let container;
|
|
196
|
+
let typed = "";
|
|
197
|
+
let typedTimer;
|
|
198
|
+
onCleanup(() => clearTimeout(typedTimer));
|
|
199
|
+
const typeahead = (event) => {
|
|
200
|
+
if (event.defaultPrevented || event.ctrlKey || event.metaKey || event.altKey || event.key.length !== 1 || event.key === " ") return;
|
|
201
|
+
typed += event.key;
|
|
202
|
+
clearTimeout(typedTimer);
|
|
203
|
+
typedTimer = setTimeout(() => typed = "", 700);
|
|
204
|
+
const all = rows();
|
|
205
|
+
const active = all.findIndex((row) => row.node.id === activeId());
|
|
206
|
+
const row = all[typeaheadIndex(all.map((row) => row.node.name), active, typed)];
|
|
207
|
+
if (!row) return;
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
const id = row.node.id;
|
|
210
|
+
reveal(id);
|
|
211
|
+
setActiveId(id);
|
|
212
|
+
queueMicrotask(() => {
|
|
213
|
+
for (const element of container?.querySelectorAll("[data-tree-id]") ?? []) if (element.dataset.treeId === id) {
|
|
214
|
+
element.focus();
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
const maxHeight = () => typeof local.maxHeight === "number" ? `${local.maxHeight}px` : local.maxHeight ?? "20rem";
|
|
220
|
+
return (() => {
|
|
221
|
+
var _el$10 = _tmpl$1();
|
|
222
|
+
use((element) => container = element, _el$10);
|
|
223
|
+
spread(_el$10, mergeProps({ get ["class"]() {
|
|
224
|
+
return cn("flex min-w-0 flex-col gap-1", local.class);
|
|
225
|
+
} }, rest), false, true);
|
|
226
|
+
insert(_el$10, createComponent(Show, {
|
|
227
|
+
get when() {
|
|
228
|
+
return local.showSummary !== false;
|
|
229
|
+
},
|
|
230
|
+
get children() {
|
|
231
|
+
var _el$11 = _tmpl$7();
|
|
232
|
+
insert(_el$11, () => describeChanges(counts()), null);
|
|
233
|
+
insert(_el$11, createComponent(Show, {
|
|
234
|
+
get when() {
|
|
235
|
+
return build().rejected.length > 0;
|
|
236
|
+
},
|
|
237
|
+
get children() {
|
|
238
|
+
return [
|
|
239
|
+
" ",
|
|
240
|
+
"· ",
|
|
241
|
+
memo(() => build().rejected.length.toLocaleString()),
|
|
242
|
+
" ",
|
|
243
|
+
memo(() => build().rejected.length === 1 ? "path" : "paths"),
|
|
244
|
+
" ignored as not valid"
|
|
245
|
+
];
|
|
246
|
+
}
|
|
247
|
+
}), null);
|
|
248
|
+
return _el$11;
|
|
249
|
+
}
|
|
250
|
+
}), null);
|
|
251
|
+
insert(_el$10, createComponent(Show, {
|
|
252
|
+
get when() {
|
|
253
|
+
return memo(() => rows().length === 0)() && local.showSummary === false;
|
|
254
|
+
},
|
|
255
|
+
get children() {
|
|
256
|
+
return _tmpl$8();
|
|
257
|
+
}
|
|
258
|
+
}), null);
|
|
259
|
+
insert(_el$10, createComponent(Show, {
|
|
260
|
+
get when() {
|
|
261
|
+
return rows().length > 0;
|
|
262
|
+
},
|
|
263
|
+
get children() {
|
|
264
|
+
return [
|
|
265
|
+
createComponent(Show, {
|
|
266
|
+
get when() {
|
|
267
|
+
return rowsBefore() > 0;
|
|
268
|
+
},
|
|
269
|
+
get children() {
|
|
270
|
+
var _el$13 = _tmpl$9();
|
|
271
|
+
insert(_el$13, createComponent(Button, {
|
|
272
|
+
variant: "ghost",
|
|
273
|
+
size: "2xs",
|
|
274
|
+
onClick: () => setRequested({
|
|
275
|
+
start: Math.max(0, mountedWindow().start - pageSize()),
|
|
276
|
+
end: mountedWindow().end
|
|
277
|
+
}),
|
|
278
|
+
get children() {
|
|
279
|
+
return [
|
|
280
|
+
"Show ",
|
|
281
|
+
memo(() => Math.min(rowsBefore(), pageSize()).toLocaleString()),
|
|
282
|
+
" earlier rows (",
|
|
283
|
+
memo(() => rowsBefore().toLocaleString()),
|
|
284
|
+
" not shown)"
|
|
285
|
+
];
|
|
286
|
+
}
|
|
287
|
+
}));
|
|
288
|
+
return _el$13;
|
|
289
|
+
}
|
|
290
|
+
}),
|
|
291
|
+
(() => {
|
|
292
|
+
var _el$14 = _tmpl$0();
|
|
293
|
+
_el$14.$$keydown = typeahead;
|
|
294
|
+
insert(_el$14, createComponent(Tree, {
|
|
295
|
+
get ["aria-label"]() {
|
|
296
|
+
return local.label ?? "Changed files";
|
|
297
|
+
},
|
|
298
|
+
get visibleItems() {
|
|
299
|
+
return items();
|
|
300
|
+
},
|
|
301
|
+
get activeId() {
|
|
302
|
+
return activeId();
|
|
303
|
+
},
|
|
304
|
+
onActiveIdChange: setActiveId,
|
|
305
|
+
onExpand: toggle,
|
|
306
|
+
onActivate: (id) => activate(id),
|
|
307
|
+
onSelectItem: (id) => select(id),
|
|
308
|
+
onRequestReveal: reveal,
|
|
309
|
+
get selectionMode() {
|
|
310
|
+
return selectable() ? "single" : void 0;
|
|
311
|
+
},
|
|
312
|
+
get children() {
|
|
313
|
+
return createComponent(For, {
|
|
314
|
+
get each() {
|
|
315
|
+
return mounted();
|
|
316
|
+
},
|
|
317
|
+
children: (entry) => createComponent(TreeRow, {
|
|
318
|
+
get item() {
|
|
319
|
+
return descriptor(entry.item());
|
|
320
|
+
},
|
|
321
|
+
get selected() {
|
|
322
|
+
return memo(() => !!selectable())() ? local.selected === entry.item().node.id : void 0;
|
|
323
|
+
},
|
|
324
|
+
get leading() {
|
|
325
|
+
return memo(() => entry.item().node.kind === "directory")() ? memo(() => !!entry.item().expanded)() ? createComponent(FolderOpen, {
|
|
326
|
+
"aria-hidden": "true",
|
|
327
|
+
"class": "text-muted-foreground"
|
|
328
|
+
}) : createComponent(Folder, {
|
|
329
|
+
"aria-hidden": "true",
|
|
330
|
+
"class": "text-muted-foreground"
|
|
331
|
+
}) : createComponent(File, {
|
|
332
|
+
"aria-hidden": "true",
|
|
333
|
+
"class": "text-muted-foreground"
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
get trailing() {
|
|
337
|
+
return createComponent(RowTrailing, { get row() {
|
|
338
|
+
return entry.item();
|
|
339
|
+
} });
|
|
340
|
+
},
|
|
341
|
+
get children() {
|
|
342
|
+
return createComponent(RowContent, { get row() {
|
|
343
|
+
return entry.item();
|
|
344
|
+
} });
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}));
|
|
350
|
+
effect((_$p) => setStyleProperty(_el$14, "max-height", maxHeight()));
|
|
351
|
+
return _el$14;
|
|
352
|
+
})(),
|
|
353
|
+
createComponent(Show, {
|
|
354
|
+
get when() {
|
|
355
|
+
return rowsAfter() > 0;
|
|
356
|
+
},
|
|
357
|
+
get children() {
|
|
358
|
+
var _el$15 = _tmpl$9();
|
|
359
|
+
insert(_el$15, createComponent(Button, {
|
|
360
|
+
variant: "ghost",
|
|
361
|
+
size: "2xs",
|
|
362
|
+
onClick: () => setRequested({
|
|
363
|
+
start: mountedWindow().start,
|
|
364
|
+
end: Math.min(rows().length, mountedWindow().end + pageSize())
|
|
365
|
+
}),
|
|
366
|
+
get children() {
|
|
367
|
+
return [
|
|
368
|
+
"Show ",
|
|
369
|
+
memo(() => Math.min(rowsAfter(), pageSize()).toLocaleString()),
|
|
370
|
+
" more rows (",
|
|
371
|
+
memo(() => rowsAfter().toLocaleString()),
|
|
372
|
+
" not shown)"
|
|
373
|
+
];
|
|
374
|
+
}
|
|
375
|
+
}));
|
|
376
|
+
return _el$15;
|
|
377
|
+
}
|
|
378
|
+
})
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
}), null);
|
|
382
|
+
return _el$10;
|
|
383
|
+
})();
|
|
384
|
+
}
|
|
385
|
+
delegateEvents(["keydown"]);
|
|
386
|
+
//#endregion
|
|
387
|
+
export { FILE_TREE_MAX_ROWS, FileTree };
|
|
388
|
+
|
|
389
|
+
//# sourceMappingURL=file-tree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-tree.js","names":["File","Folder","FolderOpen","createComputed","createMemo","createSignal","For","onCleanup","Show","splitProps","untrack","ComponentProps","keyedRows","cn","Button","Badge","Tree","TreeRow","TreeItemDescriptor","buildFileTree","clampWindow","countChanges","describeChanges","FILE_CHANGE_LABELS","flattenFileTree","indexFileTree","initialExpanded","revealInWindow","typeaheadIndex","RowWindow","FileChangeInput","FileChangeKind","FileTreeExpansion","FileTreeNode","FileTreeRow","FileTreeProps","Omit","files","label","defaultExpanded","compact","selected","onSelect","path","node","maxHeight","maxRows","showSummary","FILE_TREE_MAX_ROWS","CHANGE_VARIANT","Readonly","Record","added","modified","deleted","renamed","descriptor","row","id","parentId","level","expandable","kind","expanded","RowContent","props","_el$","_tmpl$","_$insert","name","_$effect","_p$","_v$","change","_v$2","e","_$className","t","_$setAttribute","undefined","_$createComponent","when","renamedFrom","children","_el$2","_tmpl$2","_el$3","firstChild","RowTrailing","_$memo","additions","deletions","_el$4","_tmpl$5","_el$7","_el$5","_tmpl$3","_el$6","_el$8","_tmpl$4","_el$9","_el$0","_tmpl$6","_el$1","fileCount","toLocaleString","variant","size","FileTree","local","rest","build","nodes","roots","counts","setExpanded","ReadonlySet","Set","seen","wanted","folders","add","next","filter","has","rows","pageSize","Math","max","floor","requested","setRequested","start","end","mountedWindow","length","items","map","mounted","slice","rowsBefore","rowsAfter","activeId","setActiveId","selectable","toggle","open","current","delete","reveal","index","findIndex","select","get","activate","container","HTMLDivElement","typed","typedTimer","ReturnType","setTimeout","clearTimeout","typeahead","event","KeyboardEvent","defaultPrevented","ctrlKey","metaKey","altKey","key","all","active","target","preventDefault","queueMicrotask","element","querySelectorAll","HTMLElement","dataset","treeId","focus","_el$10","_tmpl$1","_$use","_$spread","_$mergeProps","class","_el$11","_tmpl$7","rejected","_tmpl$8","_el$13","_tmpl$9","onClick","min","_el$14","_tmpl$0","$$keydown","aria-label","visibleItems","onActiveIdChange","onExpand","onActivate","onSelectItem","onRequestReveal","selectionMode","each","entry","item","leading","trailing","_$p","_$setStyleProperty","_el$15","_$delegateEvents","_$className","_$setAttribute","_$createComponent","_$memo","_$mergeProps","_$setStyleProperty","_$delegateEvents"],"sources":["../../../../src/components/composites/file-tree/file-tree.tsx"],"sourcesContent":["import { File, Folder, FolderOpen } from 'lucide-solid'\nimport {\n createComputed,\n createMemo,\n createSignal,\n For,\n onCleanup,\n Show,\n splitProps,\n untrack,\n type ComponentProps,\n} from 'solid-js'\nimport { keyedRows } from '#lib/keyed-rows'\nimport { cn } from '#lib/utils'\nimport { Button } from '../../ui/button'\nimport { Badge } from '../../ui/badge'\nimport { Tree, TreeRow, type TreeItemDescriptor } from '../tree'\nimport {\n buildFileTree,\n clampWindow,\n countChanges,\n describeChanges,\n FILE_CHANGE_LABELS,\n flattenFileTree,\n indexFileTree,\n initialExpanded,\n revealInWindow,\n typeaheadIndex,\n type RowWindow,\n type FileChangeInput,\n type FileChangeKind,\n type FileTreeExpansion,\n type FileTreeNode,\n type FileTreeRow,\n} from './build-file-tree'\n\n/**\n * FileTree.\n *\n * The files an agent changed, as a folder tree. It is for a change set — dozens\n * to thousands of paths with an optional change kind each — and not for browsing\n * a workspace: it has no rename, drag, or filesystem action, and it never opens\n * anything. Reach for `Trace` lines when the agent touched two or three files, and\n * for the shared `Tree` directly when the host owns a real file explorer.\n *\n * ## Built on `Tree`, and why that fits\n *\n * `Tree` supplies the treeitem semantics and the WAI-ARIA keyboard model (arrows,\n * Home/End, roving tab stop) and leaves the projection to the host. A changed-file\n * tree is small enough that the whole projection can live in memory, and the\n * `Tree` contract for a mounted window — a complete `visibleItems` list with only\n * some rows rendered, `onRequestReveal` to mount a row the keyboard moved to — is\n * exactly the seam a bounded render needs, so this adds no navigation code of\n * its own. What it adds is typeahead, which `Tree` does not provide: a typed\n * prefix jumps to the next row whose name starts with it.\n *\n * ## Large trees\n *\n * A collapsed folder's subtree is never visited or rendered, so a 5 000-file tree\n * costs what is visible. A tree of more than 100 files starts with only its top\n * level open (`defaultExpanded` overrides). Past `maxRows` visible rows only a\n * window of them is mounted, with a control above and below to move it a page at\n * a time. The full list is what keyboard navigation walks: an arrow key at the\n * window's edge grows it by a page, and a jump (End, Home, a typed letter) moves\n * it to the page holding the target instead of mounting every row between, so End\n * on a tree of thousands of open rows stays one page of work.\n *\n * ## Changes are claims\n *\n * A change kind is drawn — as a word on the row, so it is also spoken — only for a\n * file the host gave one. A file without one is listed and nothing more is said.\n * The summary counts what was supplied, and is silent about files with no kind.\n * Paths that are not acceptable (`..` segments, control characters) are not drawn;\n * their number is stated, so the list is never quietly shorter than the input.\n *\n * ## Selection is the host's\n *\n * Rows select only when `onSelect` is supplied; without it no row is selectable\n * and `aria-selected` is not set. Enter or a click on a folder expands it; on a\n * file it selects. Space selects either. The tree never opens a file itself — the\n * path is untrusted text, and what it means on this machine is the host's call.\n */\nexport type FileTreeProps = Omit<ComponentProps<'div'>, 'children' | 'onSelect'> & {\n /** Paths, or paths with a change kind. Both `/` and `\\` separate segments. */\n files: readonly (string | FileChangeInput)[]\n /** The tree's accessible name. Default \"Changed files\". */\n label?: string\n /**\n * Which folders start open: `true` all, `false` none, a number to that depth,\n * or a list of ids. Unset opens a small tree fully and a large one at its top level.\n */\n defaultExpanded?: FileTreeExpansion\n /** Merge a folder with a single folder child into one row. Default true. */\n compact?: boolean\n /** The selected node's id. Meaningful only with `onSelect`. */\n selected?: string\n /** Make rows selectable. Omit and nothing is selectable. */\n onSelect?: (path: string, node: FileTreeNode) => void\n /** Height of the tree box, which scrolls past it. A number is pixels. Default `20rem`. */\n maxHeight?: number | string\n /** Visible rows mounted at once; more are added a page at a time. Default 500. */\n maxRows?: number\n /** Show the count of changes above the tree. Default true. */\n showSummary?: boolean\n}\n\nexport const FILE_TREE_MAX_ROWS = 500\n\nconst CHANGE_VARIANT: Readonly<\n Record<FileChangeKind, 'success' | 'warning' | 'destructive' | 'info'>\n> = {\n added: 'success',\n modified: 'warning',\n deleted: 'destructive',\n renamed: 'info',\n}\n\nfunction descriptor(row: FileTreeRow): TreeItemDescriptor {\n return {\n id: row.node.id,\n parentId: row.parentId,\n level: row.level,\n expandable: row.node.kind === 'directory',\n expanded: row.expanded,\n }\n}\n\nfunction RowContent(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <span\n class={cn('truncate', {\n 'text-muted-foreground line-through': node().change === 'deleted',\n })}\n title={node().id}\n >\n {node().name}\n </span>\n <Show when={node().renamedFrom}>\n <span class=\"sr-only\">, renamed from {node().renamedFrom}</span>\n </Show>\n </>\n )\n}\n\nfunction RowTrailing(props: { row: FileTreeRow }) {\n const node = () => props.row.node\n return (\n <>\n <Show when={node().kind === 'file' && (node().additions || node().deletions)}>\n <span class=\"font-code text-2xs tabular-nums\">\n <Show when={node().additions !== undefined}>\n <span class=\"text-foreground\">+{node().additions}</span>\n </Show>{' '}\n <Show when={node().deletions !== undefined}>\n <span class=\"text-foreground\">−{node().deletions}</span>\n </Show>\n </span>\n </Show>\n <Show when={node().kind === 'directory' && !props.row.expanded}>\n <span class=\"text-2xs tabular-nums\">\n {node().fileCount.toLocaleString()} {node().fileCount === 1 ? 'file' : 'files'}\n </span>\n </Show>\n {/* The word is the signal; the tint only helps a sighted reader find it. */}\n <Show when={node().change}>\n {(change) => (\n <Badge variant={CHANGE_VARIANT[change()]} size=\"sm\">\n {FILE_CHANGE_LABELS[change()]}\n </Badge>\n )}\n </Show>\n </>\n )\n}\n\nexport function FileTree(props: FileTreeProps) {\n const [local, rest] = splitProps(props, [\n 'files',\n 'label',\n 'defaultExpanded',\n 'compact',\n 'selected',\n 'onSelect',\n 'maxHeight',\n 'maxRows',\n 'showSummary',\n 'class',\n ])\n\n const build = createMemo(() => buildFileTree(local.files, { compact: local.compact }))\n const nodes = createMemo(() => indexFileTree(build().roots))\n const counts = createMemo(() => countChanges(build().roots))\n\n // Folders the tree has already decided about. A change set that grows while\n // the agent works opens its new folders by the same rule as the first render,\n // and never reopens one the reader closed.\n const [expanded, setExpanded] = createSignal<ReadonlySet<string>>(new Set())\n let seen = new Set<string>()\n createComputed(() => {\n const { roots, fileCount } = build()\n const wanted = initialExpanded(roots, local.defaultExpanded, fileCount)\n const folders = new Set<string>()\n for (const [id, node] of nodes()) if (node.kind === 'directory') folders.add(id)\n untrack(() => {\n const next = new Set([...expanded()].filter((id) => folders.has(id)))\n for (const id of wanted) if (!seen.has(id)) next.add(id)\n seen = folders\n setExpanded(next)\n })\n })\n\n const rows = createMemo(() => flattenFileTree(build().roots, expanded()))\n const pageSize = () => Math.max(1, Math.floor(local.maxRows ?? FILE_TREE_MAX_ROWS))\n const [requested, setRequested] = createSignal<RowWindow>({ start: 0, end: 0 })\n const mountedWindow = createMemo(() =>\n clampWindow(\n requested().end === 0 ? { start: 0, end: pageSize() } : requested(),\n rows().length,\n pageSize()\n )\n )\n const items = createMemo(() => rows().map(descriptor))\n const mounted = keyedRows(\n () => rows().slice(mountedWindow().start, mountedWindow().end),\n (row) => row.node.id\n )\n const rowsBefore = () => mountedWindow().start\n const rowsAfter = () => Math.max(0, rows().length - mountedWindow().end)\n\n const [activeId, setActiveId] = createSignal<string | null>(null)\n const selectable = () => local.onSelect !== undefined\n\n const toggle = (id: string, open: boolean) => {\n setExpanded((current) => {\n const next = new Set(current)\n if (open) next.add(id)\n else next.delete(id)\n return next\n })\n }\n\n /** Mount the rows around one the keyboard is moving to, so focus can land on it. */\n const reveal = (id: string) => {\n const index = rows().findIndex((row) => row.node.id === id)\n setRequested(revealInWindow(mountedWindow(), index, rows().length, pageSize()))\n }\n\n const select = (id: string) => {\n const node = nodes().get(id)\n if (node) local.onSelect?.(id, node)\n }\n const activate = (id: string) => {\n const node = nodes().get(id)\n if (!node) return\n if (node.kind === 'directory') toggle(id, !expanded().has(id))\n else select(id)\n }\n\n let container: HTMLDivElement | undefined\n let typed = ''\n let typedTimer: ReturnType<typeof setTimeout> | undefined\n onCleanup(() => clearTimeout(typedTimer))\n const typeahead = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.ctrlKey ||\n event.metaKey ||\n event.altKey ||\n event.key.length !== 1 ||\n event.key === ' '\n ) {\n return\n }\n typed += event.key\n clearTimeout(typedTimer)\n typedTimer = setTimeout(() => (typed = ''), 700)\n const all = rows()\n const active = all.findIndex((row) => row.node.id === activeId())\n const target = typeaheadIndex(\n all.map((row) => row.node.name),\n active,\n typed\n )\n const row = all[target]\n if (!row) return\n event.preventDefault()\n const id = row.node.id\n reveal(id)\n setActiveId(id)\n queueMicrotask(() => {\n for (const element of container?.querySelectorAll<HTMLElement>('[data-tree-id]') ?? []) {\n if (element.dataset.treeId === id) {\n element.focus()\n break\n }\n }\n })\n }\n\n const maxHeight = () =>\n typeof local.maxHeight === 'number' ? `${local.maxHeight}px` : (local.maxHeight ?? '20rem')\n\n return (\n <div\n data-slot=\"file-tree\"\n class={cn('flex min-w-0 flex-col gap-1', local.class)}\n ref={(element) => (container = element)}\n {...rest}\n >\n <Show when={local.showSummary !== false}>\n <p data-slot=\"file-tree-summary\" class=\"m-0 text-xs text-muted-foreground\">\n {describeChanges(counts())}\n <Show when={build().rejected.length > 0}>\n {' '}\n · {build().rejected.length.toLocaleString()}{' '}\n {build().rejected.length === 1 ? 'path' : 'paths'} ignored as not valid\n </Show>\n </p>\n </Show>\n <Show when={rows().length === 0 && local.showSummary === false}>\n <p class=\"m-0 text-xs text-muted-foreground\">No changed files</p>\n </Show>\n <Show when={rows().length > 0}>\n {/* The listener sits on the wrapper because `Tree` owns its own keydown\n and ignores printable keys; typeahead picks up where it stops. */}\n <Show when={rowsBefore() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: Math.max(0, mountedWindow().start - pageSize()),\n end: mountedWindow().end,\n })\n }\n >\n Show {Math.min(rowsBefore(), pageSize()).toLocaleString()} earlier rows (\n {rowsBefore().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n <div\n class=\"scroll-fade overflow-auto rounded-md\"\n style={{ 'max-height': maxHeight() }}\n onKeyDown={typeahead}\n >\n <Tree\n aria-label={local.label ?? 'Changed files'}\n visibleItems={items()}\n activeId={activeId()}\n onActiveIdChange={setActiveId}\n onExpand={toggle}\n onActivate={(id) => activate(id)}\n onSelectItem={(id) => select(id)}\n onRequestReveal={reveal}\n selectionMode={selectable() ? 'single' : undefined}\n >\n <For each={mounted()}>\n {(entry) => (\n <TreeRow\n item={descriptor(entry.item())}\n selected={selectable() ? local.selected === entry.item().node.id : undefined}\n leading={\n entry.item().node.kind === 'directory' ? (\n entry.item().expanded ? (\n <FolderOpen aria-hidden=\"true\" class=\"text-muted-foreground\" />\n ) : (\n <Folder aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n ) : (\n <File aria-hidden=\"true\" class=\"text-muted-foreground\" />\n )\n }\n trailing={<RowTrailing row={entry.item()} />}\n >\n <RowContent row={entry.item()} />\n </TreeRow>\n )}\n </For>\n </Tree>\n </div>\n <Show when={rowsAfter() > 0}>\n <div>\n <Button\n variant=\"ghost\"\n size=\"2xs\"\n onClick={() =>\n setRequested({\n start: mountedWindow().start,\n end: Math.min(rows().length, mountedWindow().end + pageSize()),\n })\n }\n >\n Show {Math.min(rowsAfter(), pageSize()).toLocaleString()} more rows (\n {rowsAfter().toLocaleString()} not shown)\n </Button>\n </div>\n </Show>\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0GA,IAAagD,qBAAqB;AAElC,IAAMC,iBAEF;CACFG,OAAO;CACPC,UAAU;CACVC,SAAS;CACTC,SAAS;AACX;AAEA,SAASC,WAAWC,KAAsC;CACxD,OAAO;EACLC,IAAID,IAAIb,KAAKc;EACbC,UAAUF,IAAIE;EACdC,OAAOH,IAAIG;EACXC,YAAYJ,IAAIb,KAAKkB,S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hB,WACvDoD,UAAU,CAAC,CAACpC,eAAe,CAAC;UAAA;SAAA;QAAA;OAAA,CAAA,CAAA;OAAA,OAAA4G;MAAA;KAAA,CAAA;IAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAhC;CAAA,EAAA,CAAA;AAO3C;AAACiC,eAAA,CAAA,SAAA,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { FileTree, FILE_TREE_MAX_ROWS, type FileTreeProps } from './file-tree';
|
|
2
|
+
export { buildFileTree, clampWindow, countChanges, describeChanges, FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, flattenFileTree, indexFileTree, initialExpanded, normalizePath, revealInWindow, typeaheadIndex, type BuildFileTreeOptions, type ChangeCounts, type FileChangeInput, type FileChangeKind, type FileTreeBuild, type FileTreeExpansion, type FileTreeNode, type FileTreeRow, type RowWindow, } from './build-file-tree';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/file-tree/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EACL,aAAa,EACb,WAAW,EACX,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,cAAc,EACd,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,GACf,MAAM,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, normalizePath, revealInWindow, typeaheadIndex } from "./build-file-tree.js";
|
|
2
|
+
import { FILE_TREE_MAX_ROWS, FileTree } from "./file-tree.js";
|
|
3
|
+
export { FILE_CHANGE_LABELS, FILE_TREE_AUTO_EXPAND_LIMIT, FILE_TREE_MAX_DEPTH, FILE_TREE_MAX_ROWS, FileTree, buildFileTree, clampWindow, countChanges, describeChanges, flattenFileTree, indexFileTree, initialExpanded, normalizePath, revealInWindow, typeaheadIndex };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Source } from '../sources/source';
|
|
2
|
+
/**
|
|
3
|
+
* The text on a citation badge.
|
|
4
|
+
*
|
|
5
|
+
* A 1-based `index` wins, because a number is what the sentence's own markers
|
|
6
|
+
* and the Sources list use. Without one the badge shows the source's host (read
|
|
7
|
+
* from the parsed URL, so it cannot be spoofed by a title), then a clipped title,
|
|
8
|
+
* and only then a neutral word — never an invented number.
|
|
9
|
+
*/
|
|
10
|
+
export declare function citationLabel(index: number | undefined, source: Source | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* The badge's accessible name. The visible label is a number or a host, which
|
|
13
|
+
* says nothing on its own, so the name carries the title and host: a screen-reader
|
|
14
|
+
* or voice-control user learns what is cited without opening the popover.
|
|
15
|
+
*/
|
|
16
|
+
export declare function citationName(sources: readonly Source[], index: number | undefined): string;
|
|
17
|
+
/** Wrap a position into 0..count-1, so Previous on the first source goes to the last. */
|
|
18
|
+
export declare function wrapIndex(position: number, count: number): number;
|
|
19
|
+
/**
|
|
20
|
+
* How a citation's popover is open.
|
|
21
|
+
*
|
|
22
|
+
* - `peek` is a hover or keyboard-focus preview: it does not take focus, and it
|
|
23
|
+
* goes away when the pointer or focus does.
|
|
24
|
+
* - `pinned` is a deliberate open (click, tap, Enter, Space): focus moves into
|
|
25
|
+
* the popover so its link and Previous/Next are reachable, and it stays until
|
|
26
|
+
* Escape, an outside press, or the badge is pressed again.
|
|
27
|
+
*
|
|
28
|
+
* A popover that only opened on hover would exclude keyboard and touch readers;
|
|
29
|
+
* one that only opened on press would make pointer users click to glance at a
|
|
30
|
+
* source. This is the smallest model that serves both, and it is a pure function
|
|
31
|
+
* so the awkward transitions (hover then click must pin, not toggle shut) are
|
|
32
|
+
* tested rather than argued about.
|
|
33
|
+
*/
|
|
34
|
+
export type CitationMode = 'closed' | 'peek' | 'pinned';
|
|
35
|
+
export type CitationEvent = 'enter' | 'leave' | 'focus' | 'blur' | 'press' | 'dismiss';
|
|
36
|
+
export declare function nextCitationMode(mode: CitationMode, event: CitationEvent): CitationMode;
|
|
37
|
+
//# sourceMappingURL=citation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/inline-citation/citation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAKnF;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAQ3F;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAU1F;AAED,yFAAyF;AACzF,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjE;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;AACvD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;AAEtF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,GAAG,YAAY,CAavF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { boundText, sourceHost, sourceTitle } from "../sources/source.js";
|
|
2
|
+
//#region src/components/composites/inline-citation/citation.ts
|
|
3
|
+
/** Characters of a host or title that fit in a badge before it is clipped. */
|
|
4
|
+
var LABEL_LIMIT = 24;
|
|
5
|
+
/**
|
|
6
|
+
* The text on a citation badge.
|
|
7
|
+
*
|
|
8
|
+
* A 1-based `index` wins, because a number is what the sentence's own markers
|
|
9
|
+
* and the Sources list use. Without one the badge shows the source's host (read
|
|
10
|
+
* from the parsed URL, so it cannot be spoofed by a title), then a clipped title,
|
|
11
|
+
* and only then a neutral word — never an invented number.
|
|
12
|
+
*/
|
|
13
|
+
function citationLabel(index, source) {
|
|
14
|
+
if (index !== void 0 && Number.isInteger(index) && index >= 1 && index <= 9999) return String(index);
|
|
15
|
+
if (source === void 0) return "source";
|
|
16
|
+
const host = sourceHost(source.url);
|
|
17
|
+
if (host !== void 0) return boundText(host, LABEL_LIMIT);
|
|
18
|
+
return boundText(source.title, LABEL_LIMIT) || "source";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The badge's accessible name. The visible label is a number or a host, which
|
|
22
|
+
* says nothing on its own, so the name carries the title and host: a screen-reader
|
|
23
|
+
* or voice-control user learns what is cited without opening the popover.
|
|
24
|
+
*/
|
|
25
|
+
function citationName(sources, index) {
|
|
26
|
+
const first = sources[0];
|
|
27
|
+
if (first === void 0) return "Citation";
|
|
28
|
+
const label = citationLabel(index, first);
|
|
29
|
+
if (sources.length > 1) return `Sources ${label} and ${sources.length - 1} more`;
|
|
30
|
+
const host = sourceHost(first.url);
|
|
31
|
+
const title = sourceTitle(first);
|
|
32
|
+
return host !== void 0 && host !== title ? `Source ${label}: ${title}, ${host}` : `Source ${label}: ${title}`;
|
|
33
|
+
}
|
|
34
|
+
/** Wrap a position into 0..count-1, so Previous on the first source goes to the last. */
|
|
35
|
+
function wrapIndex(position, count) {
|
|
36
|
+
if (count <= 0) return 0;
|
|
37
|
+
return (position % count + count) % count;
|
|
38
|
+
}
|
|
39
|
+
function nextCitationMode(mode, event) {
|
|
40
|
+
switch (event) {
|
|
41
|
+
case "press": return mode === "pinned" ? "closed" : "pinned";
|
|
42
|
+
case "dismiss": return "closed";
|
|
43
|
+
case "enter":
|
|
44
|
+
case "focus": return mode === "closed" ? "peek" : mode;
|
|
45
|
+
case "leave":
|
|
46
|
+
case "blur": return mode === "peek" ? "closed" : mode;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { citationLabel, citationName, nextCitationMode, wrapIndex };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=citation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation.js","names":[],"sources":["../../../../src/components/composites/inline-citation/citation.ts"],"sourcesContent":["import { boundText, sourceHost, sourceTitle, type Source } from '../sources/source'\n\n/** Characters of a host or title that fit in a badge before it is clipped. */\nconst LABEL_LIMIT = 24\n\n/**\n * The text on a citation badge.\n *\n * A 1-based `index` wins, because a number is what the sentence's own markers\n * and the Sources list use. Without one the badge shows the source's host (read\n * from the parsed URL, so it cannot be spoofed by a title), then a clipped title,\n * and only then a neutral word — never an invented number.\n */\nexport function citationLabel(index: number | undefined, source: Source | undefined): string {\n if (index !== undefined && Number.isInteger(index) && index >= 1 && index <= 9999) {\n return String(index)\n }\n if (source === undefined) return 'source'\n const host = sourceHost(source.url)\n if (host !== undefined) return boundText(host, LABEL_LIMIT)\n return boundText(source.title, LABEL_LIMIT) || 'source'\n}\n\n/**\n * The badge's accessible name. The visible label is a number or a host, which\n * says nothing on its own, so the name carries the title and host: a screen-reader\n * or voice-control user learns what is cited without opening the popover.\n */\nexport function citationName(sources: readonly Source[], index: number | undefined): string {\n const first = sources[0]\n if (first === undefined) return 'Citation'\n const label = citationLabel(index, first)\n if (sources.length > 1) return `Sources ${label} and ${sources.length - 1} more`\n const host = sourceHost(first.url)\n const title = sourceTitle(first)\n return host !== undefined && host !== title\n ? `Source ${label}: ${title}, ${host}`\n : `Source ${label}: ${title}`\n}\n\n/** Wrap a position into 0..count-1, so Previous on the first source goes to the last. */\nexport function wrapIndex(position: number, count: number): number {\n if (count <= 0) return 0\n return ((position % count) + count) % count\n}\n\n/**\n * How a citation's popover is open.\n *\n * - `peek` is a hover or keyboard-focus preview: it does not take focus, and it\n * goes away when the pointer or focus does.\n * - `pinned` is a deliberate open (click, tap, Enter, Space): focus moves into\n * the popover so its link and Previous/Next are reachable, and it stays until\n * Escape, an outside press, or the badge is pressed again.\n *\n * A popover that only opened on hover would exclude keyboard and touch readers;\n * one that only opened on press would make pointer users click to glance at a\n * source. This is the smallest model that serves both, and it is a pure function\n * so the awkward transitions (hover then click must pin, not toggle shut) are\n * tested rather than argued about.\n */\nexport type CitationMode = 'closed' | 'peek' | 'pinned'\nexport type CitationEvent = 'enter' | 'leave' | 'focus' | 'blur' | 'press' | 'dismiss'\n\nexport function nextCitationMode(mode: CitationMode, event: CitationEvent): CitationMode {\n switch (event) {\n case 'press':\n return mode === 'pinned' ? 'closed' : 'pinned'\n case 'dismiss':\n return 'closed'\n case 'enter':\n case 'focus':\n return mode === 'closed' ? 'peek' : mode\n case 'leave':\n case 'blur':\n return mode === 'peek' ? 'closed' : mode\n }\n}\n"],"mappings":";;;AAGA,IAAM,cAAc;;;;;;;;;AAUpB,SAAgB,cAAc,OAA2B,QAAoC;CAC3F,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,KAAK,KAAK,SAAS,KAAK,SAAS,MAC3E,OAAO,OAAO,KAAK;CAErB,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,MAAM,OAAO,WAAW,OAAO,GAAG;CAClC,IAAI,SAAS,KAAA,GAAW,OAAO,UAAU,MAAM,WAAW;CAC1D,OAAO,UAAU,OAAO,OAAO,WAAW,KAAK;AACjD;;;;;;AAOA,SAAgB,aAAa,SAA4B,OAAmC;CAC1F,MAAM,QAAQ,QAAQ;CACtB,IAAI,UAAU,KAAA,GAAW,OAAO;CAChC,MAAM,QAAQ,cAAc,OAAO,KAAK;CACxC,IAAI,QAAQ,SAAS,GAAG,OAAO,WAAW,MAAM,OAAO,QAAQ,SAAS,EAAE;CAC1E,MAAM,OAAO,WAAW,MAAM,GAAG;CACjC,MAAM,QAAQ,YAAY,KAAK;CAC/B,OAAO,SAAS,KAAA,KAAa,SAAS,QAClC,UAAU,MAAM,IAAI,MAAM,IAAI,SAC9B,UAAU,MAAM,IAAI;AAC1B;;AAGA,SAAgB,UAAU,UAAkB,OAAuB;CACjE,IAAI,SAAS,GAAG,OAAO;CACvB,QAAS,WAAW,QAAS,SAAS;AACxC;AAoBA,SAAgB,iBAAiB,MAAoB,OAAoC;CACvF,QAAQ,OAAR;EACE,KAAK,SACH,OAAO,SAAS,WAAW,WAAW;EACxC,KAAK,WACH,OAAO;EACT,KAAK;EACL,KAAK,SACH,OAAO,SAAS,WAAW,SAAS;EACtC,KAAK;EACL,KAAK,QACH,OAAO,SAAS,SAAS,WAAW;CACxC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/inline-citation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC9F,OAAO,EACL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { MessageCitations } from '../../ui/message';
|
|
2
|
+
import { type Source } from '../sources/source';
|
|
3
|
+
/**
|
|
4
|
+
* InlineCitation.
|
|
5
|
+
*
|
|
6
|
+
* A small badge inside a sentence — "1", or a host — that opens the source(s)
|
|
7
|
+
* behind the claim: title, host, address, snippet, and Previous/Next when several
|
|
8
|
+
* sources share one marker. It is an inline element for prose such as
|
|
9
|
+
* `MessageText`: it never breaks across lines, stays on the text baseline, and
|
|
10
|
+
* adds no block of its own. For the list of everything a reply used, reach for
|
|
11
|
+
* `Sources`; the two number sources the same way.
|
|
12
|
+
*
|
|
13
|
+
* ## One popover, two ways to open it
|
|
14
|
+
*
|
|
15
|
+
* A hover card would exclude everyone who is not holding a mouse, so this is a
|
|
16
|
+
* `Popover` that a pointer can also *peek* at:
|
|
17
|
+
*
|
|
18
|
+
* - **Hover or keyboard focus peeks.** The popover opens without taking focus
|
|
19
|
+
* and closes when the pointer or focus leaves. Touch has no hover, so a touch
|
|
20
|
+
* never peeks.
|
|
21
|
+
* - **Click, tap, Enter or Space pins.** Focus moves into the popover so its
|
|
22
|
+
* link and Previous/Next are reachable; it stays until Escape, an outside press,
|
|
23
|
+
* or the badge is pressed again, and focus returns to the badge. Pressing a badge
|
|
24
|
+
* that is only peeking pins it rather than toggling it shut — the transitions
|
|
25
|
+
* are the pure `nextCitationMode`.
|
|
26
|
+
*
|
|
27
|
+
* Kobalte's trigger toggles on every press, so `open` is controlled and its own
|
|
28
|
+
* close request is ignored for the press that we already decided (`pressing`).
|
|
29
|
+
* Without that, hover-then-click, the commonest pointer path, would close the card.
|
|
30
|
+
*
|
|
31
|
+
* ## It makes no claim without sources
|
|
32
|
+
*
|
|
33
|
+
* No sources renders nothing: a marker that points nowhere is not a citation.
|
|
34
|
+
* The address is a link only when `safeSourceUrl` allows it; the host comes from
|
|
35
|
+
* the parsed URL; titles and snippets are clipped, cleaned of direction
|
|
36
|
+
* overrides and rendered as text. The badge's accessible name carries the title
|
|
37
|
+
* and host (the visible label is only a number or a host), so a reader hears
|
|
38
|
+
* what is cited without opening anything.
|
|
39
|
+
*/
|
|
40
|
+
export type InlineCitationProps = {
|
|
41
|
+
/** One source, or several that support the same claim. */
|
|
42
|
+
sources: readonly Source[];
|
|
43
|
+
/**
|
|
44
|
+
* The 1-based number to show, matching the source's position in `Sources`.
|
|
45
|
+
* Omit it to show the host instead; a number is never guessed.
|
|
46
|
+
*/
|
|
47
|
+
index?: number;
|
|
48
|
+
/** Milliseconds a pointer rests before the peek opens. */
|
|
49
|
+
hoverDelay?: number;
|
|
50
|
+
class?: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function InlineCitation(props: InlineCitationProps): import("solid-js").JSX.Element;
|
|
53
|
+
/**
|
|
54
|
+
* Citation markers for `MessageText`, from the sources a reply really used.
|
|
55
|
+
*
|
|
56
|
+
* `[^2]` in the text becomes the second source's badge; `[^1,3]` one badge for
|
|
57
|
+
* sources 1 and 3. A number beyond the list leaves the marker as written, and an
|
|
58
|
+
* empty list makes every marker literal, so text can never cite a source the host
|
|
59
|
+
* did not supply.
|
|
60
|
+
*
|
|
61
|
+
* <MessageText text={reply} citations={messageCitations(sources)} />
|
|
62
|
+
*/
|
|
63
|
+
export declare function messageCitations(sources: readonly Source[]): MessageCitations;
|
|
64
|
+
//# sourceMappingURL=inline-citation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-citation.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/inline-citation/inline-citation.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAGxD,OAAO,EAML,KAAK,MAAM,EACZ,MAAM,mBAAmB,CAAA;AAU1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,0DAA0D;IAC1D,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAID,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,kCAiJxD;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,gBAAgB,CAa7E"}
|