@opencode/ui 0.0.0-dev-970 → 0.0.0-dev-972

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode/ui",
3
- "version": "0.0.0-dev-970",
3
+ "version": "0.0.0-dev-972",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -289,7 +289,7 @@
289
289
  "generate:v2-oc2": "bun run script/build-oc2-v2-overrides.ts"
290
290
  },
291
291
  "devDependencies": {
292
- "@hona/strobe": "0.17.0",
292
+ "@hona/strobe": "0.18.0",
293
293
  "@solidjs/meta": "0.29.4",
294
294
  "@tsconfig/node22": "22.0.2",
295
295
  "@types/bun": "1.4.3",
@@ -304,7 +304,7 @@
304
304
  "dependencies": {
305
305
  "@kitlangton/solid-motion": "0.2.2",
306
306
  "@kobalte/core": "0.13.13",
307
- "@opencode/util": "0.0.0-dev-970",
307
+ "@opencode/util": "0.0.0-dev-972",
308
308
  "@pierre/diffs": "1.6.1",
309
309
  "@pierre/highlights": "0.2.0",
310
310
  "@solid-primitives/event-listener": "2.4.6",
@@ -187,8 +187,9 @@ export function SearchList<T>(props: {
187
187
  createEffect(() => props.onActive?.(typeahead.activeItem()))
188
188
 
189
189
  // A new query starts from the top. Results that arrive later for the same query bring a chosen row back into view,
190
- // but leave the list where the wheel put it while the first row is still the default.
190
+ // but leave the list where the wheel put it while the first row is still the default or the pointer took the row.
191
191
  let revealed = props.query
192
+ let pointed: string | undefined
192
193
 
193
194
  createEffect(
194
195
  on(
@@ -197,7 +198,7 @@ export function SearchList<T>(props: {
197
198
  const fresh = props.query !== revealed
198
199
  revealed = props.query
199
200
 
200
- if (!fresh && typeahead.activeItem() === all[0]) return
201
+ if (!fresh && (typeahead.activeItem() === all[0] || activeKey() === pointed)) return
201
202
  const frame = requestAnimationFrame(reveal)
202
203
  onCleanup(() => cancelAnimationFrame(frame))
203
204
  },
@@ -205,7 +206,12 @@ export function SearchList<T>(props: {
205
206
  ),
206
207
  )
207
208
 
208
- props.ref?.({ active: typeahead.activeItem, setActive: typeahead.setActive })
209
+ const choose = (key: string | undefined) => {
210
+ pointed = undefined
211
+ typeahead.setActive(key)
212
+ }
213
+
214
+ props.ref?.({ active: typeahead.activeItem, setActive: choose })
209
215
 
210
216
  const onKeyDown = (event: KeyboardEvent) => {
211
217
  if (event.isComposing) return
@@ -232,7 +238,7 @@ export function SearchList<T>(props: {
232
238
  const target = all[step(from)]
233
239
 
234
240
  if (target === undefined) return
235
- typeahead.setActive(props.key(target))
241
+ choose(props.key(target))
236
242
  reveal()
237
243
  }
238
244
 
@@ -254,7 +260,7 @@ export function SearchList<T>(props: {
254
260
  },
255
261
  onInput: (event) => {
256
262
  // A new query starts again from its first row.
257
- typeahead.setActive(undefined)
263
+ choose(undefined)
258
264
  props.onQuery(event.currentTarget.value)
259
265
  },
260
266
  onKeyDown,
@@ -274,7 +280,9 @@ export function SearchList<T>(props: {
274
280
  },
275
281
  onMouseMove: (event) => {
276
282
  // A static cursor must not take the active row while the keyboard scrolls rows beneath it.
277
- if (event.movementX !== 0 || event.movementY !== 0) typeahead.setActive(key)
283
+ if (event.movementX === 0 && event.movementY === 0) return
284
+ pointed = key
285
+ typeahead.setActive(key)
278
286
  },
279
287
  // Focus stays in the field.
280
288
  onMouseDown: (event) => event.preventDefault(),