/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/tui/src/component/spinner.tsx
26 строк
942 B
Simon Klee
tui: preserve spinner registration (#35292)
04 июл 2026, 10:44
Не верифицирован
04 июл 2026, 10:44
7a8e7c8
Код
Авторство
О чём код?
import { Show } from "solid-js" import { useTheme } from "../context/theme" import { useKV } from "../context/kv" import type { JSX } from "@opentui/solid" import type { RGBA } from "@opentui/core" import { registerOpencodeSpinner } from "./register-spinner" registerOpencodeSpinner() export const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"] export function Spinner(props: { children?: JSX.Element; color?: RGBA }) { const { theme } = useTheme() const kv = useKV() const color = () => props.color ?? theme.textMuted return ( <Show when={kv.get("animations_enabled", true)} fallback={<text fg={color()}>⋯ {props.children}</text>}> <box flexDirection="row" gap={1}> <spinner frames={SPINNER_FRAMES} interval={80} color={color()} /> <Show when={props.children}> <text fg={color()}>{props.children}</text> </Show> </box> </Show> ) }