@opencode/ui 2.2.2 → 2.2.3

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": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -288,7 +288,7 @@
288
288
  "dependencies": {
289
289
  "@kitlangton/solid-motion": "0.2.2",
290
290
  "@kobalte/core": "0.13.13",
291
- "@opencode/util": "2.2.2",
291
+ "@opencode/util": "2.2.3",
292
292
  "@pierre/diffs": "1.6.1",
293
293
  "@pierre/highlights": "0.2.0",
294
294
  "@solid-primitives/event-listener": "2.4.6",
@@ -182,8 +182,9 @@
182
182
  }
183
183
 
184
184
  /* A modal Kobalte dialog turns the body's pointer events off and only restores them when its content unmounts, which
185
- the closing flight above holds back; the page takes clicks again as soon as the close starts. */
186
- body:has([data-component="image-preview"] [data-slot="image-preview-content"][data-closed]) {
185
+ the closing flight above holds back; the page takes clicks again as soon as the close starts. The preview marks the
186
+ body itself: a body:has() rule made Chromium restyle the body on every DOM insertion anywhere in the page. */
187
+ body[data-image-preview-closing] {
187
188
  pointer-events: auto !important;
188
189
  }
189
190
 
@@ -405,12 +405,16 @@ export function ImagePreview(props: ImagePreviewProps) {
405
405
  settle()
406
406
  showOrigin()
407
407
  giveBack()
408
+ document.body.removeAttribute("data-image-preview-closing")
408
409
  })
409
410
 
