@opencode-ai/ui 0.0.0-next-17389 → 0.0.0-next-17394

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.
@@ -1,4 +1,4 @@
1
- import { type Accessor, type ComponentProps } from "solid-js";
1
+ import { type ComponentProps } from "solid-js";
2
2
  export type ScrollViewThumbVisibility = "hover" | "scroll";
3
3
  export interface ScrollViewProps extends ComponentProps<"div"> {
4
4
  viewportRef?: (el: HTMLDivElement) => void;
@@ -11,9 +11,9 @@ export interface ScrollViewProps extends ComponentProps<"div"> {
11
11
  * */
12
12
  thumbVisibility?: ScrollViewThumbVisibility;
13
13
  /** Mount the thumb into an external track. Scroll metrics still come from this ScrollView. */
14
- thumbContainer?: HTMLElement | Accessor<HTMLElement | undefined>;
14
+ thumbContainer?: HTMLElement;
15
15
  /** Element whose hover reveals the thumb. Defaults to the ScrollView root when unset. */
16
- thumbHoverTarget?: HTMLElement | Accessor<HTMLElement | undefined>;
16
+ thumbHoverTarget?: HTMLElement;
17
17
  }
18
18
  export declare const scrollKey: (event: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey">) => "end" | "home" | "page-down" | "page-up" | "up" | "down" | undefined;
19
19
  export declare function canScrollKey(element: HTMLElement, key: NonNullable<ReturnType<typeof scrollKey>>): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode-ai/ui",
3
- "version": "0.0.0-next-17389",
3
+ "version": "0.0.0-next-17394",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- import { type ComponentProps, splitProps } from "solid-js"
1
+ import { type ComponentProps, Show, splitProps } from "solid-js"
2
2
  import { Icon, type IconProps } from "./icon"
3
3
 
4
4
  type Variant = "normal" | "error" | "warning" | "success" | "info"
@@ -80,11 +80,11 @@ export function CardTitle(props: CardTitleProps) {
80
80
  [split.class ?? ""]: !!split.class,
81
81
  }}
82
82
  >
83
- {show() ? (
83
+ <Show when={show()}>
84
84
  <span data-slot="card-title-icon" data-placeholder={placeholder() || undefined}>
85
85
  <Icon name={name() ?? "dash"} size="small" />
86
86
  </span>
87
- ) : null}
87
+ </Show>
88
88
  {split.children}
89
89
  </div>
90
90
  )
@@ -367,9 +367,11 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
367
367
  </span>
368
368
  )}
369
369
  </Show>
370
- {props.divider && (i() !== group.items.length - 1 || (showAdd() && isLastGroup())) && (
370
+ <Show
371
+ when={props.divider && (i() !== group.items.length - 1 || (showAdd() && isLastGroup()))}
372
+ >
371
373
  <span data-slot="list-item-divider" />
372
- )}
374
+ </Show>
373
375
  </button>
374
376
  )
375
377
  if (props.itemWrapper) return props.itemWrapper(item, node)
@@ -1,14 +1,4 @@
1
- import {
2
- createEffect,
3
- createMemo,
4
- mergeProps,
5
- onCleanup,
6
- onMount,
7
- Show,
8
- splitProps,
9
- type Accessor,
10
- type ComponentProps,
11
- } from "solid-js"
1
+ import { createEffect, mergeProps, onCleanup, onMount, Show, splitProps, type ComponentProps } from "solid-js"
12
2
  import { Portal } from "solid-js/web"
13
3
  import { createResizeObserver } from "@solid-primitives/resize-observer"
14
4
  import { createStore } from "solid-js/store"
@@ -27,9 +17,9 @@ export interface ScrollViewProps extends ComponentProps<"div"> {
27
17
  * */
28
18
  thumbVisibility?: ScrollViewThumbVisibility
29
19
  /** Mount the thumb into an external track. Scroll metrics still come from this ScrollView. */
30
- thumbContainer?: HTMLElement | Accessor<HTMLElement | undefined>
20
+ thumbContainer?: HTMLElement
31
21
  /** Element whose hover reveals the thumb. Defaults to the ScrollView root when unset. */
32
- thumbHoverTarget?: HTMLElement | Accessor<HTMLElement | undefined>
22
+ thumbHoverTarget?: HTMLElement
33
23
  }
