@neurocode-ai/session-ui 1.18.8

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 (114) hide show
  1. package/package.json +71 -0
  2. package/src/components/apply-patch-file.test.ts +43 -0
  3. package/src/components/apply-patch-file.ts +78 -0
  4. package/src/components/basic-tool.css +358 -0
  5. package/src/components/basic-tool.stories.tsx +133 -0
  6. package/src/components/basic-tool.tsx +343 -0
  7. package/src/components/dock-prompt.stories.tsx +62 -0
  8. package/src/components/dock-prompt.tsx +23 -0
  9. package/src/components/file-media.tsx +291 -0
  10. package/src/components/file-search.tsx +72 -0
  11. package/src/components/file-ssr.tsx +197 -0
  12. package/src/components/file.css +46 -0
  13. package/src/components/file.tsx +1202 -0
  14. package/src/components/line-comment-annotations.tsx +637 -0
  15. package/src/components/line-comment-styles.ts +292 -0
  16. package/src/components/line-comment.stories.tsx +115 -0
  17. package/src/components/line-comment.tsx +439 -0
  18. package/src/components/markdown-cache.tsx +78 -0
  19. package/src/components/markdown-code-state.test.ts +32 -0
  20. package/src/components/markdown-code-state.ts +22 -0
  21. package/src/components/markdown-inline-code-kind.test.ts +46 -0
  22. package/src/components/markdown-inline-code-kind.ts +1915 -0
  23. package/src/components/markdown-preload.test.ts +18 -0
  24. package/src/components/markdown-shiki.worker.ts +104 -0
  25. package/src/components/markdown-stream.test.ts +194 -0
  26. package/src/components/markdown-stream.ts +110 -0
  27. package/src/components/markdown-worker-protocol.test.ts +81 -0
  28. package/src/components/markdown-worker-protocol.ts +48 -0
  29. package/src/components/markdown-worker-queue.test.ts +49 -0
  30. package/src/components/markdown-worker-queue.ts +64 -0
  31. package/src/components/markdown-worker-transport.test.ts +56 -0
  32. package/src/components/markdown-worker-transport.ts +41 -0
  33. package/src/components/markdown-worker.ts +122 -0
  34. package/src/components/markdown.css +377 -0
  35. package/src/components/markdown.stories.tsx +53 -0
  36. package/src/components/markdown.tsx +678 -0
  37. package/src/components/message-file.test.ts +63 -0
  38. package/src/components/message-file.ts +34 -0
  39. package/src/components/message-nav.css +127 -0
  40. package/src/components/message-nav.stories.tsx +7 -0
  41. package/src/components/message-nav.tsx +102 -0
  42. package/src/components/message-part-text.ts +3 -0
  43. package/src/components/message-part.css +1569 -0
  44. package/src/components/message-part.stories.tsx +7 -0
  45. package/src/components/message-part.test.ts +28 -0
  46. package/src/components/message-part.tsx +2662 -0
  47. package/src/components/session-diff.test.ts +135 -0
  48. package/src/components/session-diff.ts +145 -0
  49. package/src/components/session-retry.tsx +74 -0
  50. package/src/components/session-review.css +247 -0
  51. package/src/components/session-review.stories.tsx +7 -0
  52. package/src/components/session-review.tsx +657 -0
  53. package/src/components/session-turn.css +241 -0
  54. package/src/components/session-turn.stories.tsx +7 -0
  55. package/src/components/session-turn.tsx +543 -0
  56. package/src/components/shell-submessage-motion.stories.tsx +346 -0
  57. package/src/components/shell-submessage.css +23 -0
  58. package/src/components/timeline-playground.stories.tsx +2090 -0
  59. package/src/components/tool-count-label.css +57 -0
  60. package/src/components/tool-count-label.tsx +58 -0
  61. package/src/components/tool-count-summary.css +102 -0
  62. package/src/components/tool-count-summary.stories.tsx +238 -0
  63. package/src/components/tool-count-summary.tsx +52 -0
  64. package/src/components/tool-error-card.css +91 -0
  65. package/src/components/tool-error-card.stories.tsx +92 -0
  66. package/src/components/tool-error-card.tsx +157 -0
  67. package/src/components/tool-status-title.css +89 -0
  68. package/src/components/tool-status-title.tsx +133 -0
  69. package/src/context/data.tsx +64 -0
  70. package/src/context/index.ts +1 -0
  71. package/src/pierre/comment-hover.ts +83 -0
  72. package/src/pierre/commented-lines.ts +91 -0
  73. package/src/pierre/diff-selection.ts +71 -0
  74. package/src/pierre/file-find.ts +485 -0
  75. package/src/pierre/file-runtime.ts +114 -0
  76. package/src/pierre/file-selection.ts +85 -0
  77. package/src/pierre/index.ts +186 -0
  78. package/src/pierre/media.ts +110 -0
  79. package/src/pierre/selection-bridge.ts +132 -0
  80. package/src/pierre/virtualizer.ts +100 -0
  81. package/src/pierre/worker.ts +52 -0
  82. package/src/styles/index.css +14 -0
  83. package/src/v2/components/attachment-card-v2.css +70 -0
  84. package/src/v2/components/attachment-card-v2.tsx +33 -0
  85. package/src/v2/components/basic-tool-v2.css +163 -0
  86. package/src/v2/components/basic-tool-v2.stories.tsx +137 -0
  87. package/src/v2/components/basic-tool-v2.tsx +139 -0
  88. package/src/v2/components/comment-card-v2.tsx +64 -0
  89. package/src/v2/components/line-comment-annotations-v2.tsx +220 -0
  90. package/src/v2/components/prompt-input/attachments.ts +266 -0
  91. package/src/v2/components/prompt-input/index.tsx +706 -0
  92. package/src/v2/components/prompt-input/interaction.ts +482 -0
  93. package/src/v2/components/prompt-input/machine.test.ts +164 -0
  94. package/src/v2/components/prompt-input/machine.ts +261 -0
  95. package/src/v2/components/prompt-input/prompt-input.stories.tsx +221 -0
  96. package/src/v2/components/prompt-input/store.test.ts +116 -0
  97. package/src/v2/components/prompt-input/store.ts +152 -0
  98. package/src/v2/components/prompt-input/types.ts +106 -0
  99. package/src/v2/components/session-file-panel-v2.tsx +43 -0
  100. package/src/v2/components/session-progress-indicator-v2.css +875 -0
  101. package/src/v2/components/session-progress-indicator-v2.stories.tsx +66 -0
  102. package/src/v2/components/session-progress-indicator-v2.tsx +32 -0
  103. package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
  104. package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
  105. package/src/v2/components/session-review-file-preview-v2-virtualize.test.ts +13 -0
  106. package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
  107. package/src/v2/components/session-review-file-preview-v2.tsx +290 -0
  108. package/src/v2/components/session-review-v2.css +458 -0
  109. package/src/v2/components/session-review-v2.tsx +340 -0
  110. package/src/v2/components/tool-error-card-v2.css +200 -0
  111. package/src/v2/components/tool-error-card-v2.stories.tsx +91 -0
  112. package/src/v2/components/tool-error-card-v2.tsx +166 -0
  113. package/sst-env.d.ts +10 -0
  114. package/tsconfig.json +19 -0
