@zyro-sec/session-ui 0.0.0-stage → 1.0.4
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/AGENTS.md +25 -0
- package/bunfig.toml +2 -0
- package/component-tests/basic-tool.fixture.tsx +46 -0
- package/component-tests/basic-tool.spec.ts +63 -0
- package/component-tests/file-media.fixture.tsx +39 -0
- package/component-tests/file-media.spec.ts +13 -0
- package/component-tests/file-tool.spec.ts +62 -0
- package/component-tests/file-viewer.fixture.tsx +109 -0
- package/component-tests/file-viewer.spec.ts +134 -0
- package/component-tests/file.spec.ts +33 -0
- package/component-tests/line-comment-v2.spec.ts +15 -0
- package/component-tests/markdown-code-wrap.spec.ts +94 -0
- package/component-tests/markdown-readiness.spec.ts +95 -0
- package/component-tests/markdown.fixture.tsx +104 -0
- package/component-tests/markdown.spec.ts +1564 -0
- package/component-tests/mermaid-preview.spec.ts +43 -0
- package/component-tests/patch-group.spec.ts +79 -0
- package/component-tests/read-group.spec.ts +72 -0
- package/component-tests/read-image.fixture.tsx +66 -0
- package/component-tests/read-image.spec.ts +154 -0
- package/component-tests/session-compaction.spec.ts +254 -0
- package/component-tests/session-lifecycle.spec.ts +190 -0
- package/component-tests/session-message-projection.spec.ts +639 -0
- package/component-tests/session-notice-projection.spec.ts +20 -0
- package/component-tests/session-review-comments.spec.ts +179 -0
- package/component-tests/session-shell.spec.ts +93 -0
- package/component-tests/session-timeline-mobile.spec.ts +201 -0
- package/component-tests/session-timeline-notices.spec.ts +38 -0
- package/component-tests/session-timeline-reasoning.spec.ts +107 -0
- package/component-tests/session-timeline.spec.ts +157 -0
- package/component-tests/session-tool-projection.spec.ts +323 -0
- package/component-tests/text-lifecycle.fixture.tsx +26 -0
- package/component-tests/text-lifecycle.spec.ts +42 -0
- package/component-tests/timeline-subagent-rows.spec.ts +33 -0
- package/component-tests/tool-disclosure.spec.ts +48 -0
- package/component-tests/tool-group-sticky.spec.ts +37 -0
- package/component-tests/tool-group.spec.ts +290 -0
- package/component-tests/tool-status-title.fixture.tsx +22 -0
- package/component-tests/tool-status-title.spec.ts +30 -0
- package/component-tests/user-message-quotes.spec.ts +111 -0
- package/package.json +91 -4
- package/playwright.components.config.ts +4 -0
- package/playwright.local.config.ts +2 -0
- package/src/actions.ts +54 -0
- package/src/components/apply-patch-file.ts +122 -0
- package/src/components/basic-tool.css +487 -0
- package/src/components/basic-tool.tsx +258 -0
- package/src/components/copy-machine.ts +78 -0
- package/src/components/copy.ts +85 -0
- package/src/components/diagram-preview.tsx +28 -0
- package/src/components/disclosure-machine.ts +188 -0
- package/src/components/disclosure.ts +129 -0
- package/src/components/dock-prompt.stories.tsx +73 -0
- package/src/components/dock-prompt.tsx +29 -0
- package/src/components/file-comment-selection.tsx +146 -0
- package/src/components/file-media-machine.ts +165 -0
- package/src/components/file-media.stories.tsx +112 -0
- package/src/components/file-media.tsx +323 -0
- package/src/components/file-search.tsx +73 -0
- package/src/components/file.css +59 -0
- package/src/components/file.tsx +1300 -0
- package/src/components/image-preview.tsx +35 -0
- package/src/components/line-comment-annotations.tsx +580 -0
- package/src/components/line-comment-machine.ts +262 -0
- package/src/components/line-comment-styles.ts +293 -0
- package/src/components/line-comment.stories.tsx +152 -0
- package/src/components/line-comment.tsx +448 -0
- package/src/components/link-segments.ts +20 -0
- package/src/components/linked-text.tsx +21 -0
- package/src/components/markdown-cache-machine.ts +257 -0
- package/src/components/markdown-cache.tsx +556 -0
- package/src/components/markdown-clipboard.ts +101 -0
- package/src/components/markdown-code-machine.ts +200 -0
- package/src/components/markdown-code-state.ts +22 -0
- package/src/components/markdown-fragment-links.ts +74 -0
- package/src/components/markdown-github.svg +3 -0
- package/src/components/markdown-globe.svg +5 -0
- package/src/components/markdown-image-machine.ts +170 -0
- package/src/components/markdown-image.ts +156 -0
- package/src/components/markdown-inline-code-kind.ts +39 -0
- package/src/components/markdown-mermaid.ts +18 -0
- package/src/components/markdown-phase-machine.ts +102 -0
- package/src/components/markdown-projection.ts +13 -0
- package/src/components/markdown-session-links.ts +183 -0
- package/src/components/markdown-solid.test.tsx +92 -0
- package/src/components/markdown-solid.tsx +113 -0
- package/src/components/markdown-stream.ts +95 -0
- package/src/components/markdown-worker-machine.ts +516 -0
- package/src/components/markdown-worker-protocol.ts +73 -0
- package/src/components/markdown-worker.ts +250 -0
- package/src/components/markdown.css +672 -0
- package/src/components/markdown.stories.tsx +199 -0
- package/src/components/markdown.tsx +1612 -0
- package/src/components/markdown.worker.ts +188 -0
- package/src/components/message-file.ts +102 -0
- package/src/components/message-nav.css +134 -0
- package/src/components/message-nav.tsx +159 -0
- package/src/components/message-part.css +2109 -0
- package/src/components/message-part.tsx +3 -0
- package/src/components/question-prompt-experimental.css +576 -0
- package/src/components/question-prompt.css +527 -0
- package/src/components/quote-highlight.css +59 -0
- package/src/components/review-focus-driver.ts +142 -0
- package/src/components/review-focus-machine.ts +95 -0
- package/src/components/session-compaction.css +270 -0
- package/src/components/session-diff.ts +358 -0
- package/src/components/session-error.tsx +41 -0
- package/src/components/session-retry.tsx +92 -0
- package/src/components/session-review-machine.ts +241 -0
- package/src/components/session-review.css +264 -0
- package/src/components/session-review.stories.tsx +232 -0
- package/src/components/session-review.tsx +733 -0
- package/src/components/session-turn.css +282 -0
- package/src/components/shell-submessage.css +24 -0
- package/src/components/timeline-separator.tsx +69 -0
- package/src/components/tool-count-label.css +57 -0
- package/src/components/tool-count-label.tsx +76 -0
- package/src/components/tool-count-summary.css +102 -0
- package/src/components/tool-count-summary.stories.tsx +99 -0
- package/src/components/tool-count-summary.tsx +44 -0
- package/src/components/tool-error-card.css +178 -0
- package/src/components/tool-error-card.stories.tsx +113 -0
- package/src/components/tool-error-card.tsx +202 -0
- package/src/components/tool-status-title-machine.ts +128 -0
- package/src/components/tool-status-title.css +89 -0
- package/src/components/tool-status-title.tsx +163 -0
- package/src/context/data.tsx +107 -0
- package/src/context/index.ts +1 -0
- package/src/context/markdown.tsx +129 -0
- package/src/context/sources.tsx +34 -0
- package/src/document.ts +8 -0
- package/src/file-presentation.ts +34 -0
- package/src/message/action-machine.ts +72 -0
- package/src/message/agent-label.ts +3 -0
- package/src/message/attachment-card.css +119 -0
- package/src/message/attachment-card.tsx +40 -0
- package/src/message/attachment-media-machine.ts +213 -0
- package/src/message/comment-card.tsx +155 -0
- package/src/message/compaction-entrance-machine.ts +93 -0
- package/src/message/current-message.tsx +157 -0
- package/src/message/current-tool-state.ts +161 -0
- package/src/message/message-content.tsx +1391 -0
- package/src/message/paced-text-machine.ts +73 -0
- package/src/message/prompt-message.stories.tsx +149 -0
- package/src/message/relative-time.ts +45 -0
- package/src/message/user-message-quote-parts.ts +16 -0
- package/src/message/user-message-quotes.stories.tsx +797 -0
- package/src/message/user-message-quotes.tsx +135 -0
- package/src/pierre/comment-hover-machine.ts +53 -0
- package/src/pierre/comment-hover.ts +131 -0
- package/src/pierre/comment-selection-machine.ts +257 -0
- package/src/pierre/commented-lines.ts +106 -0
- package/src/pierre/diff-selection.ts +91 -0
- package/src/pierre/file-find-machine.ts +323 -0
- package/src/pierre/file-find.ts +537 -0
- package/src/pierre/file-runtime.ts +42 -0
- package/src/pierre/file-selection.ts +140 -0
- package/src/pierre/index.ts +344 -0
- package/src/pierre/media.ts +140 -0
- package/src/pierre/render-machine.ts +381 -0
- package/src/pierre/selection-bridge.ts +82 -0
- package/src/pierre/selection-machine.ts +198 -0
- package/src/pierre/virtualizer.ts +114 -0
- package/src/pierre/worker.ts +46 -0
- package/src/sources/experiment.ts +59 -0
- package/src/sources/site-icon.tsx +53 -0
- package/src/sources/sources-chip.tsx +57 -0
- package/src/sources/sources-expand-machine.ts +101 -0
- package/src/sources/sources-panel.tsx +249 -0
- package/src/sources/sources-title.tsx +21 -0
- package/src/sources/sources.css +266 -0
- package/src/sources/sources.ts +141 -0
- package/src/storybook/current-session-fixtures.ts +1492 -0
- package/src/storybook/current-session-scenarios.ts +76 -0
- package/src/storybook/current-session-story.tsx +154 -0
- package/src/storybook/index.ts +43 -0
- package/src/styles/index.css +19 -0
- package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
- package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
- package/src/timeline/code-blocks.stories.tsx +105 -0
- package/src/timeline/commentary.stories.tsx +70 -0
- package/src/timeline/commentary.ts +38 -0
- package/src/timeline/detail.ts +111 -0
- package/src/timeline/error-card.stories.tsx +134 -0
- package/src/timeline/error-spacing.stories.tsx +71 -0
- package/src/timeline/facts.ts +493 -0
- package/src/timeline/file-changes.stories.tsx +436 -0
- package/src/timeline/group-label-fixtures.ts +97 -0
- package/src/timeline/mermaid.stories.tsx +131 -0
- package/src/timeline/place.ts +280 -0
- package/src/timeline/placement-fixtures.ts +365 -0
- package/src/timeline/placement-reactivity.ts +133 -0
- package/src/timeline/projection.ts +1261 -0
- package/src/timeline/research-and-agents.stories.tsx +461 -0
- package/src/timeline/session-timeline-row.tsx +1675 -0
- package/src/timeline/session-timeline.tsx +68 -0
- package/src/timeline/steer-arrival-machine.ts +134 -0
- package/src/timeline/terminal-work.stories.tsx +464 -0
- package/src/timeline/timeline-row.stories.tsx +1069 -0
- package/src/timeline/timeline-row.ts +238 -0
- package/src/timeline/turn-phase-machine.ts +112 -0
- package/src/timeline/user-message-fold.stories.tsx +194 -0
- package/src/timeline/user-runs.ts +87 -0
- package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
- package/src/timeline-next/compaction.tsx +236 -0
- package/src/timeline-next/errors.ts +101 -0
- package/src/timeline-next/event-row.tsx +168 -0
- package/src/timeline-next/events.ts +103 -0
- package/src/timeline-next/index.ts +10 -0
- package/src/timeline-next/nested-rail.ts +125 -0
- package/src/timeline-next/projection.ts +1028 -0
- package/src/timeline-next/row.tsx +1728 -0
- package/src/timeline-next/rules.ts +89 -0
- package/src/timeline-next/separator.tsx +73 -0
- package/src/timeline-next/spacing.ts +127 -0
- package/src/timeline-next/status-line.tsx +41 -0
- package/src/timeline-next/status.ts +33 -0
- package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
- package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
- package/src/timeline-next/stories/compare.stories.tsx +486 -0
- package/src/timeline-next/stories/playground.stories.tsx +297 -0
- package/src/timeline-next/stories/session-replay.ts +1156 -0
- package/src/timeline-next/stories/session-timeline.tsx +50 -0
- package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
- package/src/timeline-next/timeline-next.css +649 -0
- package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
- package/src/timeline-next/tools/activity-label.ts +166 -0
- package/src/timeline-next/tools/assistant-content.tsx +84 -0
- package/src/timeline-next/tools/context-group.tsx +619 -0
- package/src/timeline-next/tools/error-card.tsx +147 -0
- package/src/timeline-next/tools/explore.tsx +119 -0
- package/src/timeline-next/tools/file-group.tsx +128 -0
- package/src/timeline-next/tools/patch.tsx +174 -0
- package/src/timeline-next/tools/shell.tsx +186 -0
- package/src/timeline-next/tools/thought.tsx +87 -0
- package/src/timeline-next/tools/tool-display.tsx +119 -0
- package/src/tools/ansi.ts +8 -0
- package/src/tools/context-group-label.ts +123 -0
- package/src/tools/file-runs.ts +35 -0
- package/src/tools/project-path.ts +18 -0
- package/src/tools/read-group.stories.tsx +159 -0
- package/src/tools/run-machine.ts +185 -0
- package/src/tools/shell-output-machine.ts +233 -0
- package/src/tools/shell-output.ts +91 -0
- package/src/tools/subagent-row-variants.stories.tsx +129 -0
- package/src/tools/tool-group.stories.tsx +345 -0
- package/src/tools/tool-renderer.tsx +2876 -0
- package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
- package/src/v2/components/session-file-panel-v2.tsx +149 -0
- package/src/v2/components/session-progress-indicator-v2.css +5 -0
- package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
- package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
- package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
- package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
- package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
- package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
- package/src/v2/components/session-review-v2.css +653 -0
- package/src/v2/components/session-review-v2.tsx +422 -0
- package/src/v2/components/sidebar-presence-machine.ts +69 -0
- package/tsconfig.json +20 -0
- package/README.md +0 -3
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { type SelectedLineRange } from "@pierre/diffs"
|
|
2
|
+
import { Show, type Accessor, type JSX } from "solid-js"
|
|
3
|
+
import {
|
|
4
|
+
createLineCommentAnnotations,
|
|
5
|
+
createLineCommentDriver,
|
|
6
|
+
createLineCommentGutterRenderer,
|
|
7
|
+
createManagedLineCommentAnnotationRenderer,
|
|
8
|
+
type LineCommentMachine,
|
|
9
|
+
type SavedLineComment,
|
|
10
|
+
} from "../../components/line-comment-annotations"
|
|
11
|
+
import { viewCommentItem } from "../../components/line-comment-machine"
|
|
12
|
+
import { useI18n } from "@zyro-sec/ui/context/i18n"
|
|
13
|
+
import {
|
|
14
|
+
LineCommentEditor,
|
|
15
|
+
LineComment,
|
|
16
|
+
type LineCommentEditorMention,
|
|
17
|
+
type LineCommentEditorProps,
|
|
18
|
+
} from "@zyro-sec/ui/line-comment"
|
|
19
|
+
|
|
20
|
+
export type LineCommentSendAction = {
|
|
21
|
+
label: string
|
|
22
|
+
keys: string[]
|
|
23
|
+
disabled: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type LineCommentControllerV2Props<T extends SavedLineComment> = {
|
|
27
|
+
comments: Accessor<T[]>
|
|
28
|
+
draftKey: Accessor<string>
|
|
29
|
+
label: string
|
|
30
|
+
machine?: LineCommentMachine
|
|
31
|
+
onSyncSelected?: (range: SelectedLineRange | null) => void
|
|
32
|
+
getSide: (range: SelectedLineRange) => "additions" | "deletions"
|
|
33
|
+
onSubmit: (input: { comment: string; selection: SelectedLineRange; send: boolean }) => void
|
|
34
|
+
onUpdate?: (input: { id: string; comment: string; selection: SelectedLineRange; send: boolean }) => void
|
|
35
|
+
onDelete?: (comment: T) => void
|
|
36
|
+
renderCommentActions?: (comment: T, controls: { edit: VoidFunction; remove: VoidFunction }) => JSX.Element
|
|
37
|
+
editSubmitLabel?: string
|
|
38
|
+
mention?: LineCommentEditorMention
|
|
39
|
+
send?: Accessor<LineCommentSendAction | undefined>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type CommentProps = {
|
|
43
|
+
id?: string
|
|
44
|
+
comment: JSX.Element
|
|
45
|
+
actions?: JSX.Element
|
|
46
|
+
editor?: DraftProps
|
|
47
|
+
onOpen?: VoidFunction
|
|
48
|
+
onClick?: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent>
|
|
49
|
+
onMouseEnter?: JSX.EventHandlerUnion<HTMLDivElement, MouseEvent>
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
type DraftProps = {
|
|
53
|
+
value: string
|
|
54
|
+
onInput: (value: string) => void
|
|
55
|
+
onCancel: VoidFunction
|
|
56
|
+
onSubmit: (value: string) => void
|
|
57
|
+
alternateSubmit?: LineCommentEditorProps["alternateSubmit"]
|
|
58
|
+
cancelLabel?: string
|
|
59
|
+
submitLabel?: string
|
|
60
|
+
mention?: LineCommentEditorMention
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function lineCommentElementV2(view: Accessor<CommentProps>) {
|
|
64
|
+
return (
|
|
65
|
+
<Show
|
|
66
|
+
when={view().editor}
|
|
67
|
+
fallback={
|
|
68
|
+
<div
|
|
69
|
+
data-prevent-autofocus=""
|
|
70
|
+
data-comment-id={view().id}
|
|
71
|
+
onMouseDown={(event) => event.stopPropagation()}
|
|
72
|
+
onClick={view().onClick}
|
|
73
|
+
onMouseEnter={view().onMouseEnter}
|
|
74
|
+
>
|
|
75
|
+
<LineComment comment={view().comment} actions={view().actions} onOpen={view().onOpen} />
|
|
76
|
+
</div>
|
|
77
|
+
}
|
|
78
|
+
>
|
|
79
|
+
{(editor) => (
|
|
80
|
+
<div data-prevent-autofocus="" data-comment-id={view().id} onMouseDown={(event) => event.stopPropagation()}>
|
|
81
|
+
<LineCommentEditor
|
|
82
|
+
value={editor().value}
|
|
83
|
+
onInput={editor().onInput}
|
|
84
|
+
onCancel={editor().onCancel}
|
|
85
|
+
onSubmit={editor().onSubmit}
|
|
86
|
+
alternateSubmit={editor().alternateSubmit}
|
|
87
|
+
cancelLabel={editor().cancelLabel}
|
|
88
|
+
submitLabel={editor().submitLabel}
|
|
89
|
+
mention={editor().mention}
|
|
90
|
+
/>
|
|
91
|
+
</div>
|
|
92
|
+
)}
|
|
93
|
+
</Show>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function lineCommentDraftElementV2(view: Accessor<DraftProps>) {
|
|
98
|
+
return (
|
|
99
|
+
<div data-prevent-autofocus="" onMouseDown={(event) => event.stopPropagation()}>
|
|
100
|
+
<LineCommentEditor
|
|
101
|
+
value={view().value}
|
|
102
|
+
onInput={view().onInput}
|
|
103
|
+
onCancel={view().onCancel}
|
|
104
|
+
onSubmit={view().onSubmit}
|
|
105
|
+
alternateSubmit={view().alternateSubmit}
|
|
106
|
+
cancelLabel={view().cancelLabel}
|
|
107
|
+
submitLabel={view().submitLabel}
|
|
108
|
+
mention={view().mention}
|
|
109
|
+
/>
|
|
110
|
+
</div>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function createLineCommentControllerV2<T extends SavedLineComment>(props: LineCommentControllerV2Props<T>) {
|
|
115
|
+
const i18n = useI18n()
|
|
116
|
+
const driver = createLineCommentDriver(props)
|
|
117
|
+
|
|
118
|
+
const alternateSubmit = (submit: (text: string) => void) => {
|
|
119
|
+
const send = props.send?.()
|
|
120
|
+
|
|
121
|
+
return send && { ...send, onSubmit: submit }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const annotations = createLineCommentAnnotations({
|
|
125
|
+
comments: props.comments,
|
|
126
|
+
getCommentId: (comment) => comment.id,
|
|
127
|
+
getCommentSelection: (comment) => comment.selection,
|
|
128
|
+
draftRange: () => driver.view().draftRange,
|
|
129
|
+
draftKey: props.draftKey,
|
|
130
|
+
getSide: props.getSide,
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
const { renderAnnotation } = createManagedLineCommentAnnotationRenderer<T, CommentProps, DraftProps>({
|
|
134
|
+
annotations,
|
|
135
|
+
commentElement: lineCommentElementV2,
|
|
136
|
+
draftElement: lineCommentDraftElementV2,
|
|
137
|
+
renderComment: (comment) => {
|
|
138
|
+
const item = () => viewCommentItem(driver.mode(), comment.id)
|
|
139
|
+
|
|
140
|
+
const edit = () =>
|
|
141
|
+
driver.send({ type: "edit.opened", id: comment.id, range: comment.selection, text: comment.comment })
|
|
142
|
+
|
|
143
|
+
const remove = () => driver.send({ type: "comment.deleted", id: comment.id }, comment)
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
id: comment.id,
|
|
147
|
+
comment: comment.comment,
|
|
148
|
+
// A comment with actions (its menu offers Edit) also opens its editor from a click on the card.
|
|
149
|
+
onOpen: props.renderCommentActions ? edit : undefined,
|
|
150
|
+
get actions() {
|
|
151
|
+
return props.renderCommentActions?.(comment, { edit, remove })
|
|
152
|
+
},
|
|
153
|
+
get editor() {
|
|
154
|
+
return item().editing
|
|
155
|
+
? {
|
|
156
|
+
get value() {
|
|
157
|
+
return item().editText
|
|
158
|
+
},
|
|
159
|
+
onInput: (text: string) => driver.send({ type: "edit.changed", text }),
|
|
160
|
+
onCancel: () => driver.send({ type: "edit.cancelled" }),
|
|
161
|
+
onSubmit: (text: string) => driver.send({ type: "edit.submitted", text }),
|
|
162
|
+
get alternateSubmit() {
|
|
163
|
+
return alternateSubmit((text) => driver.send({ type: "edit.submitted", text, send: true }))
|
|
164
|
+
},
|
|
165
|
+
cancelLabel: i18n.t("ui.lineComment.cancel"),
|
|
166
|
+
submitLabel: props.editSubmitLabel,
|
|
167
|
+
mention: props.mention,
|
|
168
|
+
}
|
|
169
|
+
: undefined
|
|
170
|
+
},
|
|
171
|
+
onMouseEnter: () => driver.send({ type: "comment.hovered", range: comment.selection }),
|
|
172
|
+
onClick: () => {
|
|
173
|
+
if (props.renderCommentActions) return
|
|
174
|
+
driver.send({ type: "comment.toggled", id: comment.id, range: comment.selection })
|
|
175
|
+
},
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
renderDraft: () => ({
|
|
179
|
+
get value() {
|
|
180
|
+
return driver.view().draftText
|
|
181
|
+
},
|
|
182
|
+
onInput: (text) => driver.send({ type: "draft.changed", text }),
|
|
183
|
+
onCancel: () => driver.send({ type: "draft.cancelled" }),
|
|
184
|
+
onSubmit: (text) => driver.send({ type: "draft.submitted", text }),
|
|
185
|
+
get alternateSubmit() {
|
|
186
|
+
return alternateSubmit((text) => driver.send({ type: "draft.submitted", text, send: true }))
|
|
187
|
+
},
|
|
188
|
+
cancelLabel: i18n.t("ui.lineComment.cancel"),
|
|
189
|
+
submitLabel: i18n.t("ui.lineComment.submit"),
|
|
190
|
+
mention: props.mention,
|
|
191
|
+
}),
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
return {
|
|
195
|
+
mode: driver.mode,
|
|
196
|
+
selected: () => driver.view().selected,
|
|
197
|
+
focusComment: driver.focusComment,
|
|
198
|
+
clearPassive: driver.clearPassive,
|
|
199
|
+
reset: driver.reset,
|
|
200
|
+
annotations,
|
|
201
|
+
renderAnnotation,
|
|
202
|
+
renderGutterUtility: createLineCommentGutterRenderer({
|
|
203
|
+
label: props.label,
|
|
204
|
+
getSelectedRange: () => driver.view().gutterSelected,
|
|
205
|
+
onOpenDraft: (range) => driver.send({ type: "draft.opened", range }),
|
|
206
|
+
}),
|
|
207
|
+
onLineSelected: (range: SelectedLineRange | null) => driver.send({ type: "line.selected", range }),
|
|
208
|
+
onLineSelectionEnd: (range: SelectedLineRange | null) => driver.send({ type: "line.selection-ended", range }),
|
|
209
|
+
/** Opens a draft on text selected in the code. Unset while a saved comment is edited, which keeps its range. */
|
|
210
|
+
commentSelection: () =>
|
|
211
|
+
driver.mode().status === "editing"
|
|
212
|
+
? undefined
|
|
213
|
+
: (range: SelectedLineRange) => driver.send({ type: "draft.opened", range }),
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { useI18n } from "@zyro-sec/ui/context/i18n"
|
|
2
|
+
import { Menu } from "@zyro-sec/ui/menu"
|
|
3
|
+
import { useLocale } from "@kobalte/core/i18n"
|
|
4
|
+
import { Show, type JSX, type ParentProps } from "solid-js"
|
|
5
|
+
import "./session-review-v2.css"
|
|
6
|
+
|
|
7
|
+
/** The edge of the panel the sidebar sits on: the inline start or end. */
|
|
8
|
+
export type SessionFilePanelV2SidebarSide = "start" | "end"
|
|
9
|
+
|
|
10
|
+
export function SessionFilePanelV2(props: {
|
|
11
|
+
sidebar?: JSX.Element
|
|
12
|
+
sidebarToggle?: JSX.Element
|
|
13
|
+
sidebarToggleGap?: 2 | 10
|
|
14
|
+
sidebarCollapsed?: boolean
|
|
15
|
+
/** Defaults to `start`. */
|
|
16
|
+
sidebarSide?: SessionFilePanelV2SidebarSide
|
|
17
|
+
/** Offers "Sidebar position" on right-click of the sidebar and its toggle. */
|
|
18
|
+
onSidebarSideChange?: (side: SessionFilePanelV2SidebarSide) => void
|
|
19
|
+
toolbar: boolean
|
|
20
|
+
toolbarStart?: JSX.Element
|
|
21
|
+
toolbarEnd?: JSX.Element
|
|
22
|
+
children?: JSX.Element
|
|
23
|
+
}) {
|
|
24
|
+
const side = () => props.sidebarSide ?? "start"
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
data-component="session-review-v2"
|
|
29
|
+
data-sidebar-toggle={props.sidebarToggle ? "" : undefined}
|
|
30
|
+
data-sidebar-toggle-gap={props.sidebarToggleGap}
|
|
31
|
+
data-sidebar-collapsed={props.sidebarCollapsed ? "" : undefined}
|
|
32
|
+
data-sidebar-side={side()}
|
|
33
|
+
>
|
|
34
|
+
<div data-slot="session-review-v2-sidebar-toggle">
|
|
35
|
+
<SessionFilePanelV2SideMenu side={side()} onChange={props.onSidebarSideChange} keyboard>
|
|
36
|
+
{props.sidebarToggle}
|
|
37
|
+
</SessionFilePanelV2SideMenu>
|
|
38
|
+
</div>
|
|
39
|
+
<div data-slot="session-review-v2-body">
|
|
40
|
+
<SessionFilePanelV2SideMenu side={side()} onChange={props.onSidebarSideChange}>
|
|
41
|
+
{props.sidebar}
|
|
42
|
+
</SessionFilePanelV2SideMenu>
|
|
43
|
+
<div data-slot="session-review-v2-preview">
|
|
44
|
+
<Show when={props.toolbar}>
|
|
45
|
+
<div data-slot="session-review-v2-toolbar">
|
|
46
|
+
<div data-slot="session-review-v2-toolbar-group" class="session-review-v2-toolbar-group--start">
|
|
47
|
+
{props.toolbarStart}
|
|
48
|
+
</div>
|
|
49
|
+
<Show when={props.toolbarEnd}>
|
|
50
|
+
{(toolbar) => (
|
|
51
|
+
<div data-slot="session-review-v2-toolbar-group" class="session-review-v2-toolbar-group--segments">
|
|
52
|
+
{toolbar()}
|
|
53
|
+
</div>
|
|
54
|
+
)}
|
|
55
|
+
</Show>
|
|
56
|
+
</div>
|
|
57
|
+
</Show>
|
|
58
|
+
{props.children}
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function SessionFilePanelV2SideMenu(
|
|
66
|
+
props: ParentProps<{
|
|
67
|
+
side: SessionFilePanelV2SidebarSide
|
|
68
|
+
onChange?: (side: SessionFilePanelV2SidebarSide) => void
|
|
69
|
+
keyboard?: boolean
|
|
70
|
+
}>,
|
|
71
|
+
) {
|
|
72
|
+
const i18n = useI18n()
|
|
73
|
+
const locale = useLocale()
|
|
74
|
+
const rtl = () => locale.direction() === "rtl"
|
|
75
|
+
const physical = () => ((props.side === "end") !== rtl() ? "right" : "left")
|
|
76
|
+
const logical = (value: string): SessionFilePanelV2SidebarSide => ((value === "right") !== rtl() ? "end" : "start")
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Show when={props.onChange} fallback={props.children}>
|
|
80
|
+
{(onChange) => (
|
|
81
|
+
<Menu.Context modal={false}>
|
|
82
|
+
<Menu.Context.Trigger
|
|
83
|
+
as="div"
|
|
84
|
+
data-slot="session-review-v2-side-menu-trigger"
|
|
85
|
+
on:contextmenu={{
|
|
86
|
+
capture: true,
|
|
87
|
+
handleEvent(event: MouseEvent) {
|
|
88
|
+
const element = event.target
|
|
89
|
+
|
|
90
|
+
// Text fields keep the system menu with Cut, Copy and Paste.
|
|
91
|
+
if (element instanceof HTMLElement && element.closest("input, textarea, [contenteditable]")) {
|
|
92
|
+
event.stopPropagation()
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}}
|
|
96
|
+
onKeyDown={(event) => {
|
|
97
|
+
if (!props.keyboard) return
|
|
98
|
+
|
|
99
|
+
if (event.defaultPrevented || event.repeat || event.ctrlKey || event.metaKey || event.altKey) return
|
|
100
|
+
|
|
101
|
+
if (event.key !== "F10" || !event.shiftKey) return
|
|
102
|
+
|
|
103
|
+
const target = event.target
|
|
104
|
+
|
|
105
|
+
if (!(target instanceof HTMLElement)) return
|
|
106
|
+
event.preventDefault()
|
|
107
|
+
|
|
108
|
+
const bounds = target.getBoundingClientRect()
|
|
109
|
+
|
|
110
|
+
target.dispatchEvent(
|
|
111
|
+
new MouseEvent("contextmenu", {
|
|
112
|
+
bubbles: true,
|
|
113
|
+
cancelable: true,
|
|
114
|
+
clientX: rtl() ? bounds.right : bounds.left,
|
|
115
|
+
clientY: bounds.bottom,
|
|
116
|
+
}),
|
|
117
|
+
)
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
{props.children}
|
|
121
|
+
</Menu.Context.Trigger>
|
|
122
|
+
<Menu.Context.Portal>
|
|
123
|
+
<Menu.Context.Content>
|
|
124
|
+
<Menu.Sub gutter={4} overflowPadding={24}>
|
|
125
|
+
<Menu.SubTrigger>{i18n.t("ui.sessionReviewV2.sidebarPosition")}</Menu.SubTrigger>
|
|
126
|
+
<Menu.Portal>
|
|
127
|
+
<Menu.SubContent>
|
|
128
|
+
<Menu.RadioGroup value={physical()} onChange={(value) => onChange()(logical(value))}>
|
|
129
|
+
<Menu.RadioItem value="left" closeOnSelect>
|
|
130
|
+
{i18n.t("ui.sessionReviewV2.sidebarPosition.left")}
|
|
131
|
+
</Menu.RadioItem>
|
|
132
|
+
<Menu.RadioItem value="right" closeOnSelect>
|
|
133
|
+
{i18n.t("ui.sessionReviewV2.sidebarPosition.right")}
|
|
134
|
+
</Menu.RadioItem>
|
|
135
|
+
</Menu.RadioGroup>
|
|
136
|
+
</Menu.SubContent>
|
|
137
|
+
</Menu.Portal>
|
|
138
|
+
</Menu.Sub>
|
|
139
|
+
</Menu.Context.Content>
|
|
140
|
+
</Menu.Context.Portal>
|
|
141
|
+
</Menu.Context>
|
|
142
|
+
)}
|
|
143
|
+
</Show>
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function SessionFilePanelV2Empty(props: ParentProps) {
|
|
148
|
+
return <div data-slot="session-review-v2-empty">{props.children}</div>
|
|
149
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { SessionProgressIndicatorV2 } from "./session-progress-indicator-v2"
|
|
2
|
+
import { Index } from "solid-js"
|
|
3
|
+
|
|
4
|
+
const docs = `### Overview
|
|
5
|
+
Animated 5×5 dot grid loader for in-progress session state.
|
|
6
|
+
|
|
7
|
+
Derived from Figma \`_sessionProgressIndicator\` with 8-frame rotation.
|
|
8
|
+
|
|
9
|
+
### API
|
|
10
|
+
- Accepts standard SVG props.
|
|
11
|
+
|
|
12
|
+
### Behavior
|
|
13
|
+
- A shared, pre-rendered alpha mask preserves the smooth opacity changes between 8 key poses (1.2s loop).
|
|
14
|
+
- Center dot stays at full opacity throughout the cycle.
|
|
15
|
+
|
|
16
|
+
### Accessibility
|
|
17
|
+
- Sets \`aria-hidden="true"\` by default.
|
|
18
|
+
|
|
19
|
+
### Theming
|
|
20
|
+
- Uses \`currentColor\` via \`--v2-icon-icon-muted\`.
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: "OpenCode/Status/Session progress",
|
|
25
|
+
id: "components-session-progress-indicator-v2",
|
|
26
|
+
component: SessionProgressIndicatorV2,
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
parameters: {
|
|
29
|
+
docs: {
|
|
30
|
+
description: {
|
|
31
|
+
component: docs,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const Basic = {
|
|
38
|
+
args: { size: 16 },
|
|
39
|
+
argTypes: { size: { control: { type: "range", min: 8, max: 48, step: 1 } } },
|
|
40
|
+
render: (args: { size: number }) => <SessionProgressIndicatorV2 width={args.size} height={args.size} />,
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const Sizes = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<div style={{ display: "flex", gap: "16px", "align-items": "center" }}>
|
|
46
|
+
<SessionProgressIndicatorV2 width={12} height={12} />
|
|
47
|
+
<SessionProgressIndicatorV2 />
|
|
48
|
+
<SessionProgressIndicatorV2 width={24} height={24} />
|
|
49
|
+
</div>
|
|
50
|
+
),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const StressTest = {
|
|
54
|
+
args: { count: 16, size: 16 },
|
|
55
|
+
argTypes: { count: { control: { type: "range", min: 1, max: 256, step: 1 } } },
|
|
56
|
+
parameters: {
|
|
57
|
+
layout: "fullscreen",
|
|
58
|
+
},
|
|
59
|
+
render: (args: { count: number; size: number }) => (
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
display: "grid",
|
|
63
|
+
width: "100%",
|
|
64
|
+
"max-height": "100%",
|
|
65
|
+
overflow: "auto",
|
|
66
|
+
gap: "4px",
|
|
67
|
+
"grid-template-columns": `repeat(auto-fill, ${args.size}px)`,
|
|
68
|
+
"justify-content": "center",
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Index each={Array.from({ length: Math.max(1, Math.min(256, args.count)) })}>
|
|
72
|
+
{() => <SessionProgressIndicatorV2 width={args.size} height={args.size} />}
|
|
73
|
+
</Index>
|
|
74
|
+
</div>
|
|
75
|
+
),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const OnDark = {
|
|
79
|
+
...Basic,
|
|
80
|
+
globals: { theme: "dark" },
|
|
81
|
+
render: (args: { size: number }) => (
|
|
82
|
+
<div data-color-scheme="dark" class="rounded-md bg-v2-background-bg-base p-4">
|
|
83
|
+
<SessionProgressIndicatorV2 width={args.size} height={args.size} />
|
|
84
|
+
</div>
|
|
85
|
+
),
|
|
86
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ComponentProps } from "solid-js"
|
|
2
|
+
import { Spinner } from "@zyro-sec/ui/spinner"
|
|
3
|
+
import "./session-progress-indicator-v2.css"
|
|
4
|
+
|
|
5
|
+
// The app's one activity spinner, shared by the activity chip, subagent rows, task cards and loading tabs.
|
|
6
|
+
export function SessionProgressIndicatorV2(props: ComponentProps<typeof Spinner>) {
|
|
7
|
+
return (
|
|
8
|
+
<Spinner
|
|
9
|
+
{...props}
|
|
10
|
+
width={props.width ?? 16}
|
|
11
|
+
height={props.height ?? 16}
|
|
12
|
+
data-component="session-progress-indicator-v2"
|
|
13
|
+
aria-hidden={props["aria-hidden"] ?? "true"}
|
|
14
|
+
/>
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useI18n } from "@zyro-sec/ui/context/i18n"
|
|
2
|
+
import { Icon } from "@zyro-sec/ui/icon"
|
|
3
|
+
import "./session-review-v2.css"
|
|
4
|
+
|
|
5
|
+
export function SessionReviewEmptyChangesV2() {
|
|
6
|
+
const i18n = useI18n()
|
|
7
|
+
|
|
8
|
+
return (
|
|
9
|
+
<div data-slot="session-review-v2-empty-changes">
|
|
10
|
+
<Icon name="review" size="large" />
|
|
11
|
+
<div data-slot="session-review-v2-empty-changes-title">{i18n.t("ui.sessionReviewV2.empty.changes.title")}</div>
|
|
12
|
+
<div data-slot="session-review-v2-empty-changes-description">
|
|
13
|
+
{i18n.t("ui.sessionReviewV2.empty.changes.description")}
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FileIcon } from "@zyro-sec/ui/file-icon"
|
|
2
|
+
import { useI18n } from "@zyro-sec/ui/context/i18n"
|
|
3
|
+
import { Button } from "@zyro-sec/ui/button"
|
|
4
|
+
import "./session-review-v2.css"
|
|
5
|
+
|
|
6
|
+
export type SessionReviewEmptyNoGitV2Props = {
|
|
7
|
+
pending: boolean
|
|
8
|
+
onInitGit: () => void
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function SessionReviewEmptyNoGitV2(props: SessionReviewEmptyNoGitV2Props) {
|
|
12
|
+
const i18n = useI18n()
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div data-slot="session-review-v2-empty-no-git">
|
|
16
|
+
<FileIcon node={{ path: ".gitignore", type: "file" }} mono />
|
|
17
|
+
<div data-slot="session-review-v2-empty-no-git-title">{i18n.t("ui.sessionReviewV2.empty.noGit.title")}</div>
|
|
18
|
+
<div data-slot="session-review-v2-empty-no-git-description">
|
|
19
|
+
{i18n.t("ui.sessionReviewV2.empty.noGit.description")}
|
|
20
|
+
</div>
|
|
21
|
+
<Button variant="neutral" size="normal" disabled={props.pending} onClick={props.onInitGit}>
|
|
22
|
+
{props.pending
|
|
23
|
+
? i18n.t("ui.sessionReviewV2.empty.noGit.actionLoading")
|
|
24
|
+
: i18n.t("ui.sessionReviewV2.empty.noGit.action")}
|
|
25
|
+
</Button>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|