34
24
 
35
25
  export const scrollKey = (event: Pick<KeyboardEvent, "key" | "altKey" | "ctrlKey" | "metaKey" | "shiftKey">) => {
@@ -128,13 +118,8 @@ export function ScrollView(props: ScrollViewProps) {
128
118
  let viewportRef!: HTMLDivElement
129
119
  let thumbRef!: HTMLDivElement
130
120
 
131
- const resolveEl = (value: HTMLElement | Accessor<HTMLElement | undefined> | undefined) => {
132
- if (typeof value === "function") return value()
133
- return value
134
- }
135
-
136
- const thumbMount = createMemo(() => resolveEl(local.thumbContainer))
137
- const thumbHover = createMemo(() => resolveEl(local.thumbHoverTarget))
121
+ const thumbMount = () => local.thumbContainer
122
+ const thumbHover = () => local.thumbHoverTarget
138
123
  const hoverRoot = () => !local.thumbHoverTarget && !local.thumbContainer
139
124
 
140
125
  const [state, setState] = createStore({
@@ -1,7 +1,7 @@
1
1
  import { Toast as Kobalte, toaster } from "@kobalte/core/toast"
2
2
  import type { ToastRootProps, ToastCloseButtonProps, ToastTitleProps, ToastDescriptionProps } from "@kobalte/core/toast"
3
3
  import type { ComponentProps, JSX } from "solid-js"
4
- import { Show } from "solid-js"
4
+ import { For, Show } from "solid-js"
5
5
  import { Portal } from "solid-js/web"
6
6
  import { useI18n } from "../context/i18n"
7
7
  import { Icon, type IconProps } from "./icon"
@@ -136,19 +136,21 @@ export function showToast(options: ToastOptions | string) {
136
136
  </Show>
137
137
  <Show when={opts.actions?.length}>
138
138
  <Toast.Actions>
139
- {opts.actions!.map((action) => (
140
- <button
141
- data-slot="toast-action"
142
- onClick={() => {
143
- if (typeof action.onClick === "function") {
144
- action.onClick()
145
- }
146
- toaster.dismiss(props.toastId)
147
- }}
148
- >
149
- {action.label}
150
- </button>
151
- ))}
139
+ <For each={opts.actions}>
140
+ {(action) => (
141
+ <button
142
+ data-slot="toast-action"
143
+ onClick={() => {
144
+ if (typeof action.onClick === "function") {
145
+ action.onClick()
146
+ }
147
+ toaster.dismiss(props.toastId)
148
+ }}
149
+ >
150
+ {action.label}
151
+ </button>
152
+ )}
153
+ </For>
152
154
  </Toast.Actions>
153
155
  </Show>
154
156
  </Toast.Content>
@@ -59,7 +59,7 @@ export function DialogHeader(props: DialogHeaderProps) {
59
59
  return (
60
60
  <div data-slot="dialog-header" data-hide-close={hideClose() ? "" : undefined}>
61
61
  {local.children}
62
- {!hideClose() && (
62
+ <Show when={!hideClose()}>
63
63
  <Kobalte.CloseButton data-slot="dialog-close-button" aria-label={local.closeLabel ?? i18n.t("ui.common.close")}>
64
64
  <svg
65
65
  width="16"
@@ -76,7 +76,7 @@ export function DialogHeader(props: DialogHeaderProps) {
76
76
  />
77
77
  </svg>
78
78
  </Kobalte.CloseButton>
79
- )}
79
+ </Show>
80
80
  </div>
81
81
  )
82
82
  }
@@ -239,6 +239,8 @@ function createToastV2Actions(entry: ActiveToastV2) {
239
239
  if (!entry.options.actions?.length) return undefined
240
240
  return (
241
241
  <ToastV2.Actions>
242
+ {/* Static map, not <For>: this JSX is created imperatively outside any Solid
243
+ root, where a <For> computation would never be disposed. */}
242
244
  {entry.options.actions.map((action, index) => (
243
245
  <button
244
246
  type="button"