@@ -0,0 +1,292 @@
1
+ export const lineCommentStyles = `
2
+ [data-annotation-slot] {
3
+ padding: 12px;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ [data-component="line-comment"] {
8
+ position: absolute;
9
+ right: 24px;
10
+ z-index: var(--line-comment-z, 30);
11
+ }
12
+
13
+ [data-component="line-comment"][data-inline] {
14
+ position: relative;
15
+ right: auto;
16
+ display: flex;
17
+ width: 100%;
18
+ min-width: 0;
19
+ align-items: flex-start;
20
+ }
21
+
22
+ [data-component="line-comment"][data-open] {
23
+ z-index: var(--line-comment-open-z, 100);
24
+ }
25
+
26
+ [data-component="line-comment"] [data-slot="line-comment-button"] {
27
+ width: 20px;
28
+ height: 20px;
29
+ border-radius: var(--radius-md);
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ background: var(--icon-interactive-base);
34
+ box-shadow: var(--shadow-xs);
35
+ cursor: default;
36
+ border: none;
37
+ }
38
+
39
+ [data-component="line-comment"][data-variant="add"] [data-slot="line-comment-button"] {
40
+ background: var(--syntax-diff-add);
41
+ }
42
+
43
+ [data-component="line-comment"] [data-component="icon"] {
44
+ color: var(--white);
45
+ }
46
+
47
+ [data-component="line-comment"] [data-slot="line-comment-icon"] {
48
+ width: 12px;
49
+ height: 12px;
50
+ color: var(--white);
51
+ }
52
+
53
+ [data-component="line-comment"] [data-slot="line-comment-button"]:focus {
54
+ outline: none;
55
+ }
56
+
57
+ [data-component="line-comment"] [data-slot="line-comment-button"]:focus-visible {
58
+ box-shadow: var(--shadow-xs-border-focus);
59
+ }
60
+
61
+ [data-component="line-comment"] [data-slot="line-comment-popover"] {
62
+ position: absolute;
63
+ top: calc(100% + 4px);
64
+ right: -8px;
65
+ z-index: var(--line-comment-popover-z, 40);
66
+ min-width: 200px;
67
+ max-width: none;
68
+ box-sizing: border-box;
69
+ border-radius: 8px;
70
+ background: var(--surface-raised-stronger-non-alpha);
71
+ box-shadow: var(--shadow-xxs-border);
72
+ padding: 12px;
73
+ }
74
+
75
+ [data-component="line-comment"][data-inline] [data-slot="line-comment-popover"] {
76
+ position: relative;
77
+ top: auto;
78
+ right: auto;
79
+ margin-left: 8px;
80
+ flex: 1 1 0%;
81
+ width: auto;
82
+ max-width: 100%;
83
+ min-width: 0;
84
+ }
85
+
86
+ [data-component="line-comment"][data-inline] [data-slot="line-comment-popover"][data-inline-body] {
87
+ margin-left: 0;
88
+ }
89
+
90
+ [data-component="line-comment"][data-inline][data-variant="default"] [data-slot="line-comment-popover"][data-inline-body] {
91
+ cursor: pointer;
92
+ }
93
+
94
+ [data-component="line-comment"][data-variant="editor"] [data-slot="line-comment-popover"] {
95
+ width: 380px;
96
+ max-width: none;
97
+ padding: 8px;
98
+ border-radius: 14px;
99
+ }
100
+
101
+ [data-component="line-comment"][data-inline][data-variant="editor"] [data-slot="line-comment-popover"] {
102
+ width: 100%;
103
+ }
104
+
105
+ [data-component="line-comment"] [data-slot="line-comment-content"] {
106
+ display: flex;
107
+ flex-direction: column;
108
+ gap: 6px;
109
+ width: 100%;
110
+ min-width: 0;
111
+ }
112
+
113
+ [data-component="line-comment"] [data-slot="line-comment-head"] {
114
+ display: flex;
115
+ align-items: flex-start;
116
+ gap: 8px;
117
+ min-width: 0;
118
+ }
119
+
120
+ [data-component="line-comment"] [data-slot="line-comment-text"] {
121
+ flex: 1;
122
+ min-width: 0;
123
+ font-family: var(--font-family-sans);
124
+ font-size: var(--font-size-base);
125
+ font-weight: var(--font-weight-regular);
126
+ line-height: var(--line-height-x-large);
127
+ letter-spacing: var(--letter-spacing-normal);
128
+ color: var(--text-strong);
129
+ white-space: pre-wrap;
130
+ overflow-wrap: anywhere;
131
+ }
132
+
133
+ [data-component="line-comment"] [data-slot="line-comment-tools"] {
134
+ flex: 0 0 auto;
135
+ display: flex;
136
+ align-items: center;
137
+ justify-content: flex-end;
138
+ min-width: 0;
139
+ }
140
+
141
+ [data-component="line-comment"] [data-slot="line-comment-label"],
142
+ [data-component="line-comment"] [data-slot="line-comment-editor-label"] {
143
+ font-family: var(--font-family-sans);
144
+ font-size: var(--font-size-small);
145
+ font-weight: var(--font-weight-medium);
146
+ line-height: var(--line-height-large);
147
+ letter-spacing: var(--letter-spacing-normal);
148
+ color: var(--text-weak);
149
+ min-width: 0;
150
+ white-space: normal;
151
+ overflow-wrap: anywhere;
152
+ }
153
+
154
+ [data-component="line-comment"] [data-slot="line-comment-editor"] {
155
+ display: flex;
156
+ flex-direction: column;
157
+ gap: 8px;
158
+ width: 100%;
159
+ min-width: 0;
160
+ }
161
+
162
+ [data-component="line-comment"] [data-slot="line-comment-textarea"] {
163
+ width: 100%;
164
+ box-sizing: border-box;
165
+ resize: vertical;
166
+ padding: 8px;
167
+ border-radius: var(--radius-md);
168
+ background: var(--surface-base);
169
+ border: 1px solid var(--border-base);
170
+ color: var(--text-strong);
171
+ font-family: var(--font-family-sans);
172
+ font-size: var(--font-size-small);
173
+ line-height: var(--line-height-large);
174
+ }
175
+
176
+ [data-component="line-comment"] [data-slot="line-comment-textarea"]:focus {
177
+ outline: none;
178
+ box-shadow: var(--shadow-xs-border-select);
179
+ }
180
+
181
+ [data-component="line-comment"] [data-slot="line-comment-mention-list"] {
182
+ display: flex;
183
+ flex-direction: column;
184
+ gap: 4px;
185
+ max-height: 180px;
186
+ overflow: auto;
187
+ padding: 4px;
188
+ border: 1px solid var(--border-base);
189
+ border-radius: var(--radius-md);
190
+ background: var(--surface-base);
191
+ }
192
+
193
+ [data-component="line-comment"] [data-slot="line-comment-mention-item"] {
194
+ display: flex;
195
+ align-items: center;
196
+ gap: 8px;
197
+ width: 100%;
198
+ min-width: 0;
199
+ padding: 6px 8px;
200
+ border: 0;
201
+ border-radius: var(--radius-sm);
202
+ background: transparent;
203
+ color: var(--text-strong);
204
+ text-align: left;
205
+ }
206
+
207
+ [data-component="line-comment"] [data-slot="line-comment-mention-item"][data-active] {
208
+ background: var(--surface-raised-base-hover);
209
+ }
210
+
211
+ [data-component="line-comment"] [data-slot="line-comment-mention-path"] {
212
+ display: flex;
213
+ align-items: center;
214
+ min-width: 0;
215
+ font-family: var(--font-family-sans);
216
+ font-size: var(--font-size-small);
217
+ line-height: var(--line-height-large);
218
+ }
219
+
220
+ [data-component="line-comment"] [data-slot="line-comment-mention-dir"] {
221
+ min-width: 0;
222
+ color: var(--text-weak);
223
+ white-space: nowrap;
224
+ overflow: hidden;
225
+ text-overflow: ellipsis;
226
+ }
227
+
228
+ [data-component="line-comment"] [data-slot="line-comment-mention-file"] {
229
+ color: var(--text-strong);
230
+ white-space: nowrap;
231
+ }
232
+
233
+ [data-component="line-comment"] [data-slot="line-comment-actions"] {
234
+ display: flex;
235
+ align-items: center;
236
+ flex-wrap: wrap;
237
+ gap: 8px;
238
+ padding-left: 8px;
239
+ min-width: 0;
240
+ }
241
+
242
+ [data-component="line-comment"] [data-slot="line-comment-editor-label"] {
243
+ flex: 1 1 220px;
244
+ margin-right: auto;
245
+ }
246
+
247
+ [data-component="line-comment"] [data-slot="line-comment-action"] {
248
+ border: 1px solid var(--border-base);
249
+ background: var(--surface-base);
250
+ color: var(--text-strong);
251
+ border-radius: var(--radius-md);
252
+ height: 28px;
253
+ padding: 0 10px;
254
+ font-family: var(--font-family-sans);
255
+ font-size: var(--font-size-small);
256
+ font-weight: var(--font-weight-medium);
257
+ }
258
+
259
+ [data-component="line-comment"] [data-slot="line-comment-action"][data-variant="ghost"] {
260
+ background: transparent;
261
+ }
262
+
263
+ [data-component="line-comment"] [data-slot="line-comment-action"][data-variant="primary"] {
264
+ background: var(--text-strong);
265
+ border-color: var(--text-strong);
266
+ color: var(--background-base);
267
+ }
268
+
269
+ [data-component="line-comment"] [data-slot="line-comment-action"]:disabled {
270
+ opacity: 0.5;
271
+ pointer-events: none;
272
+ }
273
+ `
274
+
275
+ let installed = false
276
+
277
+ export function installLineCommentStyles() {
278
+ if (installed) return
279
+ if (typeof document === "undefined") return
280
+
281
+ const id = "opencode-line-comment-styles"
282
+ if (document.getElementById(id)) {
283
+ installed = true
284
+ return
285
+ }
286
+
287
+ const style = document.createElement("style")
288
+ style.id = id
289
+ style.textContent = lineCommentStyles
290
+ document.head.appendChild(style)
291
+ installed = true
292
+ }
@@ -0,0 +1,115 @@
1
+ // @ts-nocheck
2
+ import { createSignal } from "solid-js"
3
+ import * as mod from "./line-comment"
4
+
5
+ const docs = `### Overview
6
+ Inline comment anchor and editor for code review or annotation flows.
7
+
8
+ Pair with \`Diff\` or \`Code\` to align comments to lines.
9
+
10
+ ### API
11
+ - \`LineCommentAnchor\`: position with \`top\`, control \`open\`, render custom children.
12
+ - \`LineComment\`: convenience wrapper for displaying comment + selection label.
13
+ - \`LineCommentEditor\`: controlled textarea with submit/cancel handlers.
14
+
15
+ ### Variants and states
16
+ - Default display and editor display variants.
17
+
18
+ ### Behavior
19
+ - Anchor positions relative to a containing element.
20
+ - Editor submits on Enter (Shift+Enter for newline).
21
+
22
+ ### Accessibility
23
+ - TODO: confirm ARIA labeling for comment button and editor textarea.
24
+
25
+ ### Theming/tokens
26
+ - Uses \`data-component="line-comment"\` and related slots.
27
+
28
+ `
29
+
30
+ export default {
31
+ title: "UI/LineComment",
32
+ id: "components-line-comment",
33
+ component: mod.LineComment,
34
+ tags: ["autodocs"],
35
+ parameters: {
36
+ docs: {
37
+ description: {
38
+ component: docs,
39
+ },
40
+ },
41
+ },
42
+ }
43
+
44
+ export const Default = {
45
+ render: () => (
46
+ <div
47
+ style={{
48
+ position: "relative",
49
+ height: "160px",
50
+ padding: "16px 16px 16px 40px",
51
+ border: "1px solid var(--border-weak)",
52
+ "border-radius": "8px",
53
+ "font-family": "var(--font-family-mono)",
54
+ "font-size": "12px",
55
+ color: "var(--text-weak)",
56
+ }}
57
+ >
58
+ <div>12 | const total = sum(values)</div>
59
+ <div>13 | return total / values.length</div>
60
+ <mod.LineComment open top={18} comment="Consider guarding against empty arrays." selection="L12-L13" />
61
+ </div>
62
+ ),
63
+ }
64
+
65
+ export const Editor = {
66
+ render: () => {
67
+ const [value, setValue] = createSignal("Add context for this change.")
68
+ return (
69
+ <div
70
+ style={{
71
+ position: "relative",
72
+ height: "220px",
73
+ padding: "16px 16px 16px 40px",
74
+ border: "1px solid var(--border-weak)",
75
+ "border-radius": "8px",
76
+ "font-family": "var(--font-family-mono)",
77
+ "font-size": "12px",
78
+ color: "var(--text-weak)",
79
+ }}
80
+ >
81
+ <div>40 | if (values.length === 0) return 0</div>
82
+ <mod.LineCommentEditor
83
+ top={24}
84
+ value={value()}
85
+ selection="L40"
86
+ onInput={setValue}
87
+ onCancel={() => setValue("")}
88
+ onSubmit={(next) => setValue(next)}
89
+ />
90
+ </div>
91
+ )
92
+ },
93
+ }
94
+
95
+ export const AnchorOnly = {
96
+ render: () => (
97
+ <div
98
+ style={{
99
+ position: "relative",
100
+ height: "120px",
101
+ padding: "16px 16px 16px 40px",
102
+ border: "1px solid var(--border-weak)",
103
+ "border-radius": "8px",
104
+ "font-family": "var(--font-family-mono)",
105
+ "font-size": "12px",
106
+ color: "var(--text-weak)",
107
+ }}
108
+ >
109
+ <div>20 | const ready = true</div>
110
+ <mod.LineCommentAnchor top={18} open={false}>
111
+ <div data-slot="line-comment-content">Anchor content</div>
112
+ </mod.LineCommentAnchor>
113
+ </div>
114
+ ),
115
+ }