@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.
Files changed (261) hide show
  1. package/AGENTS.md +25 -0
  2. package/bunfig.toml +2 -0
  3. package/component-tests/basic-tool.fixture.tsx +46 -0
  4. package/component-tests/basic-tool.spec.ts +63 -0
  5. package/component-tests/file-media.fixture.tsx +39 -0
  6. package/component-tests/file-media.spec.ts +13 -0
  7. package/component-tests/file-tool.spec.ts +62 -0
  8. package/component-tests/file-viewer.fixture.tsx +109 -0
  9. package/component-tests/file-viewer.spec.ts +134 -0
  10. package/component-tests/file.spec.ts +33 -0
  11. package/component-tests/line-comment-v2.spec.ts +15 -0
  12. package/component-tests/markdown-code-wrap.spec.ts +94 -0
  13. package/component-tests/markdown-readiness.spec.ts +95 -0
  14. package/component-tests/markdown.fixture.tsx +104 -0
  15. package/component-tests/markdown.spec.ts +1564 -0
  16. package/component-tests/mermaid-preview.spec.ts +43 -0
  17. package/component-tests/patch-group.spec.ts +79 -0
  18. package/component-tests/read-group.spec.ts +72 -0
  19. package/component-tests/read-image.fixture.tsx +66 -0
  20. package/component-tests/read-image.spec.ts +154 -0
  21. package/component-tests/session-compaction.spec.ts +254 -0
  22. package/component-tests/session-lifecycle.spec.ts +190 -0
  23. package/component-tests/session-message-projection.spec.ts +639 -0
  24. package/component-tests/session-notice-projection.spec.ts +20 -0
  25. package/component-tests/session-review-comments.spec.ts +179 -0
  26. package/component-tests/session-shell.spec.ts +93 -0
  27. package/component-tests/session-timeline-mobile.spec.ts +201 -0
  28. package/component-tests/session-timeline-notices.spec.ts +38 -0
  29. package/component-tests/session-timeline-reasoning.spec.ts +107 -0
  30. package/component-tests/session-timeline.spec.ts +157 -0
  31. package/component-tests/session-tool-projection.spec.ts +323 -0
  32. package/component-tests/text-lifecycle.fixture.tsx +26 -0
  33. package/component-tests/text-lifecycle.spec.ts +42 -0
  34. package/component-tests/timeline-subagent-rows.spec.ts +33 -0
  35. package/component-tests/tool-disclosure.spec.ts +48 -0
  36. package/component-tests/tool-group-sticky.spec.ts +37 -0
  37. package/component-tests/tool-group.spec.ts +290 -0
  38. package/component-tests/tool-status-title.fixture.tsx +22 -0
  39. package/component-tests/tool-status-title.spec.ts +30 -0
  40. package/component-tests/user-message-quotes.spec.ts +111 -0
  41. package/package.json +91 -4
  42. package/playwright.components.config.ts +4 -0
  43. package/playwright.local.config.ts +2 -0
  44. package/src/actions.ts +54 -0
  45. package/src/components/apply-patch-file.ts +122 -0
  46. package/src/components/basic-tool.css +487 -0
  47. package/src/components/basic-tool.tsx +258 -0
  48. package/src/components/copy-machine.ts +78 -0
  49. package/src/components/copy.ts +85 -0
  50. package/src/components/diagram-preview.tsx +28 -0
  51. package/src/components/disclosure-machine.ts +188 -0
  52. package/src/components/disclosure.ts +129 -0
  53. package/src/components/dock-prompt.stories.tsx +73 -0
  54. package/src/components/dock-prompt.tsx +29 -0
  55. package/src/components/file-comment-selection.tsx +146 -0
  56. package/src/components/file-media-machine.ts +165 -0
  57. package/src/components/file-media.stories.tsx +112 -0
  58. package/src/components/file-media.tsx +323 -0
  59. package/src/components/file-search.tsx +73 -0
  60. package/src/components/file.css +59 -0
  61. package/src/components/file.tsx +1300 -0
  62. package/src/components/image-preview.tsx +35 -0
  63. package/src/components/line-comment-annotations.tsx +580 -0
  64. package/src/components/line-comment-machine.ts +262 -0
  65. package/src/components/line-comment-styles.ts +293 -0
  66. package/src/components/line-comment.stories.tsx +152 -0
  67. package/src/components/line-comment.tsx +448 -0
  68. package/src/components/link-segments.ts +20 -0
  69. package/src/components/linked-text.tsx +21 -0
  70. package/src/components/markdown-cache-machine.ts +257 -0
  71. package/src/components/markdown-cache.tsx +556 -0
  72. package/src/components/markdown-clipboard.ts +101 -0
  73. package/src/components/markdown-code-machine.ts +200 -0
  74. package/src/components/markdown-code-state.ts +22 -0
  75. package/src/components/markdown-fragment-links.ts +74 -0
  76. package/src/components/markdown-github.svg +3 -0
  77. package/src/components/markdown-globe.svg +5 -0
  78. package/src/components/markdown-image-machine.ts +170 -0
  79. package/src/components/markdown-image.ts +156 -0
  80. package/src/components/markdown-inline-code-kind.ts +39 -0
  81. package/src/components/markdown-mermaid.ts +18 -0
  82. package/src/components/markdown-phase-machine.ts +102 -0
  83. package/src/components/markdown-projection.ts +13 -0
  84. package/src/components/markdown-session-links.ts +183 -0
  85. package/src/components/markdown-solid.test.tsx +92 -0
  86. package/src/components/markdown-solid.tsx +113 -0
  87. package/src/components/markdown-stream.ts +95 -0
  88. package/src/components/markdown-worker-machine.ts +516 -0
  89. package/src/components/markdown-worker-protocol.ts +73 -0
  90. package/src/components/markdown-worker.ts +250 -0
  91. package/src/components/markdown.css +672 -0
  92. package/src/components/markdown.stories.tsx +199 -0
  93. package/src/components/markdown.tsx +1612 -0
  94. package/src/components/markdown.worker.ts +188 -0
  95. package/src/components/message-file.ts +102 -0
  96. package/src/components/message-nav.css +134 -0
  97. package/src/components/message-nav.tsx +159 -0
  98. package/src/components/message-part.css +2109 -0
  99. package/src/components/message-part.tsx +3 -0
  100. package/src/components/question-prompt-experimental.css +576 -0
  101. package/src/components/question-prompt.css +527 -0
  102. package/src/components/quote-highlight.css +59 -0
  103. package/src/components/review-focus-driver.ts +142 -0
  104. package/src/components/review-focus-machine.ts +95 -0
  105. package/src/components/session-compaction.css +270 -0
  106. package/src/components/session-diff.ts +358 -0
  107. package/src/components/session-error.tsx +41 -0
  108. package/src/components/session-retry.tsx +92 -0
  109. package/src/components/session-review-machine.ts +241 -0
  110. package/src/components/session-review.css +264 -0
  111. package/src/components/session-review.stories.tsx +232 -0
  112. package/src/components/session-review.tsx +733 -0
  113. package/src/components/session-turn.css +282 -0
  114. package/src/components/shell-submessage.css +24 -0
  115. package/src/components/timeline-separator.tsx +69 -0
  116. package/src/components/tool-count-label.css +57 -0
  117. package/src/components/tool-count-label.tsx +76 -0
  118. package/src/components/tool-count-summary.css +102 -0
  119. package/src/components/tool-count-summary.stories.tsx +99 -0
  120. package/src/components/tool-count-summary.tsx +44 -0
  121. package/src/components/tool-error-card.css +178 -0
  122. package/src/components/tool-error-card.stories.tsx +113 -0
  123. package/src/components/tool-error-card.tsx +202 -0
  124. package/src/components/tool-status-title-machine.ts +128 -0
  125. package/src/components/tool-status-title.css +89 -0
  126. package/src/components/tool-status-title.tsx +163 -0
  127. package/src/context/data.tsx +107 -0
  128. package/src/context/index.ts +1 -0
  129. package/src/context/markdown.tsx +129 -0
  130. package/src/context/sources.tsx +34 -0
  131. package/src/document.ts +8 -0
  132. package/src/file-presentation.ts +34 -0
  133. package/src/message/action-machine.ts +72 -0
  134. package/src/message/agent-label.ts +3 -0
  135. package/src/message/attachment-card.css +119 -0
  136. package/src/message/attachment-card.tsx +40 -0
  137. package/src/message/attachment-media-machine.ts +213 -0
  138. package/src/message/comment-card.tsx +155 -0
  139. package/src/message/compaction-entrance-machine.ts +93 -0
  140. package/src/message/current-message.tsx +157 -0
  141. package/src/message/current-tool-state.ts +161 -0
  142. package/src/message/message-content.tsx +1391 -0
  143. package/src/message/paced-text-machine.ts +73 -0
  144. package/src/message/prompt-message.stories.tsx +149 -0
  145. package/src/message/relative-time.ts +45 -0
  146. package/src/message/user-message-quote-parts.ts +16 -0
  147. package/src/message/user-message-quotes.stories.tsx +797 -0
  148. package/src/message/user-message-quotes.tsx +135 -0
  149. package/src/pierre/comment-hover-machine.ts +53 -0
  150. package/src/pierre/comment-hover.ts +131 -0
  151. package/src/pierre/comment-selection-machine.ts +257 -0
  152. package/src/pierre/commented-lines.ts +106 -0
  153. package/src/pierre/diff-selection.ts +91 -0
  154. package/src/pierre/file-find-machine.ts +323 -0
  155. package/src/pierre/file-find.ts +537 -0
  156. package/src/pierre/file-runtime.ts +42 -0
  157. package/src/pierre/file-selection.ts +140 -0
  158. package/src/pierre/index.ts +344 -0
  159. package/src/pierre/media.ts +140 -0
  160. package/src/pierre/render-machine.ts +381 -0
  161. package/src/pierre/selection-bridge.ts +82 -0
  162. package/src/pierre/selection-machine.ts +198 -0
  163. package/src/pierre/virtualizer.ts +114 -0
  164. package/src/pierre/worker.ts +46 -0
  165. package/src/sources/experiment.ts +59 -0
  166. package/src/sources/site-icon.tsx +53 -0
  167. package/src/sources/sources-chip.tsx +57 -0
  168. package/src/sources/sources-expand-machine.ts +101 -0
  169. package/src/sources/sources-panel.tsx +249 -0
  170. package/src/sources/sources-title.tsx +21 -0
  171. package/src/sources/sources.css +266 -0
  172. package/src/sources/sources.ts +141 -0
  173. package/src/storybook/current-session-fixtures.ts +1492 -0
  174. package/src/storybook/current-session-scenarios.ts +76 -0
  175. package/src/storybook/current-session-story.tsx +154 -0
  176. package/src/storybook/index.ts +43 -0
  177. package/src/styles/index.css +19 -0
  178. package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
  179. package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
  180. package/src/timeline/code-blocks.stories.tsx +105 -0
  181. package/src/timeline/commentary.stories.tsx +70 -0
  182. package/src/timeline/commentary.ts +38 -0
  183. package/src/timeline/detail.ts +111 -0
  184. package/src/timeline/error-card.stories.tsx +134 -0
  185. package/src/timeline/error-spacing.stories.tsx +71 -0
  186. package/src/timeline/facts.ts +493 -0
  187. package/src/timeline/file-changes.stories.tsx +436 -0
  188. package/src/timeline/group-label-fixtures.ts +97 -0
  189. package/src/timeline/mermaid.stories.tsx +131 -0
  190. package/src/timeline/place.ts +280 -0
  191. package/src/timeline/placement-fixtures.ts +365 -0
  192. package/src/timeline/placement-reactivity.ts +133 -0
  193. package/src/timeline/projection.ts +1261 -0
  194. package/src/timeline/research-and-agents.stories.tsx +461 -0
  195. package/src/timeline/session-timeline-row.tsx +1675 -0
  196. package/src/timeline/session-timeline.tsx +68 -0
  197. package/src/timeline/steer-arrival-machine.ts +134 -0
  198. package/src/timeline/terminal-work.stories.tsx +464 -0
  199. package/src/timeline/timeline-row.stories.tsx +1069 -0
  200. package/src/timeline/timeline-row.ts +238 -0
  201. package/src/timeline/turn-phase-machine.ts +112 -0
  202. package/src/timeline/user-message-fold.stories.tsx +194 -0
  203. package/src/timeline/user-runs.ts +87 -0
  204. package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
  205. package/src/timeline-next/compaction.tsx +236 -0
  206. package/src/timeline-next/errors.ts +101 -0
  207. package/src/timeline-next/event-row.tsx +168 -0
  208. package/src/timeline-next/events.ts +103 -0
  209. package/src/timeline-next/index.ts +10 -0
  210. package/src/timeline-next/nested-rail.ts +125 -0
  211. package/src/timeline-next/projection.ts +1028 -0
  212. package/src/timeline-next/row.tsx +1728 -0
  213. package/src/timeline-next/rules.ts +89 -0
  214. package/src/timeline-next/separator.tsx +73 -0
  215. package/src/timeline-next/spacing.ts +127 -0
  216. package/src/timeline-next/status-line.tsx +41 -0
  217. package/src/timeline-next/status.ts +33 -0
  218. package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
  219. package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
  220. package/src/timeline-next/stories/compare.stories.tsx +486 -0
  221. package/src/timeline-next/stories/playground.stories.tsx +297 -0
  222. package/src/timeline-next/stories/session-replay.ts +1156 -0
  223. package/src/timeline-next/stories/session-timeline.tsx +50 -0
  224. package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
  225. package/src/timeline-next/timeline-next.css +649 -0
  226. package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
  227. package/src/timeline-next/tools/activity-label.ts +166 -0
  228. package/src/timeline-next/tools/assistant-content.tsx +84 -0
  229. package/src/timeline-next/tools/context-group.tsx +619 -0
  230. package/src/timeline-next/tools/error-card.tsx +147 -0
  231. package/src/timeline-next/tools/explore.tsx +119 -0
  232. package/src/timeline-next/tools/file-group.tsx +128 -0
  233. package/src/timeline-next/tools/patch.tsx +174 -0
  234. package/src/timeline-next/tools/shell.tsx +186 -0
  235. package/src/timeline-next/tools/thought.tsx +87 -0
  236. package/src/timeline-next/tools/tool-display.tsx +119 -0
  237. package/src/tools/ansi.ts +8 -0
  238. package/src/tools/context-group-label.ts +123 -0
  239. package/src/tools/file-runs.ts +35 -0
  240. package/src/tools/project-path.ts +18 -0
  241. package/src/tools/read-group.stories.tsx +159 -0
  242. package/src/tools/run-machine.ts +185 -0
  243. package/src/tools/shell-output-machine.ts +233 -0
  244. package/src/tools/shell-output.ts +91 -0
  245. package/src/tools/subagent-row-variants.stories.tsx +129 -0
  246. package/src/tools/tool-group.stories.tsx +345 -0
  247. package/src/tools/tool-renderer.tsx +2876 -0
  248. package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
  249. package/src/v2/components/session-file-panel-v2.tsx +149 -0
  250. package/src/v2/components/session-progress-indicator-v2.css +5 -0
  251. package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
  252. package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
  253. package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
  254. package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
  255. package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
  256. package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
  257. package/src/v2/components/session-review-v2.css +653 -0
  258. package/src/v2/components/session-review-v2.tsx +422 -0
  259. package/src/v2/components/sidebar-presence-machine.ts +69 -0
  260. package/tsconfig.json +20 -0
  261. package/README.md +0 -3
