Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(calls): improve incoming call ux - active calls area, better waiting screen, active call message (#3710)
Seamusfcf547abf610
diff --git a/js/app/biome.jsonc b/js/app/biome.jsoncindex 9b59b15bec..a12b6f70bf 100644--- a/js/app/biome.jsonc+++ b/js/app/biome.jsonc@@ -143,8 +143,7 @@"includes": ["packages/app/component/settings/**","packages/animate/**",- "packages/theme/**",- "packages/ui/**"+ "packages/theme/**"],"formatter": {"enabled": falsediff --git a/js/app/packages/app/component/app-sidebar/active-call-widget.tsx b/js/app/packages/app/component/app-sidebar/active-call-widget.tsxnew file mode 100644index 0000000000..f44797f652--- /dev/null+++ b/js/app/packages/app/component/app-sidebar/active-call-widget.tsx@@ -0,0 +1,248 @@+import { openChannelCallTab, useCallContextOptional } from '@channel/Call';+import { useChannelsContext } from '@core/context/channels';+import { useUserId } from '@core/context/user';+import PhoneIcon from '@icon/wide-call.svg';+import { useActiveCallsForChannelsQuery } from '@queries/call/call';+import type { ApiChannelWithLatest } from '@service-storage/channel-list-types';+import { ChannelTypeEnum } from '@service-storage/client';+import { Avatar, Button, cn, Tooltip } from '@ui';+import { createMemo, createSignal, For, onCleanup, Show } from 'solid-js';+import type { SidebarState } from './sidebar';++const SLIM_MAX = 4;++function displayName(channel: ApiChannelWithLatest | undefined) {+ if (!channel) return 'Channel';+ if (channel.channel_type === ChannelTypeEnum.DirectMessage) {+ return channel.name || 'Direct message';+ }+ return channel.name ? `#${channel.name}` : 'Channel';+}++function ChannelCallBadge(props: {+ channel: ApiChannelWithLatest | undefined;+ letters: string;+ slim: boolean;+}) {+ return (+ <div class="relative flex items-center justify-center shrink-0 size-5">+ <Avatar size="md" class="bg-ink-extra-muted/15 text-ink-muted">+ <Avatar.Fallback class="font-semibold">{props.letters}</Avatar.Fallback>+ </Avatar>+ <Show when={props.slim}>+ <span class="absolute -top-0.5 -right-0.5 size-1.5 bg-success rounded-full ring-surface ring-2" />+ </Show>+ </div>+ );+}++function computeChannelLetters(+ calls: { channel: ApiChannelWithLatest | undefined; channelId: string }[],+ currentUserId?: string+): Map<string, string> {+ const result = new Map<string, string>();+ const firstLetterCount = new Map<string, number>();+ const getName = (channel: ApiChannelWithLatest) => {+ const channelName = channel.name?.trim();+ if (channelName) return channelName;++ if (channel.channel_type !== ChannelTypeEnum.DirectMessage) return '';++ const participant =+ channel.participants.find((p) => p.user_id !== currentUserId) ??+ channel.participants[0];+ if (!participant) return '';++ const displayName =+ 'displayName' in participant &&+ typeof participant.displayName === 'string'+ ? participant.displayName+ : undefined;+ return displayName?.trim() || participant.user_id;+ };++ for (const call of calls) {+ const channel = call.channel;+ if (!channel) continue;+ const name = getName(channel);+ const first = name[0]?.toUpperCase() ?? '';+ firstLetterCount.set(first, (firstLetterCount.get(first) ?? 0) + 1);+ }++ for (const call of calls) {+ const channel = call.channel;+ if (!channel) continue;+ const name = getName(channel);+ const first = name[0]?.toUpperCase() ?? '';+ const needsTwo = (firstLetterCount.get(first) ?? 0) > 1 && name.length > 1;+ result.set(+ call.channelId,+ needsTwo ? first + name[1].toUpperCase() : first+ );+ }++ return result;+}++function formatDuration(startedAt: string | undefined, nowMs: number) {+ const startedAtMs = startedAt ? new Date(startedAt).getTime() : Number.NaN;+ if (!Number.isFinite(startedAtMs)) return '';++ const totalSeconds = Math.max(0, Math.floor((nowMs - startedAtMs) / 1000));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const seconds = totalSeconds % 60;++ if (hours > 0) return `${hours}h ${minutes}m`;+ return `${minutes}:${seconds.toString().padStart(2, '0')}`;+}++export function SidebarActiveCallWidget(props: { sidebarState: SidebarState }) {+ const channelsCtx = useChannelsContext();+ const callCtx = useCallContextOptional();+ const userId = useUserId();+ const [nowMs, setNowMs] = createSignal(Date.now());+ const durationTimer = globalThis.setInterval(+ () => setNowMs(Date.now()),+ 1000+ );+ onCleanup(() => globalThis.clearInterval(durationTimer));++ const activeCallsQuery = useActiveCallsForChannelsQuery(() =>+ channelsCtx.channels().map((channel) => channel.id)+ );++ const activeCalls = createMemo(() => {+ const channelsById = channelsCtx.channelsById();+ const joinedChannelId = callCtx?.isInCall()+ ? callCtx.activeChannelId()+ : null;+ const joinedCallId = callCtx?.isInCall() ? callCtx.activeCallId() : null;++ return (+ activeCallsQuery.data?.filter((call) => {+ if (!channelsById[call.channelId]) return false;+ return (+ call.channelId !== joinedChannelId && call.callId !== joinedCallId+ );+ }) ?? []+ );+ });++ const activeCallChannels = createMemo(() =>+ activeCalls().map((call) => ({+ channelId: call.channelId,+ channel: channelsCtx.channelsById()[call.channelId],+ }))+ );++ const channelLetters = createMemo(() =>+ computeChannelLetters(activeCallChannels(), userId())+ );++ const isSlim = () => props.sidebarState === 'slim';+ const slimVisible = () => activeCalls().slice(0, SLIM_MAX);+ const slimOverflow = () => Math.max(0, activeCalls().length - SLIM_MAX);++ return (+ <Show when={activeCalls().length > 0}>+ <Show+ when={!isSlim()}+ fallback={+ <section class="w-full p-2 flex flex-col items-center">+ <For each={slimVisible()}>+ {(call) => {+ const channel = () =>+ channelsCtx.channelsById()[call.channelId];+ const duration = () => formatDuration(call.createdAt, nowMs());+ const label = () => {+ const time = duration();+ return time+ ? `${displayName(channel())} call - ${time}`+ : `${displayName(channel())} call`;+ };+ return (+ <Tooltip label={label()} placement="right">+ <Button+ class="relative flex items-center cursor-default rounded-md text-ink-extra-muted not-disabled:hover:bg-ink/3 justify-center size-8"+ draggable={false}+ variant="ghost"+ size="sm"+ onMouseDown={(e) => {+ if (e.button !== 0) return;+ e.preventDefault();+ void openChannelCallTab(call.channelId);+ }}+ >+ <ChannelCallBadge+ channel={channel()}+ letters={channelLetters().get(call.channelId) ?? '?'}+ slim+ />+ </Button>+ </Tooltip>+ );+ }}+ </For>+ <Show when={slimOverflow() > 0}>+ <span class="text-xxs text-ink-muted mt-1">+ +{slimOverflow()}+ </span>+ </Show>+ </section>+ }+ >+ <section class="size-full flex flex-col justify-center px-2 py-1.5">+ <header class="text-xs font-medium text-ink-muted ml-2 mb-1 whitespace-nowrap">+ <h1>Active calls</h1>+ </header>++ <div class="flex-1">+ <For each={activeCalls()}>+ {(call) => {+ const channel = () =>+ channelsCtx.channelsById()[call.channelId];+ const duration = () => formatDuration(call.createdAt, nowMs());+ const label = () => {+ const time = duration();+ return time+ ? `${displayName(channel())} call - ${time}`+ : `${displayName(channel())} call`;+ };+ return (+ <Button+ class={cn(+ 'flex items-center cursor-default rounded-md text-ink-extra-muted not-disabled:hover:bg-ink/3',+ 'justify-start gap-2 w-full h-8 py-1'+ )}+ draggable={false}+ variant="ghost"+ size="sm"+ title={label()}+ onMouseDown={(e) => {+ if (e.button !== 0) return;+ e.preventDefault();+ void openChannelCallTab(call.channelId);+ }}+ >+ <ChannelCallBadge+ channel={channel()}+ letters={channelLetters().get(call.channelId) ?? '?'}+ slim={false}+ />+ <span class="text-sm font-medium truncate">+ {displayName(channel())}+ </span>+ <span class="shrink-0 size-5 flex items-center justify-center text-xs font-medium bg-success/15 text-success rounded-md ml-auto">+ <PhoneIcon class="size-3" />+ </span>+ </Button>+ );+ }}+ </For>+ </div>+ </section>+ </Show>+ </Show>+ );+}diff --git a/js/app/packages/app/component/app-sidebar/sidebar.tsx b/js/app/packages/app/component/app-sidebar/sidebar.tsxindex 82bf9c5bad..eacc5ed9b3 100644--- a/js/app/packages/app/component/app-sidebar/sidebar.tsx+++ b/js/app/packages/app/component/app-sidebar/sidebar.tsx@@ -1,4 +1,5 @@import { useAnalytics } from '@app/component/analytics-context';+import { SidebarActiveCallWidget } from '@app/component/app-sidebar/active-call-widget';import { ChannelsUnreadWidget } from '@app/component/app-sidebar/channels-unread-widget';import {InviteModal,@@ -998,13 +999,23 @@ export const AppSidebar = (props: AppSidebarProps) => {<ChannelsUnreadWidget sidebarState={props.sidebarState ?? 'expanded'} /></div>- <Show when={callCtx?.isInCall()}>- <div class="px-2 mb-2 mt-auto" data-ui="in-call-panel">- <InCallPanel isSlim={panelIsSlim} />- </div>- </Show>+ <div class="mt-auto">+ <Show when={ENABLE_CALLS()}>+ <div class="block max-h-[clamp(10%,60%,20rem)]">+ <SidebarActiveCallWidget+ sidebarState={props.sidebarState ?? 'expanded'}+ />+ </div>+ </Show>++ <Show when={callCtx?.isInCall()}>+ <div class="px-2 mb-2" data-ui="in-call-panel">+ <InCallPanel isSlim={panelIsSlim} />+ </div>+ </Show>+ </div>- <div class={cn('px-2 w-full', !callCtx?.isInCall() && 'mt-auto')}>+ <div class="px-2 w-full"><hr class="border-transparent mb-2" /></div>diff --git a/js/app/packages/app/component/next-soup/soup-view/NewCallButton.tsx b/js/app/packages/app/component/next-soup/soup-view/NewCallButton.tsxindex 49b9a85539..bba7c15325 100644--- a/js/app/packages/app/component/next-soup/soup-view/NewCallButton.tsx+++ b/js/app/packages/app/component/next-soup/soup-view/NewCallButton.tsx@@ -5,7 +5,7 @@ import { useCombinedRecipients } from '@core/signal/useCombinedRecipient';import type { WithCustomUserInput } from '@core/user';import { getDestinationFromOptions } from '@core/util/destination';import PhoneCallIcon from '@icon/wide-call.svg';-import PlusCircleIcon from '@phosphor/plus.svg';+import PlusCircleIcon from '@phosphor/plus-circle.svg';import XIcon from '@phosphor/x.svg';import {useGetOrCreateDirectMessageMutation,diff --git a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsxindex 2edfef7015..c2d242079d 100644--- a/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx+++ b/js/app/packages/block-channel/component/NewChannelBlockAdapter.tsx@@ -39,6 +39,7 @@ import { ENABLE_CALLS } from '@core/constant/featureFlags';import { useChannelName, useChannelType } from '@core/context/channels';import { createMethodRegistration } from '@core/orchestrator';import { blockHandleSignal } from '@core/signal/load';+import { useActiveCallQuery } from '@queries/call/call';import { useChannelParticipantsQuery } from '@queries/channel/channel-participants';import { ChannelTypeEnum } from '@service-storage/client';import { useSearchParams } from '@solidjs/router';@@ -70,7 +71,7 @@ type ChannelPropsTargetMessage = Pick<function CallTabLabel() {return (<span class="flex items-center gap-1.5">- <span class="size-1.5 rounded-full bg-accent animate-pulse" />+ <span class="size-1.5 rounded-full bg-success animate-pulse" />Call</span>);@@ -82,6 +83,7 @@ function NewTop(props: { channelId: string }) {const channelType = useChannelType(props.channelId);const participantsQuery = useChannelParticipantsQuery(() => props.channelId);const call = useCall(() => props.channelId);+ const activeCallQuery = useActiveCallQuery(() => props.channelId);const participants = () =>participantsQuery.isLoading ? [] : participantsQuery.data;// Show the Call tab whenever we're actually in the call, mid-join, or@@ -89,7 +91,10 @@ function NewTop(props: { channelId: string }) {// `activeTab` to `call` before the join request resolves).const showCallTab = () =>ENABLE_CALLS() &&- (call.isInThisChannel() || call.isJoining() || activeTab() === 'call');+ (call.isInThisChannel() ||+ call.isJoining() ||+ activeTab() === 'call' ||+ !!activeCallQuery.data);const tabs = () => {let filtered = [...CHANNEL_TABS];if (channelType() === ChannelTypeEnum.DirectMessage)diff --git a/js/app/packages/channel/Call/CallStartedNotifier.tsx b/js/app/packages/channel/Call/CallStartedNotifier.tsxindex 96dfa109df..f681bb7eb7 100644--- a/js/app/packages/channel/Call/CallStartedNotifier.tsx+++ b/js/app/packages/channel/Call/CallStartedNotifier.tsx@@ -3,6 +3,11 @@ import { useChannelsContext } from '@core/context/channels';import { useUserId } from '@core/context/user';import { usePlatformNotificationState } from '@notifications';import { DefaultUserNameResolver } from '@notifications/notification-resolvers';+import {+ invalidateActiveCallQueries,+ setActiveCallEndedCache,+ setActiveCallStartedCache,+} from '@queries/call/call';import { createConnectionWebsocketEffect } from '@service-connection/websocket';import { useCallContext } from './CallContext';import { joinChannelCall } from './join-channel-call';@@ -13,6 +18,11 @@ type CallStartedPayload = {created_by?: string | null;};+type CallEndedPayload = {+ channel_id?: string;+ call_id?: string;+};+const RING_VOLUME = 0.15;const RING_PULSE_DURATION_S = 0.4;const RING_PULSE_GAP_S = 0.2;@@ -125,12 +135,23 @@ export function CallStartedNotifier() {const notif = usePlatformNotificationState();createConnectionWebsocketEffect((data) => {- if (data.type !== 'call_started') return;if (!ENABLE_CALLS()) return;const payload = parsePayload(data.data);if (!payload) return;+ if (data.type === 'call_ended') {+ const { channel_id: channelId, call_id: callId } =+ payload as CallEndedPayload;+ if (!channelId || !callId) return;++ setActiveCallEndedCache({ channelId, callId });+ void invalidateActiveCallQueries();+ return;+ }++ if (data.type !== 'call_started') return;+const {channel_id: channelId,call_id: callId,@@ -138,6 +159,14 @@ export function CallStartedNotifier() {} = payload;if (!channelId || !callId) return;+ setActiveCallStartedCache({+ channelId,+ callId,+ createdAt: new Date().toISOString(),+ createdBy: createdBy ?? '',+ });+ void invalidateActiveCallQueries();+if (callCtx.activeCallId() === callId) return;if (createdBy && createdBy === userId()) return;diff --git a/js/app/packages/channel/Call/ChannelCallButton.tsx b/js/app/packages/channel/Call/ChannelCallButton.tsxindex 1eaad00d49..375afa8293 100644--- a/js/app/packages/channel/Call/ChannelCallButton.tsx+++ b/js/app/packages/channel/Call/ChannelCallButton.tsx@@ -33,14 +33,10 @@ export function ChannelCallButton(props: { channelId: string }) {<ButtononClick={handleClick}tooltip={tooltip()}- variant="base"+ variant={isCallInProgress() ? 'success' : 'base'}size="sm"depth={2}- class={cn(- 'bg-surface',- isCallInProgress() &&- 'bg-accent/20 hover:bg-accent/30 text-accent border-accent/30'- )}+ class={cn(!isCallInProgress() && 'bg-surface')}><PhoneIcon /><span>{label()}</span>diff --git a/js/app/packages/channel/Call/ChannelCallTab.tsx b/js/app/packages/channel/Call/ChannelCallTab.tsxindex 65a0129357..b07f1ae9a9 100644--- a/js/app/packages/channel/Call/ChannelCallTab.tsx+++ b/js/app/packages/channel/Call/ChannelCallTab.tsx@@ -1,9 +1,93 @@import { useChannelTab } from '@channel/Channel/ChannelTabContext';import { DEFAULT_CHANNEL_TAB } from '@channel/Channel/channel-tabs';-import { type Accessor, Match, Show, Switch } from 'solid-js';+import { UserGroup } from '@core/component/UserGroup';+import { tryMacroId, useDisplayNameParts } from '@core/user';+import PhoneIcon from '@icon/wide-call.svg';+import { useActiveCallQuery, useCallRecordQuery } from '@queries/call/call';+import { Button } from '@ui';+import { type Accessor, createMemo, Match, Show, Switch } from 'solid-js';import { CallOverlay } from './CallOverlay';import { useCall } from './use-call';+function ParticipantFirstName(props: { id: string }) {+ const nameParts = useDisplayNameParts(tryMacroId(props.id));+ const name = createMemo(+ () => nameParts.firstName() || nameParts.fullName() || 'Someone'+ );++ return <>{name()}</>;+}++function ParticipantNamesLine(props: { ids: string[] }) {+ const count = () => props.ids.length;+ const remaining = () => Math.max(0, count() - 2);++ return (+ <Show when={count() > 0}>+ <p class="max-w-sm text-sm text-ink-muted">+ <Show when={count() === 1}>+ <ParticipantFirstName id={props.ids[0]} /> is in this call.+ </Show>+ <Show when={count() === 2}>+ <ParticipantFirstName id={props.ids[0]} /> and{' '}+ <ParticipantFirstName id={props.ids[1]} /> are in this call.+ </Show>+ <Show when={count() > 2}>+ <ParticipantFirstName id={props.ids[0]} />,{' '}+ <ParticipantFirstName id={props.ids[1]} />, and {remaining()} other+ {remaining() === 1 ? '' : 's'} are in this call.+ </Show>+ </p>+ </Show>+ );+}++function JoinCallEmptyState(props: {+ channelId: string;+ isJoining: boolean;+ onJoin: () => void;+}) {+ const activeCallQuery = useActiveCallQuery(() => props.channelId);+ const callRecordQuery = useCallRecordQuery(+ () => activeCallQuery.data?.callId ?? ''+ );+ const participantIds = createMemo(+ () =>+ callRecordQuery.data?.participants+ .filter((participant) => !participant.leftAt)+ .map((participant) => participant.userId) ?? []+ );++ return (+ <div class="flex size-full flex-col items-center justify-center gap-5 px-6 text-center text-ink">+ <div class="flex flex-col items-center gap-3">+ <UserGroup+ userIds={participantIds()}+ maxUsers={5}+ size="lg"+ suppressClick+ showTooltip+ />+ <div class="flex flex-col items-center gap-1">+ <h2 class="text-lg font-semibold">Call in progress</h2>+ <ParticipantNamesLine ids={participantIds()} />+ </div>+ </div>++ <Button+ variant="cta"+ size="lg"+ class="rounded-lg px-5"+ onClick={props.onJoin}+ disabled={props.isJoining}+ >+ <PhoneIcon class="size-5" />+ {props.isJoining ? 'Connecting...' : 'Join call'}+ </Button>+ </div>+ );+}+export function ChannelCallTab(props: {channelId: string;/**@@ -35,17 +119,11 @@ export function ChannelCallTab(props: {return (<Switchfallback={- <div class="flex size-full flex-col items-center justify-center gap-3 text-ink-muted px-4">- <p class="text-center text-sm">You’re not in this call yet.</p>- <button- type="button"- onClick={() => void call.joinCall()}- disabled={call.isJoining()}- class="rounded-lg bg-surface-2 px-4 py-2 text-sm text-ink hover:bg-surface-3 transition-colors disabled:opacity-50 disabled:pointer-events-none"- >- {call.isJoining() ? 'Connecting…' : 'Join call'}- </button>- </div>+ <JoinCallEmptyState+ channelId={props.channelId}+ isJoining={call.isJoining()}+ onJoin={() => void call.joinCall()}+ />}><Match when={call.isInThisChannel() && !call.joinError()}>diff --git a/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx b/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsxindex f345f7e66e..5b3c5dfd2a 100644--- a/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx+++ b/js/app/packages/channel/Call/InCallPanel/InCallPanelView.tsx@@ -1,8 +1,16 @@import { StackedAvatarsRow } from '@core/component/StackedAvatarsRow';+import { useChannelsContext } from '@core/context/channels';import PhoneDisconnect from '@icon/wide-call-disconnect.svg';import ArrowsOut from '@phosphor/arrows-out.svg';-import { cn, Surface } from '@ui';-import { type Component, createMemo, Show } from 'solid-js';+import { useActiveCallQuery } from '@queries/call/call';+import { Avatar, cn, Surface, Tooltip } from '@ui';+import {+ type Component,+ createMemo,+ createSignal,+ onCleanup,+ Show,+} from 'solid-js';import type { CallControlsVariant } from '../CallControls/CallControls';import { CallControls } from '../CallControls/CallControls';import type { InCallPanelProps } from '../InCallPanel/types';@@ -20,12 +28,33 @@ import {import { profilePictureIdForMember } from './profile-picture-id-for-member';import { useInCallPanel } from './use-in-call-panel';+function formatDuration(startedAt: string | undefined, nowMs: number) {+ const startedAtMs = startedAt ? new Date(startedAt).getTime() : Number.NaN;+ if (!Number.isFinite(startedAtMs)) return '';++ const totalSeconds = Math.max(0, Math.floor((nowMs - startedAtMs) / 1000));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const seconds = totalSeconds % 60;++ if (hours > 0) return `${hours}h ${minutes}m`;+ return `${minutes}:${seconds.toString().padStart(2, '0')}`;+}+export const InCallPanel: Component<InCallPanelProps> = (props) => {const panel = useInCallPanel({channelId: props.channelId,onLeaveCall: props.onLeaveCall,onJoinCall: props.onJoinCall,});+ const channelsCtx = useChannelsContext();+ const [nowMs, setNowMs] = createSignal(Date.now());+ const durationTimer = globalThis.setInterval(+ () => setNowMs(Date.now()),+ 1000+ );+ onCleanup(() => globalThis.clearInterval(durationTimer));+const slim = createMemo((): boolean => {const v = props.isSlim;return typeof v === 'function' ? v() : v;@@ -76,6 +105,32 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {);const showExpandToFullCall = createMemo(() => !onCallPage());+ const activeChannelId = createMemo(() => panel.callCtx.activeChannelId());+ const activeCallQuery = useActiveCallQuery(() => activeChannelId() ?? '');+ const activeChannelName = createMemo(() => {+ const id = activeChannelId();+ if (!id) return 'In call';+ const channel = channelsCtx.channelsById()[id];+ return channel?.name ? `#${channel.name}` : 'In call';+ });+ const activeChannelLetter = createMemo(() => {+ const id = activeChannelId();+ if (!id) return '?';+ const name = channelsCtx.channelsById()[id]?.name ?? '';+ return name[0]?.toUpperCase() ?? '?';+ });+ const memberCount = createMemo(() => orderedMembers().length);+ const callDuration = createMemo(() =>+ formatDuration(activeCallQuery.data?.createdAt, nowMs())+ );+ const slimHeaderTooltip = createMemo(() => {+ const duration = callDuration();+ const count = memberCount();+ const participants = `${count} participant${count === 1 ? '' : 's'}`;+ return [activeChannelName(), duration, participants]+ .filter(Boolean)+ .join(' - ');+ });return (<Show when={() => panel.isActive()}>@@ -94,11 +149,35 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {)}><div class="flex min-w-0 shrink-0 items-center gap-2">- <Show when={showHeaderPulse()}>- <span class="size-1.5 shrink-0 rounded-full bg-accent animate-pulse" />- </Show>- <Show when={!slim()}>- <span class="text-xs font-medium text-ink truncate">In call</span>+ <Show+ when={!slim()}+ fallback={+ <Tooltip label={slimHeaderTooltip()} placement="right">+ <button+ type="button"+ class="relative flex items-center justify-center shrink-0 size-5 rounded-full"+ aria-label={slimHeaderTooltip()}+ onClick={() => {+ const id = panel.callCtx.activeChannelId();+ if (id) void openChannelCallTab(id);+ }}+ >+ <Avatar size="sm" class="bg-transparent text-ink-muted">+ <Avatar.Fallback class="font-semibold">+ {activeChannelLetter()}+ </Avatar.Fallback>+ </Avatar>+ <span class="absolute -top-0.5 -right-0.5 size-1.5 bg-success rounded-full ring-surface ring-2 animate-pulse" />+ </button>+ </Tooltip>+ }+ >+ <Show when={showHeaderPulse()}>+ <span class="size-1.5 shrink-0 rounded-full bg-success animate-pulse" />+ </Show>+ <span class="text-xs font-medium text-ink truncate">+ {activeChannelName()}+ </span></Show></div>@@ -127,7 +206,7 @@ export const InCallPanel: Component<InCallPanelProps> = (props) => {<divclass={cn('px-3 py-2.5',- slim() && 'flex flex-col items-center gap-2 pt-2 pb-1'+ slim() && 'flex flex-col items-center gap-2 py-1')}><divdiff --git a/js/app/packages/channel/Call/use-call.ts b/js/app/packages/channel/Call/use-call.tsindex aac10ed609..5e38032a68 100644--- a/js/app/packages/channel/Call/use-call.ts+++ b/js/app/packages/channel/Call/use-call.ts@@ -1,6 +1,8 @@import { throwOnErr } from '@core/util/result';-import { useLeaveCallMutation } from '@queries/call/call';-import { queryClient } from '@queries/client';+import {+ invalidateActiveCallQueries,+ useLeaveCallMutation,+} from '@queries/call/call';import { callServiceClient } from '@service-call/client';import { useMutation } from '@tanstack/solid-query';import { DisconnectReason, RoomEvent } from 'livekit-client';@@ -181,7 +183,7 @@ export function useCall(channelId: () => string, options?: UseCallOptions) {onSuccess: () => {autoRejoinAttempts = 0;clearAutoRejoinTimer();- void queryClient.invalidateQueries({ queryKey: ['call', 'active'] });+ void invalidateActiveCallQueries();attachDisconnectListener();},// Keep this handler synchronous: we undo the optimistic join and show thediff --git a/js/app/packages/channel/Channel/ActiveCallMessage.tsx b/js/app/packages/channel/Channel/ActiveCallMessage.tsxnew file mode 100644index 0000000000..0380d0274e--- /dev/null+++ b/js/app/packages/channel/Channel/ActiveCallMessage.tsx@@ -0,0 +1,91 @@+import { joinChannelCall, useCallContextOptional } from '@channel/Call';+import PhoneIcon from '@icon/wide-call.svg';+import { useActiveCallQuery } from '@queries/call/call';+import { Button } from '@ui';+import { createMemo, createSignal, onCleanup, Show } from 'solid-js';++function formatDuration(startedAt: string | undefined, nowMs: number) {+ const startedAtMs = startedAt ? new Date(startedAt).getTime() : Number.NaN;+ if (!Number.isFinite(startedAtMs)) return '';++ const totalSeconds = Math.max(0, Math.floor((nowMs - startedAtMs) / 1000));+ const hours = Math.floor(totalSeconds / 3600);+ const minutes = Math.floor((totalSeconds % 3600) / 60);+ const seconds = totalSeconds % 60;++ if (hours > 0) return `${hours}h ${minutes}m`;+ return `${minutes}:${seconds.toString().padStart(2, '0')}`;+}++export function ActiveCallMessage(props: { channelId: string }) {+ const activeCallQuery = useActiveCallQuery(() => props.channelId);+ const callCtx = useCallContextOptional();+ const [nowMs, setNowMs] = createSignal(Date.now());+ const durationTimer = globalThis.setInterval(+ () => setNowMs(Date.now()),+ 1000+ );+ onCleanup(() => globalThis.clearInterval(durationTimer));++ const shouldShow = () =>+ !!activeCallQuery.data &&+ (!callCtx?.isInCall() || callCtx.activeChannelId() !== props.channelId);+ const duration = createMemo(() =>+ formatDuration(activeCallQuery.data?.createdAt, nowMs())+ );++ return (+ <Show when={shouldShow()}>+ <div class="w-full flex justify-center">+ <div class="macro-message-width w-full relative">+ <div class="w-full pr-2 pl-(--message-padding-x)">+ <div+ class="grid min-w-0 items-start gap-x-2 py-2"+ style={{+ 'grid-template-columns':+ 'var(--user-icon-width) minmax(0, 1fr)',+ 'grid-template-areas': '"icon content"',+ }}+ >+ <div+ class="shrink-0 size-(--user-icon-width) rounded-full bg-success/15 text-success flex items-center justify-center"+ style={{ 'grid-area': 'icon' }}+ >+ <PhoneIcon class="size-5" />+ </div>+ <div+ class="min-w-0 rounded-md border border-edge-muted bg-surface px-3 py-2 text-sm text-ink"+ style={{ 'grid-area': 'content' }}+ >+ <div class="flex min-w-0 items-center gap-2">+ <div class="min-w-0 flex-1">+ <div class="font-medium">+ A call is active in this channel+ </div>+ <Show when={duration()}>+ {(value) => (+ <div class="text-xs text-ink-extra-muted">+ Active for{' '}+ <span class="font-mono tabular-nums">{value()}</span>+ </div>+ )}+ </Show>+ </div>+ <Button+ variant="success"+ size="sm"+ class="shrink-0"+ onClick={() => void joinChannelCall(props.channelId)}+ >+ <PhoneIcon class="size-3.5" />+ Join+ </Button>+ </div>+ </div>+ </div>+ </div>+ </div>+ </div>+ </Show>+ );+}diff --git a/js/app/packages/channel/Channel/Channel.tsx b/js/app/packages/channel/Channel/Channel.tsxindex f94fe003ed..dccd5bb2d7 100644--- a/js/app/packages/channel/Channel/Channel.tsx+++ b/js/app/packages/channel/Channel/Channel.tsx@@ -65,6 +65,7 @@ import { ChannelInputContainer } from '../Input/ChannelInputContainer';import { hasSendableInputContent } from '../Input/utils/sendable-content';import { ChannelThread } from '../Thread';import { buildQuoteReplyValue } from '../Thread/utils/message-actions';+import { ActiveCallMessage } from './ActiveCallMessage';import { ChannelDropZone } from './ChannelDropZone';import { createChannelDragState } from './create-channel-drag-state';import { createChannelFindBar } from './create-channel-find-bar';@@ -532,6 +533,7 @@ export function Channel(props: ChannelProps) {</Show></div></Show>+ <ActiveCallMessage channelId={props.channelId} /></div><DebugSuspense name="Channel.input"><ChannelInputContainerdiff --git a/js/app/packages/macro-entity/src/queries/dss.ts b/js/app/packages/macro-entity/src/queries/dss.tsindex 30ae29df71..8d6944a3ea 100644--- a/js/app/packages/macro-entity/src/queries/dss.ts+++ b/js/app/packages/macro-entity/src/queries/dss.ts@@ -7,6 +7,7 @@ import { toast } from '@core/component/Toast/Toast';import { throwOnErr } from '@core/util/result';import type { EntityData } from '@entity';import { scheduledActionKeys } from '@queries/agent-schedule/keys';+import { callKeys } from '@queries/call/keys';import { queryClient } from '@queries/client';import {getSoupEntityById,@@ -51,7 +52,7 @@ export function createBulkDeleteDssItemsMutation() {}));if (deletable.some((e) => e.type === 'call')) {- queryClient.invalidateQueries({ queryKey: ['call'] });+ queryClient.invalidateQueries({ queryKey: callKeys._def });}if (deletable.some((e) => e.type === 'automation')) {const deletedIds = new Set(diff --git a/js/app/packages/macro-entity/src/queries/rename.ts b/js/app/packages/macro-entity/src/queries/rename.tsindex a8d214395c..f70cbc07fa 100644--- a/js/app/packages/macro-entity/src/queries/rename.ts+++ b/js/app/packages/macro-entity/src/queries/rename.ts@@ -1,6 +1,7 @@import { renameItem } from '@core/component/FileList/itemOperations';import { toast } from '@core/component/Toast/Toast';import type { EntityData } from '@entity';+import { callKeys } from '@queries/call/keys';import { channelKeys } from '@queries/channel/keys';import { queryClient } from '@queries/client';import { setHistoryItemName } from '@queries/history/history';@@ -162,10 +163,13 @@ const renameCallRecordSetData = (): void => {entities.forEach(({ id, newName, itemType }) => {if (itemType !== 'call') return;- queryClient.setQueryData<CallRecord>(['call', 'record', id], (prev) => {- if (!prev) return prev;- return { ...prev, customName: newName };- });+ queryClient.setQueryData<CallRecord>(+ callKeys.record(id).queryKey,+ (prev) => {+ if (!prev) return prev;+ return { ...prev, customName: newName };+ }+ );});};diff --git a/js/app/packages/queries/call/call.ts b/js/app/packages/queries/call/call.tsindex 8817769e8d..47bc269fc7 100644--- a/js/app/packages/queries/call/call.ts+++ b/js/app/packages/queries/call/call.ts@@ -2,25 +2,102 @@ import { toast } from '@core/component/Toast/Toast';import { ThrownResultError, throwOnErr } from '@core/util/result';import { queryClient } from '@queries/client';import { type CallRecord, callServiceClient } from '@service-call/client';+import type { CallActiveResponse } from '@service-storage/generated/schemas/callActiveResponse';import { useMutation, useQuery } from '@tanstack/solid-query';import type { Accessor } from 'solid-js';+import { callKeys } from './keys';export function useActiveCallQuery(channelId: Accessor<string>) {return useQuery(() => ({- queryKey: ['call', 'active', channelId()],+ queryKey: callKeys.active(channelId()).queryKey,queryFn: async () =>await throwOnErr(() => callServiceClient.checkActiveCall(channelId())),refetchInterval: 15_000,}));}+export function useActiveCallsForChannelsQuery(channelIds: Accessor<string[]>) {+ return useQuery(() => {+ const ids = [...new Set(channelIds())].sort();++ return {+ queryKey: callKeys.activeChannels(ids).queryKey,+ queryFn: async (): Promise<CallActiveResponse[]> => {+ const activeCalls = await Promise.all(+ ids.map(async (channelId) =>+ throwOnErr(() => callServiceClient.checkActiveCall(channelId))+ )+ );++ return activeCalls+ .filter((call): call is CallActiveResponse => call !== null)+ .sort(+ (a, b) =>+ new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()+ );+ },+ refetchInterval: 15_000,+ enabled: ids.length > 0,+ };+ });+}++export function setActiveCallStartedCache(call: CallActiveResponse) {+ queryClient.setQueryData<CallActiveResponse | null>(+ callKeys.active(call.channelId).queryKey,+ call+ );++ queryClient.setQueriesData<CallActiveResponse[]>(+ { queryKey: callKeys.activeChannels._def },+ (prev) => {+ if (!prev) return prev;+ const withoutDuplicate = prev.filter(+ (activeCall) =>+ activeCall.callId !== call.callId &&+ activeCall.channelId !== call.channelId+ );+ return [call, ...withoutDuplicate].sort(+ (a, b) =>+ new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()+ );+ }+ );+}++export function setActiveCallEndedCache(params: {+ callId: string;+ channelId: string;+}) {+ queryClient.setQueryData<CallActiveResponse | null>(+ callKeys.active(params.channelId).queryKey,+ null+ );++ queryClient.setQueriesData<CallActiveResponse[]>(+ { queryKey: callKeys.activeChannels._def },+ (prev) =>+ prev?.filter(+ (call) =>+ call.callId !== params.callId && call.channelId !== params.channelId+ )+ );+}++export function invalidateActiveCallQueries() {+ return Promise.all([+ queryClient.invalidateQueries({ queryKey: callKeys.active._def }),+ queryClient.invalidateQueries({ queryKey: callKeys.activeChannels._def }),+ ]);+}+function _useJoinCallMutation() {return useMutation(() => ({gcTime: 0,mutationFn: async (channelId: string) =>await throwOnErr(() => callServiceClient.getOrCreateCall(channelId)),onSuccess() {- queryClient.invalidateQueries({ queryKey: ['call', 'active'] });+ invalidateActiveCallQueries();},onError(error: Error) {if (@@ -60,7 +137,7 @@ export function useLeaveCallMutation() {}},onSuccess() {- queryClient.invalidateQueries({ queryKey: ['call', 'active'] });+ invalidateActiveCallQueries();},onError(error: Error) {console.error('failed to leave call', error);@@ -70,7 +147,7 @@ export function useLeaveCallMutation() {export function useCallRecordQuery(callId: Accessor<string>) {return useQuery(() => ({- queryKey: ['call', 'record', callId()],+ queryKey: callKeys.record(callId()).queryKey,queryFn: async () =>await throwOnErr(() => callServiceClient.getCallRecord(callId())),}));@@ -80,14 +157,17 @@ export function setCallRecordShareWithTeamCache(callId: string,shareWithTeam: boolean) {- queryClient.setQueryData<CallRecord>(['call', 'record', callId], (prev) => {- if (!prev) return prev;- return { ...prev, shareWithTeam };- });+ queryClient.setQueryData<CallRecord>(+ callKeys.record(callId).queryKey,+ (prev) => {+ if (!prev) return prev;+ return { ...prev, shareWithTeam };+ }+ );}function invalidateCallRecord(callId: string) {- queryClient.invalidateQueries({ queryKey: ['call', 'record', callId] });+ queryClient.invalidateQueries({ queryKey: callKeys.record(callId).queryKey });}export function useSetCallRecordShareWithTeamMutation() {diff --git a/js/app/packages/queries/call/keys.ts b/js/app/packages/queries/call/keys.tsnew file mode 100644index 0000000000..5b46e8fec0--- /dev/null+++ b/js/app/packages/queries/call/keys.ts@@ -0,0 +1,26 @@+const root = ['call'] as const;+const active = [...root, 'active'] as const;+const activeChannels = [...active, 'channels'] as const;+const record = [...root, 'record'] as const;++export const callKeys = {+ _def: root,+ active: Object.assign(+ (channelId: string) => ({+ queryKey: [...active, channelId] as const,+ }),+ { _def: active }+ ),+ activeChannels: Object.assign(+ (channelIds: string[]) => ({+ queryKey: [...activeChannels, channelIds] as const,+ }),+ { _def: activeChannels }+ ),+ record: Object.assign(+ (callId: string) => ({+ queryKey: [...record, callId] as const,+ }),+ { _def: record }+ ),+} as const;diff --git a/js/app/packages/ui/components/Avatar.tsx b/js/app/packages/ui/components/Avatar.tsxindex 0e4e77319e..ba07b56df1 100644--- a/js/app/packages/ui/components/Avatar.tsx+++ b/js/app/packages/ui/components/Avatar.tsx@@ -1,5 +1,5 @@+import { type JSX, type ParentProps, splitProps } from 'solid-js';import { cn } from '../utils/classname';-import { type ParentProps, splitProps, type JSX } from 'solid-js';export type AvatarSize = 'sm' | 'md' | 'lg' | 'fill';diff --git a/js/app/packages/ui/components/Button.tsx b/js/app/packages/ui/components/Button.tsxindex f02e24c1c7..5ba5af1a8e 100644--- a/js/app/packages/ui/components/Button.tsx+++ b/js/app/packages/ui/components/Button.tsx@@ -1,47 +1,63 @@-import { Button as KobalteButton, type ButtonRootProps } from '@kobalte/core/button';-import { type ComponentProps, type JSX, Show, splitProps } from 'solid-js';-import { Tooltip } from './Tooltip';import type { HotkeyToken } from '@core/hotkey/tokens';import type { Placement } from '@floating-ui/dom';-import { cn } from '../utils/classname';+import {+ type ButtonRootProps,+ Button as KobalteButton,+} from '@kobalte/core/button';import { themeReactive } from '@theme/signals/themeReactive';+import { type ComponentProps, type JSX, Show, splitProps } from 'solid-js';+import { cn } from '../utils/classname';import { useButtonGroupContext } from './ButtonGroup';import { Layer } from './Layer';+import { Tooltip } from './Tooltip';-export type ButtonProps = ButtonRootProps<'button'> & ComponentProps<'button'> & {- depth?: 0 | 1 | 2 | 3 | 4 | 5;- tooltipPlacement?: Placement;- noTouchResize?: boolean;- variant?: ButtonVariant;- children?: JSX.Element;- tooltip?: string;- label?: string;- hotkey?: HotkeyToken | HotkeyToken[];- /**- * Raw shortcut string(s) shown in the tooltip when no `hotkey` token is available.- */- shortcut?: string | string[];- size?: ButtonSize;- class?: string;-};+export type ButtonProps = ButtonRootProps<'button'> &+ ComponentProps<'button'> & {+ depth?: 0 | 1 | 2 | 3 | 4 | 5;+ tooltipPlacement?: Placement;+ noTouchResize?: boolean;+ variant?: ButtonVariant;+ children?: JSX.Element;+ tooltip?: string;+ label?: string;+ hotkey?: HotkeyToken | HotkeyToken[];+ /**+ * Raw shortcut string(s) shown in the tooltip when no `hotkey` token is available.+ */+ shortcut?: string | string[];+ size?: ButtonSize;+ class?: string;+ };export type ButtonSize = 'sm' | 'icon-sm' | 'md' | 'icon-md' | 'lg' | 'icon-lg';-export type ButtonVariant = 'ghost' | 'base' | 'active' | 'danger' | 'cta';+export type ButtonVariant =+ | 'ghost'+ | 'base'+ | 'active'+ | 'success'+ | 'danger'+ | 'cta';const variantStyles: Record<ButtonVariant, string> = {- danger: 'bg-transparent text-failure border border-failure/50 not-disabled:hover:bg-failure/10 not-disabled:active:bg-failure/20 disabled:opacity-30 ',- base: 'bg-transparent text-ink-muted border border-edge-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',- active: 'bg-accent-bg text-accent disabled:opacity-30 ',- ghost: 'bg-transparent text-ink-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',- 'cta': 'bg-accent text-surface border border-transparent not-disabled:hover:bg-accent/90 active:bg-accent/80 disabled:opacity-30 focus-visible:bg-accent/90',+ danger:+ 'bg-transparent text-failure border border-failure/50 not-disabled:hover:bg-failure/10 not-disabled:active:bg-failure/20 disabled:opacity-30 ',+ base: 'bg-transparent text-ink-muted border border-edge-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',+ active:+ 'bg-accent-bg not-disabled:hover:bg-accent/30 text-accent disabled:opacity-30 ',+ success:+ 'bg-success-bg not-disabled:hover:bg-success/30 text-success disabled:opacity-30 ',+ ghost:+ 'bg-transparent text-ink-muted not-disabled:hover:bg-hover not-disabled:hover:text-ink active:bg-active disabled:opacity-30 ',+ cta: 'bg-accent text-surface border border-transparent not-disabled:hover:bg-accent/90 active:bg-accent/80 disabled:opacity-30 focus-visible:bg-accent/90',};const sizeStyles: Record<ButtonSize, string> = {- 'lg': ' p-2.5 [&_:where(svg)]:size-5 gap-2 text-base',- 'md': ' p-2 gap-1.5 text-sm ', /* scuffed */- 'sm': 'h-6 px-2 [&_:where(svg)]:size-4 gap-1 text-xs ',- 'icon-lg': 'size-11 p-2 [&_:where(svg)]:size-7 ', /* unused */+ lg: ' p-2.5 [&_:where(svg)]:size-5 gap-2 text-base',+ md: ' p-2 gap-1.5 text-sm ' /* scuffed */,+ sm: 'h-6 px-2 [&_:where(svg)]:size-4 gap-1 text-xs ',+ 'icon-lg':+ 'size-11 p-2 [&_:where(svg)]:size-7 ' /* unused */,'icon-md': 'size-9 p-1.5 [&_:where(svg)]:size-6 ','icon-sm': 'size-6 p-0.5 [&_:where(svg)]:size-5 ',};@@ -65,7 +81,10 @@ export const Button = (props: ButtonProps) => {const cls = () =>cn('relative inline-flex items-center justify-center font-medium leading-none border border-transparent rounded-sm whitespace-nowrap',- { 'touch:min-h-9 touch:min-w-9 touch:[&_svg]:size-6': !(props.noTouchResize) },+ {+ 'touch:min-h-9 touch:min-w-9 touch:[&_svg]:size-6':+ !props.noTouchResize,+ },'outline-none focus-visible:bg-active','data-disabled:cursor-not-allowed',variantStyles[local.variant ?? group?.variant ?? 'ghost'],@@ -81,7 +100,7 @@ export const Button = (props: ButtonProps) => {// TODO (seamus): this is scuffed but better than what we had.const textL = themeReactive.a0.l[0]() < 0.72 ? 0.97 : 0.2;return {- 'color': `oklch(${textL} var(--c0c) var(--c0h))`,+ color: `oklch(${textL} var(--c0c) var(--c0h))`,'--color-edge': `oklch(${textL} var(--c0c) var(--c0h) / 0.7)`,'--color-edge-muted': `oklch(${textL} var(--c0c) var(--c0h) / 0.7)`,};@@ -102,7 +121,10 @@ export const Button = (props: ButtonProps) => {const skipLayer = () => group !== undefined && local.depth === undefined;const content = () => (- <Show when={tooltipLabel() !== undefined ? tooltipLabel() : false} fallback={button()}>+ <Show+ when={tooltipLabel() !== undefined ? tooltipLabel() : false}+ fallback={button()}+ >{(label) => (<Tooltiphotkey={local.hotkey}@@ -117,7 +139,10 @@ export const Button = (props: ButtonProps) => {);return (- <Show when={skipLayer()} fallback={<Layer depth={local.depth ?? 0}>{content()}</Layer>}>+ <Show+ when={skipLayer()}+ fallback={<Layer depth={local.depth ?? 0}>{content()}</Layer>}+ >{content()}</Show>);diff --git a/js/app/packages/ui/components/ButtonGroup.tsx b/js/app/packages/ui/components/ButtonGroup.tsxindex 0227020688..3fae89e111 100644--- a/js/app/packages/ui/components/ButtonGroup.tsx+++ b/js/app/packages/ui/components/ButtonGroup.tsx@@ -1,6 +1,6 @@-import { type JSX, createContext, useContext } from 'solid-js';-import type { ButtonSize, ButtonVariant } from './Button';+import { createContext, type JSX, useContext } from 'solid-js';import { cn } from '../utils/classname';+import type { ButtonSize, ButtonVariant } from './Button';import { Layer } from './Layer';type ButtonGroupOrientation = 'horizontal' | 'vertical';@@ -12,7 +12,9 @@ type ButtonGroupContextValue = {orientation: ButtonGroupOrientation;};-const ButtonGroupContext = createContext<ButtonGroupContextValue | undefined>(undefined);+const ButtonGroupContext = createContext<ButtonGroupContextValue | undefined>(+ undefined+);export const useButtonGroupContext = () => useContext(ButtonGroupContext);@@ -26,36 +28,38 @@ type ButtonGroupProps = {};const groupVariantStyles: Record<ButtonVariant, string> = {- danger: 'border border-failure/50 ',- base: 'border border-edge-muted ',- active: 'border border-accent ',- ghost: ' ',- 'cta': 'border border-transparent ',+ danger: 'border border-failure/50 ',+ base: 'border border-edge-muted ',+ active: 'border border-accent ',+ success: 'border border-success ',+ ghost: ' ',+ cta: 'border border-transparent ',};const dividerVariantStyles: Record<ButtonVariant, string> = {- danger: 'bg-failure/50',- base: 'bg-edge-muted',- active: 'bg-accent',- ghost: 'bg-edge-muted',- 'cta': 'bg-surface/50',+ danger: 'bg-failure/50',+ base: 'bg-edge-muted',+ active: 'bg-accent',+ success: 'bg-success',+ ghost: 'bg-edge-muted',+ cta: 'bg-surface/50',};/* explicit cross-axis size so the group's outer box matches a standaloneButton of the same size (border-box absorbs the 1px outer border) */const groupHorizontalSize: Record<ButtonSize, string> = {- 'lg': '',- 'md': '',- 'sm': 'h-6',+ lg: '',+ md: '',+ sm: 'h-6','icon-lg': 'h-11','icon-md': 'h-9','icon-sm': 'h-6',};const groupVerticalSize: Record<ButtonSize, string> = {- 'lg': '',- 'md': '',- 'sm': '',+ lg: '',+ md: '',+ sm: '','icon-lg': 'w-11','icon-md': 'w-9','icon-sm': 'w-6',@@ -72,35 +76,43 @@ export const ButtonGroup = (props: ButtonGroupProps) => {};const ctx: ButtonGroupContextValue = {- get depth() { return props.depth; },- get variant() { return props.variant; },- get size() { return props.size; },- get orientation() { return orientation(); },- };+ get depth() {+ return props.depth;+ },+ get variant() {+ return props.variant;+ },+ get size() {+ return props.size;+ },+ get orientation() {+ return orientation();+ },+ };return (- <ButtonGroupContext.Provider value={ctx}>- <Layer depth={props.depth ?? 0}>- <div- data-orientation={orientation()}- class={cn(- 'data-[orientation=horizontal]:flex-row items-center',- 'data-[orientation=vertical]:flex-col justify-center',- 'inline-flex overflow-hidden rounded-sm',- /* strip per-button rounding + borders so the group owns the frame */- '**:data-button:rounded-none',- '**:data-button:border-0',- groupVariantStyles[variant()],- sizeClass(),- props.class- )}- role="group"- >- {props.children}- </div>- </Layer>- </ButtonGroupContext.Provider>- );+ <ButtonGroupContext.Provider value={ctx}>+ <Layer depth={props.depth ?? 0}>+ <div+ data-orientation={orientation()}+ class={cn(+ 'data-[orientation=horizontal]:flex-row items-center',+ 'data-[orientation=vertical]:flex-col justify-center',+ 'inline-flex overflow-hidden rounded-sm',+ /* strip per-button rounding + borders so the group owns the frame */+ '**:data-button:rounded-none',+ '**:data-button:border-0',+ groupVariantStyles[variant()],+ sizeClass(),+ props.class+ )}+ role="group"+ >+ {props.children}+ </div>+ </Layer>+ </ButtonGroupContext.Provider>+ );};type DividerProps = { class?: string };diff --git a/js/app/packages/ui/components/ChatInput.tsx b/js/app/packages/ui/components/ChatInput.tsxindex e04bbd188d..16b51c2f6d 100644--- a/js/app/packages/ui/components/ChatInput.tsx+++ b/js/app/packages/ui/components/ChatInput.tsx@@ -1,10 +1,10 @@+import type { JSX } from 'solid-js';import { createContext, Show, splitProps, useContext } from 'solid-js';import { cn } from '../utils/classname';-import type { JSX } from 'solid-js';export type ChatInputRows = 1 | 2 | 3;-type ChatInputContextValue = { rows: () => ChatInputRows; };+type ChatInputContextValue = { rows: () => ChatInputRows };const ChatInputContext = createContext<ChatInputContextValue>();@@ -12,13 +12,16 @@ function useChatInputContext(): ChatInputContextValue {const ctx = useContext(ChatInputContext);if (!ctx) {throw new Error(- 'ChatInput.* components must be used inside <ChatInput.Root>',+ 'ChatInput.* components must be used inside <ChatInput.Root>');}return ctx;}-export type ChatInputProps = Omit<JSX.HTMLAttributes<HTMLDivElement>, 'style'> & {+export type ChatInputProps = Omit<+ JSX.HTMLAttributes<HTMLDivElement>,+ 'style'+> & {style?: JSX.CSSProperties;rows?: ChatInputRows;};diff --git a/js/app/packages/ui/components/Checkbox.tsx b/js/app/packages/ui/components/Checkbox.tsxindex e9b89aa0ab..96cd59fe22 100644--- a/js/app/packages/ui/components/Checkbox.tsx+++ b/js/app/packages/ui/components/Checkbox.tsx@@ -1,9 +1,9 @@import { Checkbox as KobalteCheckbox } from '@kobalte/core/checkbox';-import type { ComponentProps } from 'solid-js';import CheckIcon from '@phosphor/check.svg';import MinusIcon from '@phosphor/minus.svg';-import { cn } from '../utils/classname';+import type { ComponentProps } from 'solid-js';import { splitProps } from 'solid-js';+import { cn } from '../utils/classname';/*<Checkbox checked={...} onChange={...}>@@ -30,7 +30,7 @@ const CONTROL_CLASS = cn('data-checked:bg-accent data-checked:border-accent','data-indeterminate:bg-accent data-indeterminate:border-accent','data-disabled:opacity-50 data-disabled:cursor-not-allowed',- 'data-invalid:border-red-500',+ 'data-invalid:border-red-500');function CheckboxIndicator(props: IndicatorProps) {@@ -73,19 +73,19 @@ export const Checkbox = Object.assign();},{- ErrorMessage: KobalteCheckbox.ErrorMessage, /* passthrough — styled via class at use sites */- Description: KobalteCheckbox.Description, /* passthrough — styled via class at use sites */- Input: KobalteCheckbox.Input, /* passthrough — Control already renders one */+ ErrorMessage:+ KobalteCheckbox.ErrorMessage /* passthrough — styled via class at use sites */,+ Description:+ KobalteCheckbox.Description /* passthrough — styled via class at use sites */,+ Input:+ KobalteCheckbox.Input /* passthrough — Control already renders one */,Indicator: CheckboxIndicator,Control: CheckboxControl,- },+ });export const SingleSelectCheck = (props: { active: boolean }) => (<CheckIcon- class={cn(- 'size-3 text-accent shrink-0',- !props.active && 'hidden'- )}+ class={cn('size-3 text-accent shrink-0', !props.active && 'hidden')}/>);diff --git a/js/app/packages/ui/components/Dialog.tsx b/js/app/packages/ui/components/Dialog.tsxindex 9f44ede664..67fff7aeec 100644--- a/js/app/packages/ui/components/Dialog.tsx+++ b/js/app/packages/ui/components/Dialog.tsx@@ -3,30 +3,36 @@ import type { JSX, Ref } from 'solid-js';import { cn } from '../utils/classname';export type DialogProps = {- onEscapeKeyDown?: (event: KeyboardEvent) => void; /* Forwarded to Kobalte */- onCloseAutoFocus?: (event: Event) => void; /* Forwarded to Kobalte */- onOpenAutoFocus?: (event: Event) => void; /* Forwarded to Kobalte */- onOpenChange?: (open: boolean) => void; /* Forwarded to Kobalte */- contentRef?: Ref<HTMLDivElement>; /* content element ref */- position?: 'top' | 'center'; /* Vertical position */- children: JSX.Element; /* Content children */- class?: string; /* classes for content */- open: boolean; /* if dialog is open */+ onEscapeKeyDown?: (event: KeyboardEvent) => void /* Forwarded to Kobalte */;+ onCloseAutoFocus?: (event: Event) => void /* Forwarded to Kobalte */;+ onOpenAutoFocus?: (event: Event) => void /* Forwarded to Kobalte */;+ onOpenChange?: (open: boolean) => void /* Forwarded to Kobalte */;+ contentRef?: Ref<HTMLDivElement> /* content element ref */;+ position?: 'top' | 'center' /* Vertical position */;+ children: JSX.Element /* Content children */;+ class?: string /* classes for content */;+ open: boolean /* if dialog is open */;};export function Dialog(props: DialogProps) {return (- <KobalteDialog- onOpenChange={props.onOpenChange}- open={props.open}- modal- >+ <KobalteDialog onOpenChange={props.onOpenChange} open={props.open} modal><KobalteDialog.Portal><KobalteDialog.Overlay class="fixed inset-0 z-modal bg-modal-overlay pattern-edge-muted pattern-diagonal-4" />- <div class={cn('fixed inset-0 z-modal flex justify-center px-2', props.position === 'center' ? 'items-center' : 'items-start pt-[10vh]')}>+ <div+ class={cn(+ 'fixed inset-0 z-modal flex justify-center px-2',+ props.position === 'center'+ ? 'items-center'+ : 'items-start pt-[10vh]'+ )}+ ><KobalteDialog.Contentref={props.contentRef}- class={cn('w-200 max-w-[calc(100vw-16px)] overflow-hidden portal-scope isolate', props.class)}+ class={cn(+ 'w-200 max-w-[calc(100vw-16px)] overflow-hidden portal-scope isolate',+ props.class+ )}onCloseAutoFocus={props.onCloseAutoFocus}onEscapeKeyDown={props.onEscapeKeyDown}onOpenAutoFocus={props.onOpenAutoFocus}@@ -41,4 +47,4 @@ export function Dialog(props: DialogProps) {Dialog.CloseButton = KobalteDialog.CloseButton; /* Forwarded to Kobalte */Dialog.Description = KobalteDialog.Description; /* Forwarded to Kobalte */-Dialog.Title = KobalteDialog.Title; /* Forwarded to Kobalte */+Dialog.Title = KobalteDialog.Title; /* Forwarded to Kobalte */diff --git a/js/app/packages/ui/components/Dropdown.tsx b/js/app/packages/ui/components/Dropdown.tsxindex d84f943e23..d2b25db3d0 100644--- a/js/app/packages/ui/components/Dropdown.tsx+++ b/js/app/packages/ui/components/Dropdown.tsx@@ -1,9 +1,9 @@import { DropdownMenu as KobalteDropdownMenu } from '@kobalte/core/dropdown-menu';import CheckIcon from '@phosphor/check.svg';+import { type ComponentProps, splitProps } from 'solid-js';+import { cn } from '../utils/classname';import { Button, type ButtonProps } from './Button';import { Surface, type SurfaceProps } from './Surface';-import { cn } from '../utils/classname';-import { splitProps, type ComponentProps } from 'solid-js';/*<Dropdown>@@ -31,19 +31,47 @@ import { splitProps, type ComponentProps } from 'solid-js';type PortalMount = ComponentProps<typeof KobalteDropdownMenu.Portal>['mount'];type DropdownPortalScope = 'local';-export type DropdownSubContentProps = ComponentProps<typeof KobalteDropdownMenu.SubContent> & { depth?: SurfaceProps['depth']; mount?: PortalMount; portalScope?: DropdownPortalScope; };-export type DropdownContentProps = ComponentProps<typeof KobalteDropdownMenu.Content> & { depth?: SurfaceProps['depth']; mount?: PortalMount; portalScope?: DropdownPortalScope; };-export type DropdownTriggerProps = ComponentProps<typeof KobalteDropdownMenu.Trigger> & ButtonProps;-export type DropdownItemIndicatorProps = ComponentProps<typeof KobalteDropdownMenu.ItemIndicator>;-export type DropdownCheckboxItemProps = ComponentProps<typeof KobalteDropdownMenu.CheckboxItem>;-export type DropdownSubTriggerProps = ComponentProps<typeof KobalteDropdownMenu.SubTrigger>;-export type DropdownRadioItemProps = ComponentProps<typeof KobalteDropdownMenu.RadioItem>;-export type DropdownGroupLabelProps = ComponentProps<typeof KobalteDropdownMenu.GroupLabel>;-export type DropdownGroupProps = ComponentProps<typeof KobalteDropdownMenu.Group>;+export type DropdownSubContentProps = ComponentProps<+ typeof KobalteDropdownMenu.SubContent+> & {+ depth?: SurfaceProps['depth'];+ mount?: PortalMount;+ portalScope?: DropdownPortalScope;+};+export type DropdownContentProps = ComponentProps<+ typeof KobalteDropdownMenu.Content+> & {+ depth?: SurfaceProps['depth'];+ mount?: PortalMount;+ portalScope?: DropdownPortalScope;+};+export type DropdownTriggerProps = ComponentProps<+ typeof KobalteDropdownMenu.Trigger+> &+ ButtonProps;+export type DropdownItemIndicatorProps = ComponentProps<+ typeof KobalteDropdownMenu.ItemIndicator+>;+export type DropdownCheckboxItemProps = ComponentProps<+ typeof KobalteDropdownMenu.CheckboxItem+>;+export type DropdownSubTriggerProps = ComponentProps<+ typeof KobalteDropdownMenu.SubTrigger+>;+export type DropdownRadioItemProps = ComponentProps<+ typeof KobalteDropdownMenu.RadioItem+>;+export type DropdownGroupLabelProps = ComponentProps<+ typeof KobalteDropdownMenu.GroupLabel+>;+export type DropdownGroupProps = ComponentProps<+ typeof KobalteDropdownMenu.Group+>;export type DropdownItemProps = ComponentProps<typeof KobalteDropdownMenu.Item>;export type DropdownSubProps = ComponentProps<typeof KobalteDropdownMenu.Sub>;-const ROW_CLASS = 'group rounded-lg w-full flex items-center gap-2 px-2 h-8 text-left font-medium text-xs cursor-default outline-none hover:bg-ink/5 data-highlighted:bg-ink/5 data-disabled:opacity-50 data-disabled:cursor-not-allowed';+const ROW_CLASS =+ 'group rounded-lg w-full flex items-center gap-2 px-2 h-8 text-left font-medium text-xs cursor-default outline-none hover:bg-ink/5 data-highlighted:bg-ink/5 data-disabled:opacity-50 data-disabled:cursor-not-allowed';function resolvePortalMount(searchRef: HTMLElement | undefined,@@ -56,7 +84,13 @@ function resolvePortalMount(function DropdownContent(props: DropdownContentProps) {let searchRef: HTMLDivElement | undefined;- const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'portalScope', 'children']);+ const [local, rest] = splitProps(props, [+ 'depth',+ 'class',+ 'mount',+ 'portalScope',+ 'children',+ ]);return (<><div class="hidden" ref={searchRef} />@@ -69,7 +103,9 @@ function DropdownContent(props: DropdownContentProps) {as={Surface}{...rest}>- <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>+ <div class="flex flex-col gap-px bg-edge-muted size-full">+ {local.children}+ </div></KobalteDropdownMenu.Content></KobalteDropdownMenu.Portal></>@@ -78,7 +114,13 @@ function DropdownContent(props: DropdownContentProps) {function DropdownSubContent(props: DropdownSubContentProps) {let searchRef: HTMLDivElement | undefined;- const [local, rest] = splitProps(props, ['depth', 'class', 'mount', 'portalScope', 'children']);+ const [local, rest] = splitProps(props, [+ 'depth',+ 'class',+ 'mount',+ 'portalScope',+ 'children',+ ]);return (<><div class="hidden" ref={searchRef} />@@ -91,7 +133,9 @@ function DropdownSubContent(props: DropdownSubContentProps) {as={Surface}{...rest}>- <div class="flex flex-col gap-px bg-edge-muted size-full">{local.children}</div>+ <div class="flex flex-col gap-px bg-edge-muted size-full">+ {local.children}+ </div></KobalteDropdownMenu.SubContent></KobalteDropdownMenu.Portal></>@@ -112,7 +156,10 @@ function DropdownGroupLabel(props: DropdownGroupLabelProps) {const [local, rest] = splitProps(props, ['class']);return (<KobalteDropdownMenu.GroupLabel- class={cn('px-2 h-7 flex items-center text-xs text-ink-extra-muted', local.class)}+ class={cn(+ 'px-2 h-7 flex items-center text-xs text-ink-extra-muted',+ local.class+ )}{...rest}/>);@@ -123,7 +170,7 @@ const CHECKBOX_ITEM_BOX_CLASS = cn('border border-transparent text-surface','group-hover:not-hover:border-edge-muted group-data-highlighted:not-hover:border-edge-muted','hover:border-accent',- 'group-data-checked:bg-accent group-data-checked:border-accent',+ 'group-data-checked:bg-accent group-data-checked:border-accent');function DropdownCheckboxItem(props: DropdownCheckboxItemProps) {@@ -168,13 +215,7 @@ function DropdownRadioItem(props: DropdownRadioItemProps) {}function DropdownSub(props: DropdownSubProps) {- return (- <KobalteDropdownMenu.Sub- gutter={2}- shift={-7}- {...props}- />- );+ return <KobalteDropdownMenu.Sub gutter={2} shift={-7} {...props} />;}function DropdownItem(props: DropdownItemProps) {@@ -199,18 +240,25 @@ function DropdownTrigger(props: DropdownTriggerProps) {);}-export const Dropdown = Object.assign((props: ComponentProps<typeof KobalteDropdownMenu>) => (<KobalteDropdownMenu gutter={4} {...props} />), {- RadioGroup: KobalteDropdownMenu.RadioGroup, /* passthrough — pure logical wrapper */- Separator: KobalteDropdownMenu.Separator, /* passthrough — styled via class at use sites */- ItemIndicator: DropdownItemIndicator,- CheckboxItem: DropdownCheckboxItem,- SubContent: DropdownSubContent,- SubTrigger: DropdownSubTrigger,- GroupLabel: DropdownGroupLabel,- RadioItem: DropdownRadioItem,- Content: DropdownContent,- Trigger: DropdownTrigger,- Group: DropdownGroup,- Item: DropdownItem,- Sub: DropdownSub,-});+export const Dropdown = Object.assign(+ (props: ComponentProps<typeof KobalteDropdownMenu>) => (+ <KobalteDropdownMenu gutter={4} {...props} />+ ),+ {+ RadioGroup:+ KobalteDropdownMenu.RadioGroup /* passthrough — pure logical wrapper */,+ Separator:+ KobalteDropdownMenu.Separator /* passthrough — styled via class at use sites */,+ ItemIndicator: DropdownItemIndicator,+ CheckboxItem: DropdownCheckboxItem,+ SubContent: DropdownSubContent,+ SubTrigger: DropdownSubTrigger,+ GroupLabel: DropdownGroupLabel,+ RadioItem: DropdownRadioItem,+ Content: DropdownContent,+ Trigger: DropdownTrigger,+ Group: DropdownGroup,+ Item: DropdownItem,+ Sub: DropdownSub,+ }+);diff --git a/js/app/packages/ui/components/Hotkey.tsx b/js/app/packages/ui/components/Hotkey.tsxindex e96fbecf92..0063023cf4 100644--- a/js/app/packages/ui/components/Hotkey.tsx+++ b/js/app/packages/ui/components/Hotkey.tsx@@ -1,9 +1,9 @@-import { createMemo, For, type JSX, Show, splitProps } from 'solid-js';-import { getPrettyHotkeyStringByToken } from '@core/hotkey/utils';-import type { HotkeyToken } from '@core/hotkey/tokens';-import type { Theme } from 'core/component/Themes';import { IS_MAC } from '@core/constant/isMac';+import type { HotkeyToken } from '@core/hotkey/tokens';+import { getPrettyHotkeyStringByToken } from '@core/hotkey/utils';import { cn } from '@ui';+import type { Theme } from 'core/component/Themes';+import { createMemo, For, type JSX, Show, splitProps } from 'solid-js';const modifierMap = {shift: IS_MAC ? '⇧' : 'Shift',@@ -26,7 +26,6 @@ const symbolMap = {};const hotkeyStyles: Record<Theme, { label: string; hotkey: string }> = {-extraMuted: {hotkey: 'bg-surface border border-ink-extra-muted text-ink-extra-muted',label: 'bg-ink-extra-muted border border-ink-extra-muted text-surface',@@ -88,16 +87,20 @@ const hotkeyStyles: Record<Theme, { label: string; hotkey: string }> = {label: '',hotkey: '',},-};-const getSymbol = (key: string) => key.toUpperCase() in symbolMap ? symbolMap[key.toUpperCase() as keyof typeof symbolMap] : key;+const getSymbol = (key: string) =>+ key.toUpperCase() in symbolMap+ ? symbolMap[key.toUpperCase() as keyof typeof symbolMap]+ : key;const modifierKeys = Object.keys(modifierMap);function breakApartHotkeyString(hotkey: string) {const parts = hotkey.split('+');- if (parts.length === 0) { return { key: '', modifiers: [] }; }+ if (parts.length === 0) {+ return { key: '', modifiers: [] };+ }const key = parts.filter((part) => !modifierKeys.includes(part)).map(getSymbol);@@ -129,8 +132,12 @@ interface HotkeyProps extends JSX.HTMLAttributes<HTMLDivElement> {* getNormalizedKeyString({ token: TOKENS.canvas.cut }) // "⌘X"* getNormalizedKeyString({ shortcut: 'meta+shift+k', showPlus: true }) // "⌘ + ⇧ + K"*/-export function getNormalizedKeyString(props: Pick<HotkeyProps, 'token' | 'shortcut' | 'lowercase' | 'showPlus'>): string {- const resolvedShortcut = props.token ? getPrettyHotkeyStringByToken(props.token) : props.shortcut;+export function getNormalizedKeyString(+ props: Pick<HotkeyProps, 'token' | 'shortcut' | 'lowercase' | 'showPlus'>+): string {+ const resolvedShortcut = props.token+ ? getPrettyHotkeyStringByToken(props.token)+ : props.shortcut;if (!resolvedShortcut) return '';@@ -148,16 +155,19 @@ export function getNormalizedKeyString(props: Pick<HotkeyProps, 'token' | 'short(mod) => modifierMap[mod as keyof typeof modifierMap] || mod);- const keyStrings = typeof normalizedKey === 'string'- ? (normalizedKey ? [normalizedKey] : [])- : normalizedKey;+ const keyStrings =+ typeof normalizedKey === 'string'+ ? normalizedKey+ ? [normalizedKey]+ : []+ : normalizedKey;const separator = props.showPlus ? ' + ' : '';return [...modifierStrings, ...keyStrings].join(separator);}-export function Hotkey(props: HotkeyProps){+export function Hotkey(props: HotkeyProps) {const [local, rest] = splitProps(props, ['lowercase','children',@@ -175,11 +185,13 @@ export function Hotkey(props: HotkeyProps){const hotkey = createMemo(() => {const s = resolvedShortcut();- if (!s) { return { key: '', modifiers: [] }; }+ if (!s) {+ return { key: '', modifiers: [] };+ }return breakApartHotkeyString(s);});- function normalizedKey(){+ function normalizedKey() {const key = hotkey().key;return props.lowercase? typeof key === 'string'@@ -188,16 +200,16 @@ export function Hotkey(props: HotkeyProps){: typeof key === 'string'? key.toUpperCase(): key.map((k) => k.toUpperCase());- };+ }- function hasContent(){+ function hasContent() {const h = hotkey();const key = normalizedKey();return (h.modifiers.length > 0 ||(key && (typeof key === 'string' ? key.length > 0 : key.length > 0)));- };+ }return (<Show when={hasContent()}>@@ -213,9 +225,7 @@ export function Hotkey(props: HotkeyProps){<For each={hotkey().modifiers}>{(mod) => (<>- <span>- {modifierMap[mod as keyof typeof modifierMap] || mod}- </span>+ <span>{modifierMap[mod as keyof typeof modifierMap] || mod}</span><Show when={local.showPlus}><span> + </span>@@ -229,4 +239,4 @@ export function Hotkey(props: HotkeyProps){</div></Show>);-};+}diff --git a/js/app/packages/ui/components/HoverCard.tsx b/js/app/packages/ui/components/HoverCard.tsxindex 8b94d807f8..1487da07f4 100644--- a/js/app/packages/ui/components/HoverCard.tsx+++ b/js/app/packages/ui/components/HoverCard.tsx@@ -1,5 +1,5 @@-import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';import type { Placement } from '@floating-ui/dom';+import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';import type { JSX, ParentProps } from 'solid-js';import { cn } from '../utils/classname';import { Surface } from './Surface';@@ -40,7 +40,7 @@ export function HoverCard(props: HoverCardProps) {<Surfaceclass={cn('flex items-center justify-center p-2 text-ink-muted text-xs wrap-break-word',- props.contentClass,+ props.contentClass)}depth={3}>diff --git a/js/app/packages/ui/components/Layer.tsx b/js/app/packages/ui/components/Layer.tsxindex 8e7262e459..c46ceae535 100644--- a/js/app/packages/ui/components/Layer.tsx+++ b/js/app/packages/ui/components/Layer.tsx@@ -12,7 +12,7 @@ export function Layer(props: LayerProps) {<divdata-layer-depth={props.depth}style={{- 'display': 'contents',+ display: 'contents','--b0': `oklch(calc(var(--b0l) + ${depth()}) var(--b0c) var(--b0h))`,'--b1': `oklch(calc(var(--b1l) + ${depth()}) var(--b1c) var(--b1h))`,'--b2': `oklch(calc(var(--b2l) + ${depth()}) var(--b2c) var(--b2h))`,@@ -24,27 +24,27 @@ export function Layer(props: LayerProps) {'--c3': `oklch(calc(var(--c3l) + ${depth()}) var(--c3c) var(--c3h))`,'--c4': `oklch(calc(var(--c4l) + ${depth()}) var(--c4c) var(--c4h))`,- '--color-accent': 'var(--a0)',- '--color-accent-bg': 'oklch(from var(--a0) l c h / 0.15)',+ '--color-accent': 'var(--a0)',+ '--color-accent-bg': 'oklch(from var(--a0) l c h / 0.15)',// TODO (seamus): --color-surface could be better handled with fractional layer depth- '--color-surface': 'var(--b0)',- '--color-shadow': 'oklch(calc(var(--b0l) - 0.005 ) var(--b0c) var(--b0h) / 0.2)',+ '--color-surface': 'var(--b0)',+ '--color-shadow':+ 'oklch(calc(var(--b0l) - 0.005 ) var(--b0c) var(--b0h) / 0.2)',// TODO (seamus): --color-message could be better handled with fractional layer depth- '--color-message': 'color-mix(in oklch, var(--b1) 50%, var(--b2))',- '--color-active': 'var(--b1)',- '--color-hover': 'var(--b2)',- '--color-overlay': 'oklch(from var(--b2) l c h / 0.5)',- '--color-edge-muted': 'var(--b3)',- '--color-edge': 'var(--b4)',- '--color-rail': 'color-mix(in oklch, var(--b0) 75%, var(--c0))',+ '--color-message': 'color-mix(in oklch, var(--b1) 50%, var(--b2))',+ '--color-active': 'var(--b1)',+ '--color-hover': 'var(--b2)',+ '--color-overlay': 'oklch(from var(--b2) l c h / 0.5)',+ '--color-edge-muted': 'var(--b3)',+ '--color-edge': 'var(--b4)',+ '--color-rail': 'color-mix(in oklch, var(--b0) 75%, var(--c0))',- '--color-ink': 'var(--c0)',- '--color-ink-muted': 'var(--c1)',+ '--color-ink': 'var(--c0)',+ '--color-ink-muted': 'var(--c1)','--color-ink-extra-muted': 'var(--c2)',- '--color-ink-disabled': 'var(--c3)',+ '--color-ink-disabled': 'var(--c3)','--color-ink-placeholder': 'oklch(var(--c4) / 0.5))',-}}>{props.children}diff --git a/js/app/packages/ui/components/LogoProgress.tsx b/js/app/packages/ui/components/LogoProgress.tsxindex 4a1366f824..bae3c558b7 100644--- a/js/app/packages/ui/components/LogoProgress.tsx+++ b/js/app/packages/ui/components/LogoProgress.tsx@@ -4,7 +4,8 @@ interface LogoProgressProps {class?: string;}-const LOGO_PATH = 'm15.578 0.044-2.244 0.879v6.676c0 0.257 0.107 0.503 0.293 0.68l1.041 0.982 7.086 6.697 2.24-0.879v-6.676c0-0.257-0.105-0.501-0.293-0.678zM6.25 0.042 4.008 0.923v6.676c0 0.257 0.107 0.503 0.293 0.68l1.039 0.982 7.084 6.697 2.244-0.879v-6.676c0-0.257-0.103-0.501-0.291-0.678l-1.043-0.984zM2.252 5.083 0.01 5.962v6.676c0 0.257 0.107 0.503 0.293 0.68l2.793 2.64 2.244-0.879v-6.676c0-0.257-0.103-0.501-0.291-0.678z';+const LOGO_PATH =+ 'm15.578 0.044-2.244 0.879v6.676c0 0.257 0.107 0.503 0.293 0.68l1.041 0.982 7.086 6.697 2.24-0.879v-6.676c0-0.257-0.105-0.501-0.293-0.678zM6.25 0.042 4.008 0.923v6.676c0 0.257 0.107 0.503 0.293 0.68l1.039 0.982 7.084 6.697 2.244-0.879v-6.676c0-0.257-0.103-0.501-0.291-0.678l-1.043-0.984zM2.252 5.083 0.01 5.962v6.676c0 0.257 0.107 0.503 0.293 0.68l2.793 2.64 2.244-0.879v-6.676c0-0.257-0.103-0.501-0.291-0.678z';export function LogoProgress(props: LogoProgressProps) {const clipRight = () => `${100 - (props.level / props.total) * 100}%`;diff --git a/js/app/packages/ui/components/Panel.tsx b/js/app/packages/ui/components/Panel.tsxindex ad3b5bbbc1..5694646f20 100644--- a/js/app/packages/ui/components/Panel.tsx+++ b/js/app/packages/ui/components/Panel.tsx@@ -1,9 +1,9 @@-import type { SurfaceProps } from './Surface';import type { ParentProps } from 'solid-js';import { children, Show, splitProps } from 'solid-js';import { cn } from '../utils/classname';-import { Surface } from './Surface';import { Scroll } from './Scroll';+import type { SurfaceProps } from './Surface';+import { Surface } from './Surface';/*<Panel>@@ -41,7 +41,10 @@ function PanelHeader(props: SlotProps) {return (<Show when={resolved()}><div- class={cn('flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-b border-edge-muted overflow-hidden', props.class)}+ class={cn(+ 'flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-b border-edge-muted overflow-hidden',+ props.class+ )}style={{ 'grid-area': 'header' }}>{resolved()}@@ -55,7 +58,10 @@ function PanelToolbar(props: SlotProps) {return (<Show when={resolved()}><div- class={cn('flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-b border-edge-muted overflow-hidden', props.class)}+ class={cn(+ 'flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-b border-edge-muted overflow-hidden',+ props.class+ )}style={{ 'grid-area': 'toolbar' }}>{resolved()}@@ -92,7 +98,10 @@ function PanelFooter(props: SlotProps) {return (<Show when={resolved()}><div- class={cn('flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-t border-edge-muted overflow-hidden', props.class)}+ class={cn(+ 'flex flex-none items-center min-h-10 px-2 overflow-x-hidden border-t border-edge-muted overflow-hidden',+ props.class+ )}style={{ 'grid-area': 'footer' }}>{resolved()}diff --git a/js/app/packages/ui/components/ScreencastHotkeys.tsx b/js/app/packages/ui/components/ScreencastHotkeys.tsxindex 0f20c4d3be..7e7cfa2ccb 100644--- a/js/app/packages/ui/components/ScreencastHotkeys.tsx+++ b/js/app/packages/ui/components/ScreencastHotkeys.tsx@@ -1,84 +1,84 @@-import { useSubscribeToKeypress } from "@app/signal/hotkeyRoot";-import { makePersisted } from "@solid-primitives/storage";-import { createSignal, For, Show } from "solid-js";-import { Portal } from "solid-js/web";-import { Hotkey } from "./Hotkey";+import { useSubscribeToKeypress } from '@app/signal/hotkeyRoot';+import { makePersisted } from '@solid-primitives/storage';+import { createSignal, For, Show } from 'solid-js';+import { Portal } from 'solid-js/web';+import { Hotkey } from './Hotkey';export const [enableScreencastHotkeys, setEnableScreencastHotkeys] =- makePersisted(createSignal(false), { name: "enableHotkeyScreencast" });+ makePersisted(createSignal(false), { name: 'enableHotkeyScreencast' });type ScreencastEntry = {- id: number;- shortcut: string;- label?: string;- count: number;- timeout: number;+ id: number;+ shortcut: string;+ label?: string;+ count: number;+ timeout: number;};let entryId = 0;const ENTRY_TTL = 3000;export function ScreencastHotkeys() {- const [entries, setEntries] = createSignal<ScreencastEntry[]>([]);+ const [entries, setEntries] = createSignal<ScreencastEntry[]>([]);- useSubscribeToKeypress((ctx) => {- if (ctx.eventType !== "keydown" || !ctx.isNonModifierKeypress) return;- if (!ctx.commandCaptured && !ctx.pressedKeys.has("cmd")) return;- const cmd = ctx.commandCaptured;- const shortcut = cmd?.hotkeys?.[0] ?? ctx.pressedKeysString;- const label = cmd- ? typeof cmd.description === "function"- ? cmd.description()- : cmd.description- : undefined;+ useSubscribeToKeypress((ctx) => {+ if (ctx.eventType !== 'keydown' || !ctx.isNonModifierKeypress) return;+ if (!ctx.commandCaptured && !ctx.pressedKeys.has('cmd')) return;+ const cmd = ctx.commandCaptured;+ const shortcut = cmd?.hotkeys?.[0] ?? ctx.pressedKeysString;+ const label = cmd+ ? typeof cmd.description === 'function'+ ? cmd.description()+ : cmd.description+ : undefined;- setEntries((prev) => {- const last = prev[prev.length - 1];- if (last && last.shortcut === shortcut) {- window.clearTimeout(last.timeout);- const updated = {- ...last,- count: last.count + 1,- timeout: window.setTimeout(() => {- setEntries((p) => p.filter((e) => e.id !== last.id));- }, ENTRY_TTL),- };- return [...prev.slice(0, -1), updated];- }- const id = entryId++;- const timeout = window.setTimeout(() => {- setEntries((p) => p.filter((e) => e.id !== id));- }, ENTRY_TTL);- const next = [...prev, { id, shortcut, label, count: 1, timeout }];- if (next.length > 5) {- const oldest = next[0];+ setEntries((prev) => {+ const last = prev[prev.length - 1];+ if (last && last.shortcut === shortcut) {+ window.clearTimeout(last.timeout);+ const updated = {+ ...last,+ count: last.count + 1,+ timeout: window.setTimeout(() => {+ setEntries((p) => p.filter((e) => e.id !== last.id));+ }, ENTRY_TTL),+ };+ return [...prev.slice(0, -1), updated];+ }+ const id = entryId++;+ const timeout = window.setTimeout(() => {+ setEntries((p) => p.filter((e) => e.id !== id));+ }, ENTRY_TTL);+ const next = [...prev, { id, shortcut, label, count: 1, timeout }];+ if (next.length > 5) {+ const oldest = next[0];- window.clearTimeout(oldest.timeout);- return next.slice(-5);- }- return next;- });- });+ window.clearTimeout(oldest.timeout);+ return next.slice(-5);+ }+ return next;+ });+ });- return (- <Show when={enableScreencastHotkeys() && entries().length > 0}>- <Portal>- <div class="fixed right-3 top-3 z-2147483647 flex flex-col-reverse gap-1 pointer-events-none text-xs">- <For each={entries()}>- {(entry) => (- <div class="flex items-center gap-2 bg-surface p-1 border border-edge rounded-md">- <Hotkey shortcut={entry.shortcut} theme="accent" />- <Show when={entry.count > 1}>- <span class="text-xs font-medium text-accent">- x{entry.count}- </span>- </Show>- <span class="text-xs text-ink-muted">{entry.label}</span>- </div>- )}- </For>- </div>- </Portal>- </Show>- );+ return (+ <Show when={enableScreencastHotkeys() && entries().length > 0}>+ <Portal>+ <div class="fixed right-3 top-3 z-2147483647 flex flex-col-reverse gap-1 pointer-events-none text-xs">+ <For each={entries()}>+ {(entry) => (+ <div class="flex items-center gap-2 bg-surface p-1 border border-edge rounded-md">+ <Hotkey shortcut={entry.shortcut} theme="accent" />+ <Show when={entry.count > 1}>+ <span class="text-xs font-medium text-accent">+ x{entry.count}+ </span>+ </Show>+ <span class="text-xs text-ink-muted">{entry.label}</span>+ </div>+ )}+ </For>+ </div>+ </Portal>+ </Show>+ );}diff --git a/js/app/packages/ui/components/Scroll.tsx b/js/app/packages/ui/components/Scroll.tsxindex 475d048ba3..e22b484a84 100644--- a/js/app/packages/ui/components/Scroll.tsx+++ b/js/app/packages/ui/components/Scroll.tsx@@ -1,5 +1,5 @@-import { createSignal, onCleanup, onMount } from 'solid-js';import type { JSX } from 'solid-js';+import { createSignal, onCleanup, onMount } from 'solid-js';const THUMB_WIDTH = 2;const HIDE_DELAY = 500;@@ -20,11 +20,16 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {let maxTop = 0;function update() {- setTranslateY(THUMB_INSET + (maxScroll > 0 ? (scrollRef.scrollTop / maxScroll) * maxTop : 0));+ setTranslateY(+ THUMB_INSET ++ (maxScroll > 0 ? (scrollRef.scrollTop / maxScroll) * maxTop : 0)+ );}function reveal() {- if (scrollRef.scrollHeight <= scrollRef.clientHeight) { return; }+ if (scrollRef.scrollHeight <= scrollRef.clientHeight) {+ return;+ }setVisible(true);clearTimeout(hideTimer);hideTimer = setTimeout(() => setVisible(false), HIDE_DELAY);@@ -35,7 +40,10 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {const sh = scrollRef.scrollHeight;const trackHeight = Math.max(0, ch - THUMB_INSET * 2);const ratio = sh > 0 ? ch / sh : 1;- const th = Math.max(MIN_THUMB_HEIGHT, Math.min(trackHeight, trackHeight * ratio));+ const th = Math.max(+ MIN_THUMB_HEIGHT,+ Math.min(trackHeight, trackHeight * ratio)+ );setThumbHeight(th);maxScroll = Math.max(0, sh - ch);maxTop = Math.max(0, trackHeight - th);@@ -48,20 +56,29 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {}function seek(localY: number) {- if (maxScroll <= 0 || maxTop <= 0) { return; }- scrollRef.scrollTop = Math.max(0, Math.min(maxTop, localY - thumbHeight() / 2 - THUMB_INSET)) / maxTop * maxScroll;+ if (maxScroll <= 0 || maxTop <= 0) {+ return;+ }+ scrollRef.scrollTop =+ (Math.max(0, Math.min(maxTop, localY - thumbHeight() / 2 - THUMB_INSET)) /+ maxTop) *+ maxScroll;reveal();}function handlePointerDown(e: PointerEvent) {- if (e.button !== 0) { return; }+ if (e.button !== 0) {+ return;+ }e.preventDefault();gutterRef.setPointerCapture(e.pointerId);seek(e.offsetY);}function handlePointerMove(e: PointerEvent) {- if (!gutterRef.hasPointerCapture(e.pointerId)) { return; }+ if (!gutterRef.hasPointerCapture(e.pointerId)) {+ return;+ }seek(e.offsetY);}@@ -80,11 +97,11 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {<div{...props}style={{- 'position': 'relative',+ position: 'relative','min-height': '0','min-width': '0',- 'height': '100%',- 'width': '100%',+ height: '100%',+ width: '100%',}}><div@@ -93,7 +110,7 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {style={{'scrollbar-width': 'none','overflow-y': 'auto',- 'height': '100%',+ height: '100%',}}><div ref={contentRef}>{props.children}</div>@@ -104,26 +121,26 @@ export function Scroll(props: JSX.HTMLAttributes<HTMLDivElement>) {onPointerMove={handlePointerMove}aria-hidden="true"style={{- 'width': `${GUTTER_WIDTH}px`,+ width: `${GUTTER_WIDTH}px`,'touch-action': 'none',- 'position': 'absolute',- 'height': '100%',- 'right': '0',- 'top': '0',+ position: 'absolute',+ height: '100%',+ right: '0',+ top: '0',}}><divstyle={{- 'transform': `translateY(${translateY()}px)`,- 'transition': 'opacity 150ms ease-in-out',+ transform: `translateY(${translateY()}px)`,+ transition: 'opacity 150ms ease-in-out','border-radius': `${THUMB_WIDTH * 0.5}px`,'background-color': 'var(--c4)',- 'height': `${thumbHeight()}px`,- 'opacity': visible() ? 1 : 0,- 'right': `${THUMB_INSET}px`,- 'width': `${THUMB_WIDTH}px`,+ height: `${thumbHeight()}px`,+ opacity: visible() ? 1 : 0,+ right: `${THUMB_INSET}px`,+ width: `${THUMB_WIDTH}px`,'pointer-events': 'none',- 'position': 'absolute',+ position: 'absolute',}}/></div>diff --git a/js/app/packages/ui/components/SegmentedControl.tsx b/js/app/packages/ui/components/SegmentedControl.tsxindex 6580269984..5efe1fcc60 100644--- a/js/app/packages/ui/components/SegmentedControl.tsx+++ b/js/app/packages/ui/components/SegmentedControl.tsx@@ -1,6 +1,6 @@import { SegmentedControl as KSegmentedControl } from '@kobalte/core/segmented-control';-import { cn } from '../utils/classname';import { For, type JSX } from 'solid-js';+import { cn } from '../utils/classname';type SegmentedControlOption<T extends string | number | boolean> = {value: T;diff --git a/js/app/packages/ui/components/SendButton.tsx b/js/app/packages/ui/components/SendButton.tsxindex b9afd22f65..e789f442a7 100644--- a/js/app/packages/ui/components/SendButton.tsx+++ b/js/app/packages/ui/components/SendButton.tsx@@ -40,7 +40,10 @@ export function SendButton(props: SendButtonProps) {)}{...rest}>- <Show when={!local.pending} fallback={<SpinnerIcon class="animate-spin" />}>+ <Show+ when={!local.pending}+ fallback={<SpinnerIcon class="animate-spin" />}+ >{resolved() ?? <ArrowUp />}</Show></Button>diff --git a/js/app/packages/ui/components/Stepper.tsx b/js/app/packages/ui/components/Stepper.tsxindex d696ae0666..3f6745a005 100644--- a/js/app/packages/ui/components/Stepper.tsx+++ b/js/app/packages/ui/components/Stepper.tsx@@ -12,7 +12,7 @@ import { cn } from '../utils/classname';*/export type StepperTransition = {- mode?: 'outin' | 'inout'; /* simultaneous if omitted */+ mode?: 'outin' | 'inout' /* simultaneous if omitted */;enterActiveClass?: string;enterClass?: string;enterToClass?: string;@@ -22,20 +22,24 @@ export type StepperTransition = {};/* Resolver receives 1 for forward navigation, -1 for backward */-export type StepperTransitionResolver = (direction: 1 | -1) => StepperTransition;+export type StepperTransitionResolver = (+ direction: 1 | -1+) => StepperTransition;export type StepperProps = {- step: number; /* current step index */- transition?: StepperTransition | StepperTransitionResolver; /* transition behavior */- appear?: boolean; /* animate initial mount */- children: JSX.Element; /* Stepper.Step slots */- class?: string; /* container classes */+ step: number /* current step index */;+ transition?:+ | StepperTransition+ | StepperTransitionResolver /* transition behavior */;+ appear?: boolean /* animate initial mount */;+ children: JSX.Element /* Stepper.Step slots */;+ class?: string /* container classes */;};export type StepperStepProps = {- index?: number; /* override position */- noTransition?: boolean; /* skip enter+exit anim */- children: JSX.Element; /* step contents (lazy) */+ index?: number /* override position */;+ noTransition?: boolean /* skip enter+exit anim */;+ children: JSX.Element /* step contents (lazy) */;};const FADE: StepperTransition = {@@ -50,18 +54,21 @@ const FADE: StepperTransition = {const SLIDE: StepperTransitionResolver = (dir) => ({enterActiveClass: 'transition-all duration-200 ease-out',- enterClass: dir === 1 ? 'opacity-0 translate-x-6' : 'opacity-0 -translate-x-6',+ enterClass:+ dir === 1 ? 'opacity-0 translate-x-6' : 'opacity-0 -translate-x-6',enterToClass: 'opacity-100 translate-x-0',exitActiveClass: 'transition-all duration-100 ease-out absolute inset-0',exitClass: 'opacity-100 translate-x-0',- exitToClass: dir === 1 ? 'opacity-0 -translate-x-6' : 'opacity-0 translate-x-6',+ exitToClass:+ dir === 1 ? 'opacity-0 -translate-x-6' : 'opacity-0 translate-x-6',});const SLIDE_FULL: StepperTransitionResolver = (dir) => ({enterActiveClass: 'transition-transform duration-200 ease-out',enterClass: dir === 1 ? 'translate-x-full' : '-translate-x-full',enterToClass: 'translate-x-0',- exitActiveClass: 'transition-transform duration-100 ease-out absolute inset-0',+ exitActiveClass:+ 'transition-transform duration-100 ease-out absolute inset-0',exitClass: 'translate-x-0',exitToClass: dir === 1 ? '-translate-x-full' : 'translate-x-full',});diff --git a/js/app/packages/ui/components/Surface.tsx b/js/app/packages/ui/components/Surface.tsxindex faf8f3b173..c5c04c4e11 100644--- a/js/app/packages/ui/components/Surface.tsx+++ b/js/app/packages/ui/components/Surface.tsx@@ -1,4 +1,4 @@-import { splitProps, type JSX } from 'solid-js';+import { type JSX, splitProps } from 'solid-js';import { cn } from '../utils/classname';import { Layer } from './Layer';@@ -23,7 +23,7 @@ export function Surface(props: SurfaceProps) {const border = () => {const edge = 'var(--b4)';- const top = local.active ? local.highlightColor ?? 'var(--a0)' : edge;+ const top = local.active ? (local.highlightColor ?? 'var(--a0)') : edge;const bottom = local.active && !local.solid ? `${edge} 80%` : top;return `linear-gradient(${top}, ${bottom})`;};@@ -35,12 +35,12 @@ export function Surface(props: SurfaceProps) {'background-image': `linear-gradient(var(--b0), var(--b0)), ${border()}`,'background-origin': 'padding-box, border-box','background-clip': 'padding-box, border-box',- 'border': '1px solid #0000',+ border: '1px solid #0000',...local.style,}}class={cn('relative rounded-md overflow-clip min-h-0 size-full',- local.class,+ local.class)}{...rest}>diff --git a/js/app/packages/ui/components/ToggleSwitch.tsx b/js/app/packages/ui/components/ToggleSwitch.tsxindex c016bf304e..ccf225a8d0 100644--- a/js/app/packages/ui/components/ToggleSwitch.tsx+++ b/js/app/packages/ui/components/ToggleSwitch.tsx@@ -1,7 +1,7 @@import { Switch as KobalteSwitch } from '@kobalte/core/switch';-import { Show, createSignal, onCleanup, splitProps } from 'solid-js';-import { cn } from '../utils/classname';import type { JSX } from 'solid-js';+import { createSignal, onCleanup, Show, splitProps } from 'solid-js';+import { cn } from '../utils/classname';export type ToggleSwitchProps = {onChange?: (checked: boolean) => void;@@ -57,7 +57,7 @@ export const ToggleSwitch = (props: ToggleSwitchProps): JSX.Element => {'absolute top-0.5 left-0.5 h-3 rounded-full bg-surface transition-all duration-100 ease-in-out',isStretched()? 'w-4 data-checked:translate-x-1'- : 'w-3 data-checked:translate-x-2',+ : 'w-3 data-checked:translate-x-2')}/></KobalteSwitch.Control>diff --git a/js/app/packages/ui/components/Tooltip.tsx b/js/app/packages/ui/components/Tooltip.tsxindex 8a8546ce4e..58ec86a75d 100644--- a/js/app/packages/ui/components/Tooltip.tsx+++ b/js/app/packages/ui/components/Tooltip.tsx@@ -1,10 +1,10 @@-import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';import type { HotkeyToken } from '@core/hotkey/tokens';-import { Hotkey } from '../../ui/components/Hotkey';import type { Placement } from '@floating-ui/dom';+import { Tooltip as KobalteTooltip } from '@kobalte/core/tooltip';+import { Surface } from '@ui';import type { ParentProps } from 'solid-js';import { For, Show } from 'solid-js';-import { Surface } from '@ui';+import { Hotkey } from '../../ui/components/Hotkey';type TooltipProps = ParentProps<{hotkey?: HotkeyToken | HotkeyToken[];@@ -26,7 +26,11 @@ type TooltipProps = ParentProps<{*/export function Tooltip(props: TooltipProps) {function tokens(): HotkeyToken[] {- return props.hotkey == null ? [] : Array.isArray(props.hotkey) ? props.hotkey : [props.hotkey];+ return props.hotkey == null+ ? []+ : Array.isArray(props.hotkey)+ ? props.hotkey+ : [props.hotkey];}function shortcuts(): string[] {@@ -71,10 +75,7 @@ export function Tooltip(props: TooltipProps) {<For each={tokens()}>{(token, ndx) => (<>- <Hotkey- token={token}- theme="subtle"- />+ <Hotkey token={token} theme="subtle" /><Show when={ndx() < tokens().length - 1}><span class="text-ink-extra-muted">then</span></Show>@@ -84,10 +85,7 @@ export function Tooltip(props: TooltipProps) {<For each={shortcuts()}>{(shortcut, ndx) => (<>- <Hotkey- shortcut={shortcut}- theme="subtle"- />+ <Hotkey shortcut={shortcut} theme="subtle" /><Show when={ndx() < shortcuts().length - 1}><span class="text-ink-extra-muted">then</span></Show>diff --git a/js/app/packages/ui/index.ts b/js/app/packages/ui/index.tsindex fa2338ce41..74662084a0 100644--- a/js/app/packages/ui/index.ts+++ b/js/app/packages/ui/index.ts@@ -1,35 +1,43 @@/* components */-export { Checkbox, SingleSelectCheck } from './components/Checkbox';-export { SegmentedControl } from './components/SegmentedControl';-export { TabbedControl } from './components/TabbedControl';++/* types */+export type {+ AvatarGroupProps,+ AvatarGroupSize,+ AvatarProps,+ AvatarSize,+} from './components/Avatar';export { Avatar, AvatarGroup } from './components/Avatar';-export { LogoProgress } from './components/LogoProgress';-export { ToggleSwitch } from './components/ToggleSwitch';+export type { ButtonProps } from './components/Button';+export { Button } from './components/Button';export { ButtonGroup } from './components/ButtonGroup';-export { SendButton } from './components/SendButton';-export { HoverCard } from './components/HoverCard';+export type { ChatInputProps, ChatInputRows } from './components/ChatInput';+export type { CheckboxProps } from './components/Checkbox';+export { Checkbox, SingleSelectCheck } from './components/Checkbox';+export type { DialogProps } from './components/Dialog';+export { Dialog } from './components/Dialog';export { Dropdown } from './components/Dropdown';-export { Surface } from './components/Surface';-export { Tooltip } from './components/Tooltip';-export { Dialog } from './components/Dialog';-export { Button } from './components/Button';-export { Hotkey } from './components/Hotkey';-export { Scroll } from './components/Scroll';-export { Panel } from './components/Panel';-export { Layer } from './components/Layer';+export type {+ EmptyStateAction,+ EmptyStatePanelProps,+} from './components/EmptyStatePanel';export { EmptyStatePanel } from './components/EmptyStatePanel';+export type { FilteredHiddenBannerProps } from './components/FilteredHiddenBanner';export { FilteredHiddenBanner } from './components/FilteredHiddenBanner';--/* types */-export type { AvatarSize, AvatarProps, AvatarGroupSize, AvatarGroupProps } from './components/Avatar';-export type { ChatInputRows, ChatInputProps } from './components/ChatInput';-export type { ToggleSwitchProps } from './components/ToggleSwitch';+export { Hotkey } from './components/Hotkey';+export { HoverCard } from './components/HoverCard';+export { Layer } from './components/Layer';+export { LogoProgress } from './components/LogoProgress';+export { Panel } from './components/Panel';+export { Scroll } from './components/Scroll';+export { SegmentedControl } from './components/SegmentedControl';export type { SendButtonProps } from './components/SendButton';-export type { CheckboxProps } from './components/Checkbox';-export type { ButtonProps } from './components/Button';-export type { DialogProps } from './components/Dialog';-export type { EmptyStatePanelProps, EmptyStateAction } from './components/EmptyStatePanel';-export type { FilteredHiddenBannerProps } from './components/FilteredHiddenBanner';+export { SendButton } from './components/SendButton';+export { Surface } from './components/Surface';+export { TabbedControl } from './components/TabbedControl';+export type { ToggleSwitchProps } from './components/ToggleSwitch';+export { ToggleSwitch } from './components/ToggleSwitch';+export { Tooltip } from './components/Tooltip';/* utils */export { cn } from './utils/classname';diff --git a/js/app/packages/ui/signals/signals.ts b/js/app/packages/ui/signals/signals.tsindex 77cc908337..c4e536e196 100644--- a/js/app/packages/ui/signals/signals.ts+++ b/js/app/packages/ui/signals/signals.ts@@ -18,4 +18,3 @@ export const [monochromeIcons, setMonochromeIcons] = makePersisted(createSignal<boolean>(false),{ name: 'enable-monochrome-icons' });-diff --git a/js/app/packages/ui/utils/monochromeIcons.ts b/js/app/packages/ui/utils/monochromeIcons.tsindex 84b54483a4..77faeab60c 100644--- a/js/app/packages/ui/utils/monochromeIcons.ts+++ b/js/app/packages/ui/utils/monochromeIcons.ts@@ -1,26 +1,46 @@-import { monochromeIcons } from '../signals/signals';import { createEffect, createRoot } from 'solid-js';+import { monochromeIcons } from '../signals/signals';export function initMonochromeIcons() {createRoot(() => {createEffect(() => {if (monochromeIcons()) {- document.documentElement.style.setProperty('--color-calendar', 'var(--c0)');- document.documentElement.style.setProperty('--color-contact', 'var(--c0)');- document.documentElement.style.setProperty('--color-canvas', 'var(--c0)');- document.documentElement.style.setProperty('--color-folder', 'var(--c0)');- document.documentElement.style.setProperty('--color-image', 'var(--c0)');- document.documentElement.style.setProperty('--color-video', 'var(--c0)');- document.documentElement.style.setProperty('--color-write', 'var(--c0)');- document.documentElement.style.setProperty('--color-code', 'var(--c0)');- document.documentElement.style.setProperty('--color-chat', 'var(--c0)');- document.documentElement.style.setProperty('--color-html', 'var(--c0)');- document.documentElement.style.setProperty('--color-note', 'var(--c0)');- document.documentElement.style.setProperty('--color-task', 'var(--c0)');- document.documentElement.style.setProperty('--color-pdf', 'var(--c0)');- document.documentElement.style.setProperty('--color-rss', 'var(--c0)');- }- else {+ document.documentElement.style.setProperty(+ '--color-calendar',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-contact',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-canvas',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-folder',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-image',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-video',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty(+ '--color-write',+ 'var(--c0)'+ );+ document.documentElement.style.setProperty('--color-code', 'var(--c0)');+ document.documentElement.style.setProperty('--color-chat', 'var(--c0)');+ document.documentElement.style.setProperty('--color-html', 'var(--c0)');+ document.documentElement.style.setProperty('--color-note', 'var(--c0)');+ document.documentElement.style.setProperty('--color-task', 'var(--c0)');+ document.documentElement.style.setProperty('--color-pdf', 'var(--c0)');+ document.documentElement.style.setProperty('--color-rss', 'var(--c0)');+ } else {document.documentElement.style.removeProperty('--color-calendar');document.documentElement.style.removeProperty('--color-contact');document.documentElement.style.removeProperty('--color-canvas');