mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
resolve lint/typecheck/knip issues
This commit is contained in:
1 parent
15a427ab47
commit
11ead89354
7 files changed
+110
-346
No files matched your search
@@ -1,231 +0,0 @@
|
||||
import type { MouseEventHandler } from 'react';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import type { RectCords } from 'folds';
|
||||
import {
|
||||
Box,
|
||||
Button,
|
||||
config,
|
||||
IconButton,
|
||||
Menu,
|
||||
MenuItem,
|
||||
PopOut,
|
||||
Spinner,
|
||||
Text,
|
||||
toRem,
|
||||
} from 'folds';
|
||||
import {
|
||||
DotsThreeOutlineVerticalIcon,
|
||||
sizedIcon,
|
||||
PhoneDisconnect,
|
||||
} from '$components/icons/phosphor';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
import type { CallEmbed } from '$plugins/call';
|
||||
import { useCallControlState } from '$plugins/call';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { useRoom } from '$hooks/useRoom';
|
||||
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
|
||||
import { useCallPreferences } from '$state/hooks/callPreferences';
|
||||
import * as css from './styles.css';
|
||||
import {
|
||||
ChatButton,
|
||||
ControlDivider,
|
||||
LayoutButton,
|
||||
MicrophoneButton,
|
||||
ScreenShareButton,
|
||||
SoundButton,
|
||||
VideoButton,
|
||||
} from './Controls';
|
||||
|
||||
type CallControlsProps = {
|
||||
callEmbed: CallEmbed;
|
||||
};
|
||||
export function CallControls({ callEmbed }: CallControlsProps) {
|
||||
const room = useRoom();
|
||||
const controlRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const screenSize = useScreenSizeContext();
|
||||
const compact = screenSize === ScreenSize.Mobile;
|
||||
|
||||
const { microphone, video, sound, screenshare, spotlight } = useCallControlState(
|
||||
callEmbed.control
|
||||
);
|
||||
|
||||
const { setPreferences } = useCallPreferences();
|
||||
|
||||
useEffect(() => {
|
||||
setPreferences({ microphone, video, sound });
|
||||
}, [microphone, video, sound, setPreferences]);
|
||||
|
||||
const [cords, setCords] = useState<RectCords>();
|
||||
|
||||
const handleOpenMenu: MouseEventHandler<HTMLButtonElement> = (evt) => {
|
||||
setCords(evt.currentTarget.getBoundingClientRect());
|
||||
};
|
||||
|
||||
const handleSpotlightClick = () => {
|
||||
callEmbed.control.toggleSpotlight();
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
const handleReactionsClick = () => {
|
||||
callEmbed.control.toggleReactions();
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
const handleSettingsClick = () => {
|
||||
callEmbed.control.toggleSettings();
|
||||
setCords(undefined);
|
||||
};
|
||||
|
||||
const [hangupState, hangup] = useAsyncCallback(
|
||||
useCallback(() => callEmbed.hangup(), [callEmbed])
|
||||
);
|
||||
const exiting =
|
||||
hangupState.status === AsyncStatus.Loading || hangupState.status === AsyncStatus.Success;
|
||||
|
||||
return (
|
||||
<Box
|
||||
ref={controlRef}
|
||||
className={css.CallControlContainer}
|
||||
justifyContent="Center"
|
||||
alignItems="Center"
|
||||
style={{
|
||||
maxWidth: '100%',
|
||||
padding: compact ? `0 ${toRem(8)}` : undefined,
|
||||
overflowX: 'auto',
|
||||
}}
|
||||
>
|
||||
<SequenceCard
|
||||
className={css.ControlCard}
|
||||
variant="SurfaceVariant"
|
||||
gap={compact ? '100' : '200'}
|
||||
radii="500"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
direction="Row"
|
||||
>
|
||||
<Box
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
direction="Row"
|
||||
>
|
||||
<MicrophoneButton
|
||||
enabled={microphone}
|
||||
onToggle={() => callEmbed.control.toggleMicrophone()}
|
||||
/>
|
||||
<SoundButton enabled={sound} onToggle={() => callEmbed.control.toggleSound()} />
|
||||
</Box>
|
||||
|
||||
{!compact && <ControlDivider />}
|
||||
|
||||
<Box
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
direction="Row"
|
||||
>
|
||||
<VideoButton enabled={video} onToggle={() => callEmbed.control.toggleVideo()} />
|
||||
<ScreenShareButton
|
||||
enabled={screenshare}
|
||||
onToggle={() => callEmbed.control.toggleScreenshare()}
|
||||
/>
|
||||
</Box>
|
||||
{!compact && <ControlDivider />}
|
||||
<Box
|
||||
shrink="No"
|
||||
alignItems="Center"
|
||||
justifyContent="Center"
|
||||
gap={compact ? '100' : '200'}
|
||||
direction="Row"
|
||||
>
|
||||
{room?.isCallRoom() && <ChatButton />}
|
||||
|
||||
<LayoutButton
|
||||
spotlight={spotlight}
|
||||
onToggle={() => callEmbed.control.toggleSpotlight()}
|
||||
/>
|
||||
|
||||
<PopOut
|
||||
anchor={cords}
|
||||
position="Top"
|
||||
align="Center"
|
||||
content={
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
onDeactivate: () => setCords(undefined),
|
||||
clickOutsideDeactivates: true,
|
||||
isKeyForward: (evt: KeyboardEvent) => evt.key === 'ArrowDown',
|
||||
isKeyBackward: (evt: KeyboardEvent) => evt.key === 'ArrowUp',
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Menu>
|
||||
<Box direction="Column" style={{ padding: config.space.S100 }}>
|
||||
<MenuItem
|
||||
size="300"
|
||||
variant="Surface"
|
||||
radii="300"
|
||||
onClick={handleReactionsClick}
|
||||
>
|
||||
<Text size="B300" truncate>
|
||||
Reactions
|
||||
</Text>
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
size="300"
|
||||
variant="Surface"
|
||||
radii="300"
|
||||
onClick={handleSettingsClick}
|
||||
>
|
||||
<Text size="B300" truncate>
|
||||
Settings
|
||||
</Text>
|
||||
</MenuItem>
|
||||
</Box>
|
||||
</Menu>
|
||||
</FocusTrap>
|
||||
}
|
||||
>
|
||||
<IconButton
|
||||
variant="Surface"
|
||||
fill="Soft"
|
||||
radii="400"
|
||||
size="400"
|
||||
onClick={handleOpenMenu}
|
||||
outlined
|
||||
aria-pressed={!!cords}
|
||||
>
|
||||
{sizedIcon(DotsThreeOutlineVerticalIcon, '300', { filled: !!cords })}
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
|
||||
<Button
|
||||
style={{
|
||||
minWidth: compact ? toRem(48) : toRem(88),
|
||||
padding: compact ? 0 : undefined,
|
||||
}}
|
||||
variant="Critical"
|
||||
fill="Solid"
|
||||
onClick={hangup}
|
||||
before={
|
||||
exiting ? (
|
||||
<Spinner variant="Critical" fill="Solid" size="200" />
|
||||
) : (
|
||||
sizedIcon(PhoneDisconnect, '200', { filled: true })
|
||||
)
|
||||
}
|
||||
disabled={exiting}
|
||||
>
|
||||
{!compact && <Text size="B400">End</Text>}
|
||||
</Button>
|
||||
</Box>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -142,12 +142,9 @@ function CallPrescreen() {
|
||||
|
||||
type CallJoinedProps = {
|
||||
containerRef: RefObject<HTMLDivElement>;
|
||||
joined: boolean;
|
||||
};
|
||||
|
||||
function CallJoined({ joined, containerRef }: CallJoinedProps) {
|
||||
const callEmbed = useCallEmbed();
|
||||
|
||||
function CallJoined({ containerRef }: CallJoinedProps) {
|
||||
return (
|
||||
<Box grow="Yes" direction="Column" style={{ position: 'relative' }}>
|
||||
<Box grow="Yes" ref={containerRef} style={{ height: '100%', width: '100%' }} />
|
||||
@@ -269,7 +266,7 @@ export function CallView({ resizable }: CallViewProps) {
|
||||
)}
|
||||
|
||||
{!currentJoined && <CallPrescreen />}
|
||||
<CallJoined joined={currentJoined} containerRef={callContainerRef} />
|
||||
<CallJoined containerRef={callContainerRef} />
|
||||
|
||||
{resizable && (
|
||||
<button
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Room } from '$types/matrix-sdk';
|
||||
import { MatrixRTCSession } from '$types/matrix-sdk';
|
||||
import {
|
||||
getCallMembershipPresence,
|
||||
@@ -10,9 +11,7 @@ import {
|
||||
|
||||
const MY_USER_ID = '@self:example.org';
|
||||
const SESSION_DESCRIPTION = {} as SessionDescription;
|
||||
const room = { roomId: '!room:example.org' } as Parameters<
|
||||
typeof MatrixRTCSession.sessionMembershipsForRoom
|
||||
>[0];
|
||||
const room = { roomId: '!room:example.org' } as unknown as Room;
|
||||
|
||||
describe('callMembershipState', () => {
|
||||
afterEach(() => {
|
||||
|
||||
@@ -25,7 +25,7 @@ export const decryptRtcTimelineEvent = async (
|
||||
|
||||
const decryptionPromise = event.getDecryptionPromise();
|
||||
if (decryptionPromise) {
|
||||
let timeoutId: ReturnType<typeof window.setTimeout> | undefined;
|
||||
let timeoutId: number | undefined;
|
||||
await Promise.race([
|
||||
decryptionPromise.finally(() => {
|
||||
if (timeoutId !== undefined) window.clearTimeout(timeoutId);
|
||||
|
||||
@@ -5,9 +5,11 @@ import {
|
||||
evaluateOutgoingRingbackFallback,
|
||||
type OutgoingRingbackState,
|
||||
} from './callSignalingFallback';
|
||||
import type { SessionDescription } from './callMembershipState';
|
||||
import { INCOMING_MEMBERSHIP_GRACE_MS, OUTGOING_RING_TIMEOUT_MS } from './callSignalingPolicy';
|
||||
|
||||
const NOW = 1_700_000_000_000;
|
||||
const EMPTY_SESSION = {} as SessionDescription;
|
||||
|
||||
const incomingCall: IncomingCall = {
|
||||
roomId: '!room:example.org',
|
||||
@@ -27,7 +29,7 @@ describe('evaluateIncomingCallFallback', () => {
|
||||
evaluateIncomingCallFallback({ ...incomingCall, expiresAt: NOW - 1 }, NOW, {
|
||||
myUserId: '@self:example.org',
|
||||
getRoom: () => null,
|
||||
getSessionDescription: () => ({}),
|
||||
getSessionDescription: () => EMPTY_SESSION,
|
||||
})
|
||||
).toEqual({ kind: 'clear', reason: 'expired' });
|
||||
});
|
||||
@@ -37,7 +39,7 @@ describe('evaluateIncomingCallFallback', () => {
|
||||
evaluateIncomingCallFallback(incomingCall, NOW, {
|
||||
myUserId: '@self:example.org',
|
||||
getRoom: () => ({ roomId: incomingCall.roomId }) as never,
|
||||
getSessionDescription: () => ({}),
|
||||
getSessionDescription: () => EMPTY_SESSION,
|
||||
isIncomingActive: () => false,
|
||||
})
|
||||
).toEqual({ kind: 'none' });
|
||||
@@ -50,7 +52,7 @@ describe('evaluateIncomingCallFallback', () => {
|
||||
{
|
||||
myUserId: '@self:example.org',
|
||||
getRoom: () => ({ roomId: incomingCall.roomId }) as never,
|
||||
getSessionDescription: () => ({}),
|
||||
getSessionDescription: () => EMPTY_SESSION,
|
||||
isIncomingActive: () => false,
|
||||
}
|
||||
);
|
||||
@@ -65,7 +67,7 @@ describe('evaluateOutgoingRingbackFallback', () => {
|
||||
outgoingRingbackAllowed: true,
|
||||
declinedRoomId: null,
|
||||
getRoom: () => ({ roomId: '!room:example.org' }) as never,
|
||||
getSessionDescription: () => ({}),
|
||||
getSessionDescription: () => EMPTY_SESSION,
|
||||
};
|
||||
|
||||
it('stops ringback when outgoing call is no longer pending', () => {
|
||||
|
||||
@@ -38,19 +38,19 @@ const defaultSettingValues: Record<string, unknown> = {
|
||||
|
||||
describe('CallSoundSettings', () => {
|
||||
beforeEach(() => {
|
||||
vi.mocked(useSetting).mockImplementation((_atom: unknown, key: string) => {
|
||||
return [defaultSettingValues[key], vi.fn<(value: unknown) => void>()] as const;
|
||||
});
|
||||
vi.mocked(useSetting).mockImplementation(((_atom: unknown, key: string) => {
|
||||
return [defaultSettingValues[key], vi.fn<() => void>()] as never;
|
||||
}) as never);
|
||||
});
|
||||
|
||||
it('falls back to default ringtone when custom ringtone is unavailable', async () => {
|
||||
const setCallRingtoneId = vi.fn<(value: unknown) => void>();
|
||||
vi.mocked(useSetting).mockImplementation((_atom: unknown, key: string) => {
|
||||
const setCallRingtoneId = vi.fn<() => void>();
|
||||
vi.mocked(useSetting).mockImplementation(((_atom: unknown, key: string) => {
|
||||
if (key === 'callRingtoneId') {
|
||||
return ['custom', setCallRingtoneId] as const;
|
||||
return ['custom', setCallRingtoneId] as never;
|
||||
}
|
||||
return [defaultSettingValues[key], vi.fn<(value: unknown) => void>()] as const;
|
||||
});
|
||||
return [defaultSettingValues[key], vi.fn<() => void>()] as never;
|
||||
}) as never);
|
||||
|
||||
render(<CallSoundSettings />);
|
||||
|
||||
|
||||
@@ -16,10 +16,52 @@ import { ElementCallIntent, ElementWidgetActions } from './types';
|
||||
import { CallControl } from './CallControl';
|
||||
import { CallControlState } from './CallControlState';
|
||||
import { createDebugLogger } from '../../utils/debugLogger';
|
||||
import { getInCallControlsContainer } from './elementCallDomAdapter';
|
||||
|
||||
const debugLog = createDebugLogger('CallEmbed');
|
||||
|
||||
const resolveCssVar = (variable: string): string => {
|
||||
const match = variable.match(/var\((--[^,)]+)/);
|
||||
if (match && match[1]) {
|
||||
const bodyVal = window.getComputedStyle(document.body).getPropertyValue(match[1]).trim();
|
||||
if (bodyVal) return bodyVal;
|
||||
const docElVal = window
|
||||
.getComputedStyle(document.documentElement)
|
||||
.getPropertyValue(match[1])
|
||||
.trim();
|
||||
if (docElVal) return docElVal;
|
||||
}
|
||||
return variable;
|
||||
};
|
||||
|
||||
const SABLE_THEME_TOKENS = {
|
||||
light: {
|
||||
'--sable-bg-container': '#ffffff',
|
||||
'--sable-surface-var-container': '#e4e4e7',
|
||||
'--sable-surface-var-container-hover': '#d4d4d8',
|
||||
'--sable-surface-var-container-active': '#a1a1aa',
|
||||
'--sable-surface-container': '#f4f4f5',
|
||||
'--sable-surface-container-line': '#d4d4d8',
|
||||
'--sable-surface-on-container': '#18181b',
|
||||
},
|
||||
dark: {
|
||||
'--sable-bg-container': '#1b1a21',
|
||||
'--sable-surface-var-container': '#121116',
|
||||
'--sable-surface-var-container-hover': '#1b1a21',
|
||||
'--sable-surface-var-container-active': '#24232c',
|
||||
'--sable-surface-container': '#24232c',
|
||||
'--sable-surface-container-line': '#403f4c',
|
||||
'--sable-surface-on-container': '#eae8f0',
|
||||
},
|
||||
} as const;
|
||||
|
||||
const resolveSableThemeToken = (variable: string, fallback: string): string => {
|
||||
const isDark =
|
||||
document.documentElement.className.includes('dark-theme') ||
|
||||
document.body.className.includes('dark-theme');
|
||||
const theme = isDark ? SABLE_THEME_TOKENS.dark : SABLE_THEME_TOKENS.light;
|
||||
return theme[variable as keyof typeof theme] || fallback;
|
||||
};
|
||||
|
||||
export class CallEmbed {
|
||||
private mx: MatrixClient;
|
||||
|
||||
@@ -278,10 +320,8 @@ export class CallEmbed {
|
||||
this.readUpToMap[room.roomId] = roomEvent.getId()!;
|
||||
});
|
||||
|
||||
// Attach listeners for feeding events - the underlying widget classes handle permissions for us.
|
||||
// Bind once and store via disposables so the same function reference is used for removal.
|
||||
// Using .bind(this) at call-site would create a new function every time, making .off() a no-op
|
||||
// and causing MaxListeners warnings when the embed is recreated during sync retries.
|
||||
// Bind handlers once and route removal through `disposables` so listeners can be
|
||||
// cleanly torn down when the embed is recreated.
|
||||
const boundOnEvent = this.onEvent.bind(this);
|
||||
const boundOnEventDecrypted = this.onEventDecrypted.bind(this);
|
||||
const boundOnStateUpdate = this.onStateUpdate.bind(this);
|
||||
@@ -352,56 +392,13 @@ export class CallEmbed {
|
||||
link.href = sheet.href;
|
||||
doc.head.append(link);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
// Ignore CORS errors
|
||||
}
|
||||
});
|
||||
};
|
||||
syncStyles();
|
||||
|
||||
const getVar = (variable: string) => {
|
||||
const match = variable.match(/var\((--[^,)]+)/);
|
||||
if (match && match[1]) {
|
||||
const bodyVal = window.getComputedStyle(document.body).getPropertyValue(match[1]).trim();
|
||||
if (bodyVal) return bodyVal;
|
||||
const docElVal = window
|
||||
.getComputedStyle(document.documentElement)
|
||||
.getPropertyValue(match[1])
|
||||
.trim();
|
||||
if (docElVal) return docElVal;
|
||||
}
|
||||
return variable;
|
||||
};
|
||||
|
||||
const getSableVar = (variable: string, fallback: string) => {
|
||||
const isDark =
|
||||
document.documentElement.className.includes('dark-theme') ||
|
||||
document.body.className.includes('dark-theme');
|
||||
|
||||
const lightTheme = {
|
||||
'--sable-bg-container': '#ffffff',
|
||||
'--sable-surface-var-container': '#e4e4e7',
|
||||
'--sable-surface-var-container-hover': '#d4d4d8',
|
||||
'--sable-surface-var-container-active': '#a1a1aa',
|
||||
'--sable-surface-container': '#f4f4f5',
|
||||
'--sable-surface-container-line': '#d4d4d8',
|
||||
'--sable-surface-on-container': '#18181b',
|
||||
};
|
||||
|
||||
const darkTheme = {
|
||||
'--sable-bg-container': '#1b1a21',
|
||||
'--sable-surface-var-container': '#121116',
|
||||
'--sable-surface-var-container-hover': '#1b1a21',
|
||||
'--sable-surface-var-container-active': '#24232c',
|
||||
'--sable-surface-container': '#24232c',
|
||||
'--sable-surface-container-line': '#403f4c',
|
||||
'--sable-surface-on-container': '#eae8f0',
|
||||
};
|
||||
|
||||
const theme = isDark ? darkTheme : lightTheme;
|
||||
return theme[variable as keyof typeof theme] || fallback;
|
||||
};
|
||||
|
||||
const updateInjectedCSS = () => {
|
||||
const styleId = 'sable-call-embed-styles';
|
||||
let styleEl = doc.getElementById(styleId);
|
||||
@@ -416,80 +413,80 @@ export class CallEmbed {
|
||||
styleEl.textContent = `
|
||||
:root {
|
||||
/* Backgrounds */
|
||||
--cpd-color-bg-canvas-default: ${getSableVar('--sable-bg-container', getVar(color.Background.Container))} !important;
|
||||
--cpd-color-bg-surface-default: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-canvas-default: ${resolveSableThemeToken('--sable-bg-container', resolveCssVar(color.Background.Container))} !important;
|
||||
--cpd-color-bg-surface-default: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
|
||||
/* Soft Fills for normal buttons */
|
||||
--cpd-color-bg-subtle-primary: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-subtle-secondary: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-action-secondary-rest: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-action-secondary-hovered: ${getSableVar('--sable-surface-var-container-hover', getVar(color.SurfaceVariant.ContainerHover))} !important;
|
||||
--cpd-color-bg-action-secondary-pressed: ${getSableVar('--sable-surface-var-container-active', getVar(color.SurfaceVariant.ContainerActive))} !important;
|
||||
--cpd-color-bg-subtle-primary: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-subtle-secondary: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-action-secondary-rest: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
--cpd-color-bg-action-secondary-hovered: ${resolveSableThemeToken('--sable-surface-var-container-hover', resolveCssVar(color.SurfaceVariant.ContainerHover))} !important;
|
||||
--cpd-color-bg-action-secondary-pressed: ${resolveSableThemeToken('--sable-surface-var-container-active', resolveCssVar(color.SurfaceVariant.ContainerActive))} !important;
|
||||
|
||||
/* Soft Fills for primary/active buttons */
|
||||
--cpd-color-bg-action-primary-rest: ${getVar(color.Primary.Container)} !important;
|
||||
--cpd-color-bg-action-primary-hovered: ${getVar(color.Primary.ContainerHover)} !important;
|
||||
--cpd-color-bg-action-primary-pressed: ${getVar(color.Primary.ContainerActive)} !important;
|
||||
--cpd-color-bg-action-primary-rest: ${resolveCssVar(color.Primary.Container)} !important;
|
||||
--cpd-color-bg-action-primary-hovered: ${resolveCssVar(color.Primary.ContainerHover)} !important;
|
||||
--cpd-color-bg-action-primary-pressed: ${resolveCssVar(color.Primary.ContainerActive)} !important;
|
||||
|
||||
/* Soft Fills for critical buttons (Hangup) */
|
||||
--cpd-color-bg-critical-primary: ${getVar(color.Critical.Container)} !important;
|
||||
--cpd-color-bg-critical-primary: ${resolveCssVar(color.Critical.Container)} !important;
|
||||
|
||||
/* Borders */
|
||||
--cpd-color-border-interactive-primary: ${getVar(color.Primary.Main)} !important;
|
||||
--cpd-color-border-interactive-secondary: ${getVar(color.Surface.ContainerLine)} !important;
|
||||
--cpd-color-border-focused: ${getVar(color.Primary.Main)} !important;
|
||||
--cpd-color-border-interactive-primary: ${resolveCssVar(color.Primary.Main)} !important;
|
||||
--cpd-color-border-interactive-secondary: ${resolveCssVar(color.Surface.ContainerLine)} !important;
|
||||
--cpd-color-border-focused: ${resolveCssVar(color.Primary.Main)} !important;
|
||||
|
||||
/* Typography and Icons */
|
||||
--cpd-font-family-sans: "Nunito Variable", sans-serif !important;
|
||||
--cpd-color-text-primary: ${getVar(color.Background.OnContainer)} !important;
|
||||
--cpd-color-text-secondary: ${getVar(color.Surface.OnContainer)} !important;
|
||||
--cpd-color-icon-primary: ${getVar(color.Background.OnContainer)} !important;
|
||||
--cpd-color-icon-secondary: ${getVar(color.Surface.OnContainer)} !important;
|
||||
--cpd-color-icon-tertiary: ${getVar(color.SurfaceVariant.OnContainer)} !important;
|
||||
--cpd-color-text-primary: ${resolveCssVar(color.Background.OnContainer)} !important;
|
||||
--cpd-color-text-secondary: ${resolveCssVar(color.Surface.OnContainer)} !important;
|
||||
--cpd-color-icon-primary: ${resolveCssVar(color.Background.OnContainer)} !important;
|
||||
--cpd-color-icon-secondary: ${resolveCssVar(color.Surface.OnContainer)} !important;
|
||||
--cpd-color-icon-tertiary: ${resolveCssVar(color.SurfaceVariant.OnContainer)} !important;
|
||||
|
||||
/* Icons/Text on Soft Fill Backgrounds */
|
||||
--cpd-color-icon-on-solid-primary: ${getVar(color.Primary.OnContainer)} !important;
|
||||
--cpd-color-text-on-solid-primary: ${getVar(color.Primary.OnContainer)} !important;
|
||||
--cpd-color-icon-critical-primary: ${getVar(color.Critical.OnContainer)} !important;
|
||||
--cpd-color-text-critical-primary: ${getVar(color.Critical.OnContainer)} !important;
|
||||
--cpd-color-icon-on-solid-primary: ${resolveCssVar(color.Primary.OnContainer)} !important;
|
||||
--cpd-color-text-on-solid-primary: ${resolveCssVar(color.Primary.OnContainer)} !important;
|
||||
--cpd-color-icon-critical-primary: ${resolveCssVar(color.Critical.OnContainer)} !important;
|
||||
--cpd-color-text-critical-primary: ${resolveCssVar(color.Critical.OnContainer)} !important;
|
||||
}
|
||||
|
||||
/* Enforce rounded rectangles instead of circles */
|
||||
[class*="button_"], [class*="Button_"], button {
|
||||
border-radius: ${getVar(config.radii.R400)} !important;
|
||||
border-radius: ${resolveCssVar(config.radii.R400)} !important;
|
||||
}
|
||||
|
||||
/* Completely dismantle Element Call's grouping pills to match Sable's discrete buttons */
|
||||
[data-testid="footer-container"] [class*="_container_"] {
|
||||
background-color: transparent !important;
|
||||
border: none !important;
|
||||
gap: ${getVar(config.space.S100)} !important;
|
||||
gap: ${resolveCssVar(config.space.S100)} !important;
|
||||
}
|
||||
|
||||
/* Ensure primary/muted buttons maintain a solid border by applying to both the element and its background overlays */
|
||||
[class*="button_"][data-kind="primary"], [class*="Button_"][data-kind="primary"], button[data-kind="primary"],
|
||||
[class*="button_"][data-kind="primary"]::before, [class*="Button_"][data-kind="primary"]::before, button[data-kind="primary"]::before,
|
||||
[class*="button_"][data-kind="primary"]::after, [class*="Button_"][data-kind="primary"]::after, button[data-kind="primary"]::after {
|
||||
border: 1px solid ${getVar(color.Primary.ContainerLine)} !important;
|
||||
border: 1px solid ${resolveCssVar(color.Primary.ContainerLine)} !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
[class*="button_"][data-kind="primary"][class*="_destructive_"],
|
||||
[class*="button_"][data-kind="primary"][class*="_destructive_"]::before,
|
||||
[class*="button_"][data-kind="primary"][class*="_destructive_"]::after {
|
||||
border: 1px solid ${getVar(color.Critical.ContainerLine)} !important;
|
||||
border: 1px solid ${resolveCssVar(color.Critical.ContainerLine)} !important;
|
||||
box-sizing: border-box !important;
|
||||
}
|
||||
|
||||
/* Fix secondary buttons inside the footer to have Sable's exact container styling */
|
||||
[data-testid="footer-container"] button[data-kind="secondary"],
|
||||
[data-testid="footer-container"] button[aria-haspopup="menu"] {
|
||||
background-color: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
border: 1px solid ${getSableVar('--sable-surface-var-container-line', getVar(color.Surface.ContainerLine))} !important;
|
||||
background-color: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
border: 1px solid ${resolveSableThemeToken('--sable-surface-var-container-line', resolveCssVar(color.Surface.ContainerLine))} !important;
|
||||
color: var(--cpd-color-icon-secondary) !important;
|
||||
}
|
||||
[data-testid="footer-container"] button[data-kind="secondary"]:hover,
|
||||
[data-testid="footer-container"] button[aria-haspopup="menu"]:hover {
|
||||
background-color: ${getSableVar('--sable-surface-var-container-hover', getVar(color.SurfaceVariant.ContainerHover))} !important;
|
||||
background-color: ${resolveSableThemeToken('--sable-surface-var-container-hover', resolveCssVar(color.SurfaceVariant.ContainerHover))} !important;
|
||||
}
|
||||
|
||||
[class*="button_"]::before, [class*="Button_"]::before, button::before,
|
||||
@@ -500,45 +497,45 @@ export class CallEmbed {
|
||||
}
|
||||
|
||||
.tile {
|
||||
border-radius: ${getVar(config.radii.R500)} !important;
|
||||
border-radius: ${resolveCssVar(config.radii.R500)} !important;
|
||||
}
|
||||
|
||||
.tile.speaking::before {
|
||||
background: ${getVar(color.Primary.Main)} !important;
|
||||
background: ${resolveCssVar(color.Primary.Main)} !important;
|
||||
opacity: 0.8 !important;
|
||||
}
|
||||
|
||||
/* Settings 3-dots button overrides */
|
||||
[data-testid="settings-bottom-left"] {
|
||||
--cpd-icon-button-size: 48px !important;
|
||||
background-color: ${getSableVar('--sable-surface-var-container', getVar(color.SurfaceVariant.Container))} !important;
|
||||
border-radius: ${getVar(config.radii.R400)} !important;
|
||||
background-color: ${resolveSableThemeToken('--sable-surface-var-container', resolveCssVar(color.SurfaceVariant.Container))} !important;
|
||||
border-radius: ${resolveCssVar(config.radii.R400)} !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Slider overrides */
|
||||
[role="slider"], [class*="handle"] {
|
||||
background-color: ${getVar(color.Primary.Main)} !important;
|
||||
box-shadow: 0 0 0 2px ${getVar(color.Surface.Container)} !important;
|
||||
background-color: ${resolveCssVar(color.Primary.Main)} !important;
|
||||
box-shadow: 0 0 0 2px ${resolveCssVar(color.Surface.Container)} !important;
|
||||
}
|
||||
[class*="highlight"] {
|
||||
background-color: ${getVar(color.Primary.Main)} !important;
|
||||
background-color: ${resolveCssVar(color.Primary.Main)} !important;
|
||||
}
|
||||
[class*="track"] {
|
||||
background-color: ${getVar(color.SurfaceVariant.ContainerHover)} !important;
|
||||
background-color: ${resolveCssVar(color.SurfaceVariant.ContainerHover)} !important;
|
||||
outline: none !important;
|
||||
}
|
||||
|
||||
/* Tooltips and Menus */
|
||||
[role="tooltip"], .cpd-tooltip, [data-radix-popper-content-wrapper] > div, div[class*="_tooltip_"] {
|
||||
background-color: ${getVar(color.Surface.Container)} !important;
|
||||
color: ${getVar(color.Surface.OnContainer)} !important;
|
||||
border: 1px solid ${getVar(color.Surface.ContainerLine)} !important;
|
||||
border-radius: ${getVar(config.radii.R400)} !important;
|
||||
padding: ${getVar(config.space.S200)} ${getVar(config.space.S300)} !important;
|
||||
font-size: ${getVar(config.fontSize.B300)} !important;
|
||||
box-shadow: 0 4px 6px ${getVar(color.Other.Shadow)} !important;
|
||||
background-color: ${resolveCssVar(color.Surface.Container)} !important;
|
||||
color: ${resolveCssVar(color.Surface.OnContainer)} !important;
|
||||
border: 1px solid ${resolveCssVar(color.Surface.ContainerLine)} !important;
|
||||
border-radius: ${resolveCssVar(config.radii.R400)} !important;
|
||||
padding: ${resolveCssVar(config.space.S200)} ${resolveCssVar(config.space.S300)} !important;
|
||||
font-size: ${resolveCssVar(config.fontSize.B300)} !important;
|
||||
box-shadow: 0 4px 6px ${resolveCssVar(color.Other.Shadow)} !important;
|
||||
}
|
||||
|
||||
/* Ensure tooltip text inside wrapper inherits correctly */
|
||||
|
||||
Reference in new issue
Block a user