410
411
  createEffect(
411
412
  on(
412
413
  () => dialog.isOpen(),
413
414
  (open) => {
415
+ // See image-preview.css: the body takes clicks again while the closing flight holds the dialog mounted.
416
+ document.body.toggleAttribute("data-image-preview-closing", !open)
417
+
414
418
  if (!open) dismiss()
415
419
  },
416
420
  { defer: true },
@@ -17,7 +17,8 @@ export function TruncatedText(props: { text: string; class?: string }) {
17
17
  <Tooltip
18
18
  value={<span dir="auto">{props.text}</span>}
19
19
  disabled={!store.truncated}
20
- triggerTabIndex={store.truncated ? 0 : -1}
20
+ // Focusable only while there is more to reveal; a -1 would still let a click focus the name.
21
+ triggerTabIndex={store.truncated ? 0 : undefined}
21
22
  class={`truncated-text ${props.class ?? ""}`}
22
23
  contentClass="truncated-text-tooltip"
23
24
  >
@@ -2,7 +2,7 @@ import { Toaster, toast, type ToasterProps } from "solid-sonner"
2
2
  import { boundToastDescription } from "./description"
3
3
  import { isRTL } from "@kobalte/core/i18n"
4
4
  import type { ComponentProps, JSX } from "solid-js"
5
- import { createContext, onCleanup, onMount, splitProps, useContext } from "solid-js"
5
+ import { createContext, onCleanup, splitProps, useContext } from "solid-js"
6
6
  import { Portal } from "solid-js/web"
7
7
  import { useI18n } from "../../context/i18n"
8
8
  import "../../actions/button/button.css"
@@ -14,46 +14,26 @@ export interface ToastRegionProps extends ToasterProps {}
14
14
  function ToastRegion(props: ToastRegionProps) {
15
15
  const i18n = useI18n()
16
16
  const [local, rest] = splitProps(props, ["class", "className", "style", "toastOptions", "swipeDirections"])
17
- onMount(() => {
17
+
18
+ // The Portal's container holds the toast region whenever it exists. Watching the container, not the whole body,
19
+ // keeps every DOM change elsewhere in the page (each streamed delta, each mounted row) from scanning the document.
20
+ const observe = (container: HTMLDivElement) => {
18
21
  const sync = () => {
19
- document.querySelectorAll<HTMLElement>(".toast-v2-region .toast-v2").forEach((element) => {
22
+ container.querySelectorAll<HTMLElement>(".toast-v2-region .toast-v2").forEach((element) => {
20
23
  const hidden = element.dataset.visible === "false"
21
24
  element.inert = hidden
22
25
  element.tabIndex = hidden ? -1 : 0
23
26
  })
24
27
  }
25
28
 
26
- let connected = false
27
-
28
- const connect = () => {
29
- const regions = document.querySelectorAll(".toast-v2-region")
30
-
31
- if (!regions.length) return
32
- observer.disconnect()
33
- regions.forEach((region) => {
34
- observer.observe(region, {
35
- subtree: true,
36
- childList: true,
37
- attributes: true,
38
- attributeFilter: ["data-visible"],
39
- })
40
- })
41
- connected = true
42
- sync()
43
- }
44
-
45
- const observer = new MutationObserver(() => {
46
- if (!connected) connect()
47
- else sync()
48
- })
49
-
50
- observer.observe(document.body, { subtree: true, childList: true })
51
- queueMicrotask(connect)
29
+ const observer = new MutationObserver(sync)
30
+ observer.observe(container, { subtree: true, childList: true, attributes: true, attributeFilter: ["data-visible"] })
31
+ sync()
52
32
  onCleanup(() => observer.disconnect())
53
- })
33
+ }
54
34
 
55
35
  return (
56
- <Portal>
36
+ <Portal ref={observe}>
57
37
  <Toaster
58
38
  position={isRTL(i18n.locale()) ? "bottom-left" : "bottom-right"}
59
39
  offset={isRTL(i18n.locale()) ? { left: 32, bottom: 48 } : { right: 32, bottom: 48 }}
@@ -16,34 +16,6 @@
16
16
  background: var(--v2-background-bg-layer-01);
17
17
  border-radius: 6px;
18
18
  box-shadow: var(--v2-elevation-floating);
19
- transform-origin: top center;
20
- animation: select-v2-content-in 120ms ease-out;
21
- }
22
-
23
- [data-component="menu-v2-content"][data-slot="select-v2-content"][data-closed] {
24
- animation: select-v2-content-out 80ms ease-in forwards;
25
- }
26
-
27
- @keyframes select-v2-content-in {
28
- from {
29
- opacity: 0;
30
- transform: translateY(-2px);
31
- }
32
- to {
33
- opacity: 1;
34
- transform: translateY(0);
35
- }
36
- }
37
-
38
- @keyframes select-v2-content-out {
39
- from {
40
- opacity: 1;
41
- transform: translateY(0);
42
- }
43
- to {
44
- opacity: 0;
45
- transform: translateY(-2px);
46
- }
47
19
  }
48
20
 
49
21
  /* Shared trigger structure for the inline control. */
@@ -152,6 +152,7 @@ export function Typeahead<T>(props: {
152
152
  </button>
153
153
  </Show>
154
154
  </div>
155
+ <div aria-hidden="true" class="h-[0.5px] shrink-0 bg-v2-border-border-base" />
155
156
  {/* Initial results and the empty state snap into place; other search resizing animates. */}
156
157
  <div
157
158
  class="overflow-hidden duration-[200ms] ease-[cubic-bezier(0.645,0.045,0.355,1)] motion-reduce:transition-none"
@@ -164,7 +165,13 @@ export function Typeahead<T>(props: {
164
165
  )
165
166
  }
166
167
  >
167
- <div id={typeahead.listID} role="listbox" class="max-h-56 overflow-y-auto px-1 pb-1 empty:hidden">
168
+ {/* A stable gutter keeps rows from shifting when the list overflows; the end padding gives way to it. */}
169
+ <div
170
+ id={typeahead.listID}
171
+ role="listbox"
172
+ data-scrollable
173
+ class="max-h-56 overflow-y-auto py-1 ps-1 pe-[max(0px,calc(4px-var(--scrollbar-size,0px)))] [scrollbar-gutter:stable] empty:hidden"
174
+ >
168
175
  <For each={results().items}>
169
176
  {(item) => (
170
177
  <div
@@ -192,7 +199,7 @@ export function Typeahead<T>(props: {
192
199
  {/* Stays mounted while a retry or a newer query is pending, so the list never collapses to nothing. */}
193
200
  <Show when={results().items.length === 0}>
194
201
  <div
195
- class="mx-1 flex h-8 items-center px-2 pb-1 text-v2-text-text-faint"
202
+ class="mx-1 flex h-9 items-center px-2 py-1 text-v2-text-text-faint"
196
203
  classList={{ invisible: store.answered === undefined }}
197
204
  >
198
205
  <Show when={failed()} fallback={props.emptyLabel}>
@@ -90,6 +90,7 @@ const replacements: Partial<Record<IconName, { name: NewIconName; rotate?: numbe
90
90
  "select-element": { name: "annotate" },
91
91
  download: { name: "download" },
92
92
  "post-skill": { name: "skill" },
93
+ "graduation-cap": { name: "skill" },
93
94
  eye: { name: "eye-open" },
94
95
  "outline-eye": { name: "eye-open" },
95
96
  "outline-eye-slash": { name: "eye-closed" },
@@ -131,7 +132,7 @@ const replacements: Partial<Record<IconName, { name: NewIconName; rotate?: numbe
131
132
  // Status: circle-xmark (10) / circle-x (1), outline-hexagonal-warning (7) / warning (6), status / status-active (4),
132
133
  // help (3), info (2)
133
134
  // Features: terminal (6), mcp (5), branch (5, held back), console / outline-console (2), stop, models,
134
- // link, share, brain / outline-brain, shield, graduation-cap
135
+ // link, share, brain / outline-brain, shield
135
136
  // Arrows: arrow-up-right (5) / outline-arrow-up-right (3), arrow-down-to-line (2), arrow-undo-down
136
137
  // Layout: layout-left / layout-left-full (4), layout-right / layout-right-full (2), chevron-grabber-vertical (4),
137
138
  // fill-triangle-down (3), menu (2), expand / collapse, split / unified, dot-grid
@@ -276,14 +276,3 @@
276
276
  font-variant-numeric: normal;
277
277
  }
278
278
  }
279
-
280
- @keyframes menu-v2-in {
281
- from {
282
- opacity: 0;
283
- transform: scale(0.96);
284
- }
285
- to {
286
- opacity: 1;
287
- transform: scale(1);
288
- }
289
- }