@@ -0,0 +1,527 @@
1
+ [data-component="dock-prompt"][data-kind="question"]:not([data-variant="experimental"]) {
2
+ --v2-question-answer-bg-selected: var(--v2-background-bg-layer-01);
3
+ --question-feedback-duration: 120ms;
4
+
5
+ position: relative;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: 0;
9
+ min-block-size: 0;
10
+ max-block-size: var(--question-prompt-max-height, 100dvh);
11
+ font-family: var(--v2-font-family-sans);
12
+ isolation: isolate;
13
+
14
+ [data-slot="question-body"] {
15
+ position: relative;
16
+ z-index: 1;
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 16px;
20
+ flex: 1;
21
+ min-block-size: 0;
22
+ overflow: clip;
23
+ padding: 8px 12px 12px;
24
+ background-color: var(--v2-background-bg-base);
25
+ border-radius: 10px;
26
+ box-shadow: var(--v2-elevation-raised);
27
+ }
28
+
29
+ [data-slot="question-header"] {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: 4px;
33
+ flex-shrink: 0;
34
+ min-block-size: 0;
35
+ min-inline-size: 0;
36
+ }
37
+
38
+ [data-slot="question-header-top"] {
39
+ display: flex;
40
+ align-items: center;
41
+ justify-content: space-between;
42
+ gap: 12px;
43
+ min-block-size: 28px;
44
+ min-inline-size: 0;
45
+ }
46
+
47
+ [data-slot="question-header-title"] {
48
+ min-inline-size: 0;
49
+ font-size: 13px;
50
+ font-weight: 440;
51
+ line-height: var(--line-height-compact);
52
+ color: var(--v2-text-text-muted);
53
+ overflow-wrap: anywhere;
54
+ }
55
+
56
+ [data-slot="question-header-actions"] {
57
+ display: flex;
58
+ align-items: center;
59
+ gap: 8px;
60
+ flex-shrink: 0;
61
+
62
+ [data-component="icon-button-v2"] {
63
+ flex-shrink: 0;
64
+ color: var(--v2-icon-icon-muted);
65
+ }
66
+
67
+ [data-slot="icon-svg"] {
68
+ flex-shrink: 0;
69
+ }
70
+ }
71
+
72
+ [data-slot="question-details"] {
73
+ display: flex;
74
+ flex-direction: column;
75
+ gap: 8px;
76
+ min-block-size: 0;
77
+ min-inline-size: 0;
78
+ max-block-size: max(48px, calc((var(--question-prompt-max-height, 100dvh) - 120px) * 0.45));
79
+ overflow-y: auto;
80
+ scrollbar-width: none;
81
+
82
+ &::-webkit-scrollbar {
83
+ display: none;
84
+ }
85
+ }
86
+
87
+ [data-slot="question-text"] {
88
+ font-size: 13px;
89
+ font-weight: 530;
90
+ line-height: var(--line-height-compact);
91
+ color: var(--v2-text-text-base);
92
+ overflow-wrap: anywhere;
93
+ -webkit-user-select: text;
94
+ user-select: text;
95
+ }
96
+
97
+ [data-slot="question-hint"] {
98
+ font-size: 13px;
99
+ font-weight: 440;
100
+ line-height: var(--line-height-base);
101
+ color: var(--v2-text-text-faint);
102
+ overflow-wrap: anywhere;
103
+ }
104
+
105
+ [data-slot="question-progress"] {
106
+ display: flex;
107
+ align-items: center;
108
+ gap: 2px;
109
+ flex-shrink: 0;
110
+ }
111
+
112
+ [data-slot="question-progress-segment"] {
113
+ display: inline-flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ flex-shrink: 0;
117
+ inline-size: 20px;
118
+ block-size: 20px;
119
+ padding: 0;
120
+ border: 0;
121
+ border-radius: 4px;
122
+ background: transparent;
123
+ cursor: pointer;
124
+ touch-action: manipulation;
125
+
126
+ &[data-answered="true"]:not([data-active="true"]) [data-slot="question-progress-bar"]::before {
127
+ opacity: 1;
128
+ }
129
+
130
+ &[data-active="true"] [data-slot="question-progress-bar"]::after {
131
+ opacity: 1;
132
+ }
133
+
134
+ &:focus-visible {
135
+ outline: 2px solid var(--v2-border-border-focus);
136
+ outline-offset: -2px;
137
+ }
138
+
139
+ &:disabled {
140
+ cursor: not-allowed;
141
+ opacity: 0.5;
142
+ }
143
+ }
144
+
145
+ [data-slot="question-progress-bar"] {
146
+ position: relative;
147
+ inline-size: 14px;
148
+ block-size: 2px;
149
+ flex-shrink: 0;
150
+ background-color: var(--v2-background-bg-layer-04);
151
+
152
+ &::before,
153
+ &::after {
154
+ content: "";
155
+ position: absolute;
156
+ inset: 0;
157
+ opacity: 0;
158
+ }
159
+
160
+ &::before {
161
+ background-color: var(--v2-background-bg-accent);
162
+ transition: opacity var(--question-feedback-duration) ease;
163
+ }
164
+
165
+ &::after {
166
+ background-color: var(--v2-icon-icon-muted);
167
+ }
168
+ }
169
+
170
+ [data-slot="question-content"] {
171
+ display: flex;
172
+ flex-direction: column;
173
+ flex: 1;
174
+ min-block-size: 0;
175
+ min-inline-size: 0;
176
+ }
177
+
178
+ [data-slot="question-options"] {
179
+ position: relative;
180
+ display: flex;
181
+ flex-direction: column;
182
+ gap: 6px;
183
+ flex: 1 1 auto;
184
+ min-block-size: 0;
185
+ min-inline-size: 0;
186
+ /* Room for the picked answer's shadow, which the scroll box would clip. */
187
+ margin: -4px;
188
+ padding: 4px;
189
+ overflow-y: auto;
190
+ scrollbar-width: none;
191
+
192
+ &::-webkit-scrollbar {
193
+ display: none;
194
+ }
195
+
196
+ &[inert] {
197
+ margin: 0;
198
+ padding: 0;
199
+ }
200
+ }
201
+
202
+ [data-slot="question-option"] {
203
+ position: relative;
204
+ isolation: isolate;
205
+ display: flex;
206
+ align-items: flex-start;
207
+ gap: 8px;
208
+ flex-shrink: 0;
209
+ box-sizing: border-box;
210
+ inline-size: 100%;
211
+ padding: 10px;
212
+ border: 0;
213
+ border-radius: 6px;
214
+ background-color: var(--v2-background-bg-base);
215
+ box-shadow: inset 0 0 0 0.5px var(--v2-border-border-base);
216
+ color: var(--v2-text-text-base);
217
+ text-align: start;
218
+ cursor: pointer;
219
+ touch-action: manipulation;
220
+ transition: background-color var(--question-feedback-duration) ease;
221
+
222
+ &::before {
223
+ content: "";
224
+ position: absolute;
225
+ inset: 0;
226
+ z-index: -1;
227
+ border-radius: inherit;
228
+ background-color: var(--v2-question-answer-bg-selected);
229
+ opacity: 0;
230
+ pointer-events: none;
231
+ transition: opacity var(--question-feedback-duration) ease;
232
+ }
233
+
234
+ &[data-picked="true"] {
235
+ box-shadow: var(--v2-elevation-raised);
236
+
237
+ &::before {
238
+ opacity: 1;
239
+ }
240
+ }
241
+
242
+ &:focus-visible {
243
+ outline: 2px solid var(--v2-border-border-focus);
244
+ outline-offset: -2px;
245
+ }
246
+
247
+ &:disabled,
248
+ &[data-disabled="true"] {
249
+ cursor: not-allowed;
250
+ opacity: 0.5;
251
+ }
252
+ }
253
+
254
+ [data-slot="question-option-check"] {
255
+ -webkit-user-select: none;
256
+ user-select: none;
257
+ display: inline-flex;
258
+ align-items: center;
259
+ justify-content: center;
260
+ inline-size: 16px;
261
+ block-size: 20px;
262
+ flex: 0 0 16px;
263
+ }
264
+
265
+ [data-slot="question-option-box"] {
266
+ display: inline-flex;
267
+ align-items: center;
268
+ justify-content: center;
269
+ box-sizing: border-box;
270
+ inline-size: 16px;
271
+ block-size: 16px;
272
+ flex: 0 0 16px;
273
+ padding: 0;
274
+ border: 0;
275
+ border-radius: 4px;
276
+ background: linear-gradient(180deg, var(--v2-alpha-light-6), var(--v2-alpha-light-0)), var(--v2-background-bg-base);
277
+ box-shadow: inset 0 0 0 0.5px var(--v2-border-border-strong);
278
+
279
+ [data-slot="icon-svg"] {
280
+ inline-size: 16px;
281
+ block-size: 16px;
282
+ flex: 0 0 16px;
283
+ opacity: 0;
284
+ color: var(--v2-icon-icon-contrast);
285
+ transition: opacity var(--question-feedback-duration) ease;
286
+ }
287
+
288
+ &[data-type="radio"] {
289
+ border-radius: 50%;
290
+ }
291
+
292
+ [data-slot="question-option-radio-dot"] {
293
+ inline-size: 6px;
294
+ block-size: 6px;
295
+ flex: 0 0 6px;
296
+ border-radius: 50%;
297
+ background-color: var(--v2-grey-300);
298
+ box-shadow: var(--v2-elevation-elements);
299
+ opacity: 0;
300
+ transition: opacity var(--question-feedback-duration) ease;
301
+ }
302
+
303
+ &[data-picked="true"] {
304
+ background:
305
+ linear-gradient(180deg, var(--v2-alpha-light-20), var(--v2-alpha-light-0)), var(--v2-background-bg-accent);
306
+
307
+ [data-slot="icon-svg"],
308
+ [data-slot="question-option-radio-dot"] {
309
+ opacity: 1;
310
+ }
311
+
312
+ &[data-type="radio"] {
313
+ box-shadow: none;
314
+ }
315
+ }
316
+ }
317
+
318
+ [data-slot="question-option-main"] {
319
+ -webkit-user-select: text;
320
+ user-select: text;
321
+ display: flex;
322
+ flex-direction: column;
323
+ gap: 4px;
324
+ min-inline-size: 0;
325
+ flex: 1;
326
+ }
327
+
328
+ [data-slot="question-option-shortcut"] {
329
+ -webkit-user-select: none;
330
+ user-select: none;
331
+ --keybind-font-size: 10px;
332
+ --keybind-font-weight: var(--font-weight-regular);
333
+ --keybind-transition-duration: var(--question-feedback-duration);
334
+ align-self: center;
335
+ block-size: 20px;
336
+ pointer-events: none;
337
+ }
338
+
339
+ [data-slot="option-label"] {
340
+ font-family: var(--v2-font-family-sans);
341
+ font-size: 13px;
342
+ font-weight: 440;
343
+ line-height: var(--line-height-base);
344
+ letter-spacing: -0.04px;
345
+ color: var(--v2-text-text-base);
346
+ overflow-wrap: anywhere;
347
+ }
348
+
349
+ [data-slot="option-description"] {
350
+ min-inline-size: 0;
351
+ font-family: var(--v2-font-family-sans);
352
+ font-size: 12px;
353
+ font-weight: 440;
354
+ line-height: var(--line-height-compact);
355
+ letter-spacing: 0.05px;
356
+ color: var(--v2-text-text-muted);
357
+ overflow-wrap: anywhere;
358
+ white-space: normal;
359
+ }
360
+
361
+ [data-slot="question-option"][data-custom="true"] {
362
+ align-items: center;
363
+ block-size: 40px;
364
+ min-block-size: 40px;
365
+ max-block-size: 40px;
366
+ padding-block: 0;
367
+ padding-inline: 10px;
368
+
369
+ &[data-editing="true"] .question-custom-field[data-component="text-input-v2"] {
370
+ [data-slot="text-input-v2-input"] {
371
+ &::placeholder {
372
+ color: var(--v2-text-text-faint);
373
+ }
374
+ }
375
+ }
376
+ }
377
+
378
+ [data-slot="question-custom-toggle"] {
379
+ display: inline-flex;
380
+ align-items: center;
381
+ justify-content: center;
382
+ inline-size: 16px;
383
+ block-size: 20px;
384
+ flex: 0 0 16px;
385
+ margin: 0;
386
+ padding: 0;
387
+ border: 0;
388
+ border-radius: 4px;
389
+ background: transparent;
390
+ cursor: pointer;
391
+ touch-action: manipulation;
392
+
393
+ &:focus-visible {
394
+ outline: 2px solid var(--v2-border-border-focus);
395
+ outline-offset: 2px;
396
+ }
397
+
398
+ &:disabled {
399
+ cursor: not-allowed;
400
+ }
401
+ }
402
+
403
+ [data-slot="question-option"] .question-custom-field[data-component="text-input-v2"] {
404
+ flex: 1;
405
+ inline-size: 100%;
406
+ min-inline-size: 0;
407
+ block-size: 28px;
408
+ align-self: center;
409
+ padding: 0;
410
+ gap: 0;
411
+ border: 0;
412
+ border-radius: 6px;
413
+ background: transparent;
414
+ box-shadow: none;
415
+ outline: none;
416
+ opacity: 1;
417
+ transition: none;
418
+
419
+ [data-slot="text-input-v2-value"] {
420
+ min-inline-size: 0;
421
+ min-block-size: 0;
422
+ gap: 0;
423
+ }
424
+
425
+ [data-slot="text-input-v2-input"] {
426
+ box-sizing: border-box;
427
+ inline-size: 100%;
428
+ min-inline-size: 0;
429
+ block-size: 28px;
430
+ margin: 0;
431
+ padding: 0;
432
+ border: 0;
433
+ background: transparent;
434
+ outline: none;
435
+ font-family: var(--v2-font-family-sans);
436
+ font-size: 13px;
437
+ font-weight: 440;
438
+ line-height: var(--line-height-compact);
439
+ color: var(--v2-text-text-base);
440
+ text-align: start;
441
+ cursor: text;
442
+
443
+ &::placeholder {
444
+ color: var(--v2-text-text-base);
445
+ opacity: 1;
446
+ }
447
+
448
+ &:disabled {
449
+ cursor: not-allowed;
450
+ }
451
+ }
452
+ }
453
+
454
+ [data-slot="question-footer"] {
455
+ position: relative;
456
+ z-index: 0;
457
+ display: flex;
458
+ box-sizing: border-box;
459
+ align-items: center;
460
+ justify-content: space-between;
461
+ flex-shrink: 0;
462
+ padding-block: 16px 8px;
463
+ padding-inline: 8px;
464
+ margin-block-start: -9px;
465
+ border: 0.5px solid var(--v2-border-border-base);
466
+ border-start-start-radius: 0;
467
+ border-start-end-radius: 0;
468
+ border-end-start-radius: 10px;
469
+ border-end-end-radius: 10px;
470
+ background-color: var(--v2-background-bg-layer-01);
471
+
472
+ > [data-component="button-v2"][data-variant="ghost"] {
473
+ color: var(--v2-text-text-muted);
474
+ }
475
+ }
476
+
477
+ [data-slot="question-footer-actions"] {
478
+ display: flex;
479
+ align-items: center;
480
+ gap: 8px;
481
+ }
482
+
483
+ /* Keep both labels in layout so the button doesn't change width. */
484
+ [data-slot="question-advance-labels"] {
485
+ display: inline-grid;
486
+ place-items: center;
487
+ }
488
+
489
+ [data-slot="question-advance-label"] {
490
+ grid-area: 1 / 1;
491
+ white-space: nowrap;
492
+ opacity: 0;
493
+ transition: opacity var(--question-feedback-duration) ease-out;
494
+
495
+ &[data-active="true"] {
496
+ opacity: 1;
497
+ }
498
+ }
499
+
500
+ @media (hover: hover) and (pointer: fine) {
501
+ [data-slot="question-progress-segment"]:hover:not(:disabled) {
502
+ background-color: var(--v2-overlay-simple-overlay-hover);
503
+ }
504
+
505
+ [data-slot="question-option"]:hover:not(:disabled):not([data-disabled="true"]):not([data-picked="true"]) {
506
+ background-color: var(--v2-background-bg-layer-02);
507
+ }
508
+ }
509
+
510
+ [data-component="session-question-dock"][data-keyboard="true"] &,
511
+ :root[data-motion="reduce"] & {
512
+ --question-feedback-duration: 0s;
513
+ }
514
+
515
+ @media (prefers-reduced-motion: reduce) {
516
+ :root:not([data-motion="full"]) & {
517
+ --question-feedback-duration: 0s;
518
+ }
519
+ }
520
+
521
+ :root[data-motion="reduce"] & {
522
+ [data-slot="question-option"],
523
+ .question-custom-field[data-component="text-input-v2"] {
524
+ transition: none;
525
+ }
526
+ }
527
+ }
@@ -0,0 +1,59 @@
1
+ :root,
2
+ :host {
3
+ --timeline-quote-background: light-dark(
4
+ rgb(from var(--v2-blue-1100) r g b / 0.1),
5
+ rgb(from var(--v2-blue-400) r g b / 0.25)
6
+ );
7
+ }
8
+
9
+ /* Blink computes a highlight style for every element a highlight rule matches, so rules that reach every element cost
10
+ a third of the timeline's style recalculation. Blink inherits highlight styles to descendants (::selection since
11
+ Chromium 134), so these rules match one ancestor instead. Gecko and WebKit do not inherit them and keep the descendant
12
+ rules; :host-context() is Blink-only, which is how these blocks tell the engines apart. */
13
+ @supports selector(:host-context(*)) {
14
+ [data-slot="session-timeline-scroll"]::selection,
15
+ :host::selection,
16
+ :root::highlight(timeline-quote-source),
17
+ :host::highlight(timeline-quote-source) {
18
+ background-color: var(--timeline-quote-background);
19
+ color: currentColor;
20
+ }
21
+ }
22
+
23
+ @supports not selector(:host-context(*)) {
24
+ [data-slot="session-timeline-scroll"] ::selection,
25
+ :host ::selection,
26
+ ::highlight(timeline-quote-source) {
27
+ background-color: var(--timeline-quote-background);
28
+ color: currentColor;
29
+ }
30
+ }
31
+
32
+ .timeline-quote-highlight-host {
33
+ isolation: isolate;
34
+
35
+ &::highlight(timeline-quote-source) {
36
+ background-color: transparent;
37
+ }
38
+ }
39
+
40
+ .timeline-quote-highlight-relative {
41
+ position: relative;
42
+ }
43
+
44
+ [data-component="timeline-quote-background"] {
45
+ position: absolute;
46
+ /* These offsets share the physical coordinate system of DOMRects, including in RTL. */
47
+ left: 0;
48
+ top: 0;
49
+ width: 0;
50
+ height: 0;
51
+ z-index: -1;
52
+ pointer-events: none;
53
+ user-select: none;
54
+
55
+ > span {
56
+ position: absolute;
57
+ background-color: var(--timeline-quote-background);
58
+ }
59
+ }
@@ -0,0 +1,142 @@
1
+ import { createEffect, createSignal, onCleanup, untrack, type Accessor } from "solid-js"
2
+ import {
3
+ INITIAL_REVIEW_FOCUS_STATE,
4
+ REVIEW_FOCUS_TIMEOUT_MS,
5
+ transitionReviewFocus,
6
+ type ReviewFocusEffect,
7
+ type ReviewFocusEvent,
8
+ } from "./review-focus-machine"
9
+
10
+ type ReviewFocusTarget = { file: string; id: string }
11
+
12
+ // Browser resources of the current reveal; the phase itself lives in the machine.
13
+ type RevealHandles = {
14
+ frame?: number
15
+ ackFrame?: number
16
+ timer?: ReturnType<typeof setTimeout>
17
+ observer?: MutationObserver
18
+ }
19
+
20
+ type ReviewFocusDriverInput = {
21
+ focusedComment: Accessor<ReviewFocusTarget | null | undefined>
22
+ isAvailable: (focus: ReviewFocusTarget) => boolean
23
+ /** The element the comments render into; the driver watches it for the comment to appear. */
24
+ root: () => HTMLElement | undefined
25
+ /** The rendered, visible comment, if it is there yet. */
26
+ findComment: (file: string, commentId: string) => HTMLElement | undefined
27
+ /** Where to scroll while the comment is not rendered yet, such as its file's placeholder. */
28
+ findFallback?: (file: string) => HTMLElement | undefined
29
+ scrollTo: (target: HTMLElement) => void
30
+ onOpenComment: (file: string, commentId: string) => void
31
+ onExpandFile?: (file: string) => void
32
+ onAcknowledge: VoidFunction
33
+ }
34
+
35
+ // Reveals a parent's focused comment: waits for it to render (DOM mutations, `poke`), scrolls to it, and clears
36
+ // the parent's request once it is shown, unavailable or timed out.
37
+ export function createReviewFocusDriver(input: ReviewFocusDriverInput) {
38
+ const [focusState, setFocusState] = createSignal(INITIAL_REVIEW_FOCUS_STATE)
39
+
40
+ const handles: RevealHandles = {}
41
+
42
+ const dispatch = (event: ReviewFocusEvent) => {
43
+ const step = transitionReviewFocus(untrack(focusState), event)
44
+ setFocusState(step.state)
45
+ step.effects.forEach(run)
46
+ }
47
+
48
+ const run = (effect: ReviewFocusEffect) => {
49
+ if (effect.type === "cancel-reveal") {
50
+ if (handles.frame !== undefined) cancelAnimationFrame(handles.frame)
51
+
52
+ if (handles.ackFrame !== undefined) cancelAnimationFrame(handles.ackFrame)
53
+
54
+ if (handles.timer !== undefined) clearTimeout(handles.timer)
55
+ handles.observer?.disconnect()
56
+ handles.frame = undefined
57
+ handles.ackFrame = undefined
58
+ handles.timer = undefined
59
+ handles.observer = undefined
60
+
61
+ return
62
+ }
63
+
64
+ if (effect.type === "open-comment") return input.onOpenComment(effect.file, effect.commentId)
65
+
66
+ if (effect.type === "expand-file") return input.onExpandFile?.(effect.file)
67
+
68
+ if (effect.type === "reveal") {
69
+ handles.timer = setTimeout(
70
+ () => dispatch({ type: "reveal.timed-out", attempt: effect.attempt }),
71
+ REVIEW_FOCUS_TIMEOUT_MS,
72
+ )
73
+ schedule()
74
+
75
+ return
76
+ }
77
+
78
+ if (!effect.deferred) return acknowledge(effect.attempt)
79
+ // An unavailable target is known inside the effect that read the request, so clear it on the next frame.
80
+ handles.ackFrame = requestAnimationFrame(() => {
81
+ handles.ackFrame = undefined
82
+ acknowledge(effect.attempt)
83
+ })
84
+ }
85
+
86
+ const acknowledge = (attempt: number) => {
87
+ const current = untrack(focusState)
88
+
89
+ if (current.status !== "settled" || current.attempt !== attempt) return
90
+ input.onAcknowledge()
91
+ }
92
+
93
+ const schedule = () => {
94
+ if (handles.frame !== undefined) return
95
+ handles.frame = requestAnimationFrame(check)
96
+ }
97
+
98
+ const check = () => {
99
+ handles.frame = undefined
100
+ const current = untrack(focusState)
101
+
102
+ if (current.status !== "revealing") return
103
+ const root = input.root()
104
+
105
+ if (!root) return
106
+ const comment = input.findComment(current.file, current.commentId)
107
+
108
+ if (comment) {
109
+ input.scrollTo(comment)
110
+ dispatch({ type: "reveal.succeeded", attempt: current.attempt })
111
+
112
+ return
113
+ }
114
+
115
+ const fallback = input.findFallback?.(current.file)
116
+
117
+ if (fallback) input.scrollTo(fallback)
118
+
119
+ if (handles.observer) return
120
+ handles.observer = new MutationObserver(schedule)
121
+ handles.observer.observe(root, { childList: true, subtree: true })
122
+ }
123
+
124
+ createEffect(() => {
125
+ const focus = input.focusedComment()
126
+
127
+ untrack(() => {
128
+ if (!focus) return dispatch({ type: "focus.cleared" })
129
+ dispatch({ type: "focus.requested", file: focus.file, commentId: focus.id, available: input.isAvailable(focus) })
130
+ })
131
+ })
132
+
133
+ onCleanup(() => dispatch({ type: "disposed" }))
134
+
135
+ return {
136
+ state: focusState,
137
+ /** Checks again for the comment, for example after the diff rendered. */
138
+ poke: () => {
139
+ if (untrack(focusState).status === "revealing") schedule()
140
+ },
141
+ }
142
+ }