π€― LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
π style(ui): bring remaining surfaces onto the compact density tokens (#23467)
Innei07cc80bdda84
diff --git a/src/components/InlineTable/index.tsx b/src/components/InlineTable/index.tsxindex 71881dc228f..a6b37c6066c 100644--- a/src/components/InlineTable/index.tsx+++ b/src/components/InlineTable/index.tsx@@ -21,6 +21,12 @@ const fallback = createStaticStyles(({ css, cssVar }) => ({font-size: 13px;}+ /* Compact rows: 4px + 23px line + 4px, in line with rowHeight 32. */+ html[data-density='compact'] & .lobe-table-small {+ --lobe-table-padding-block: 4px;+ --lobe-table-virtual-row-height: calc(4px * 2 + 23px);+ }+th {background: transparent;box-shadow: inset 0 999px 0 ${cssVar.colorFillQuaternary};diff --git a/src/components/ListSkeleton/index.tsx b/src/components/ListSkeleton/index.tsxindex f4b0a11d680..664d91ac1b1 100644--- a/src/components/ListSkeleton/index.tsx+++ b/src/components/ListSkeleton/index.tsx@@ -3,6 +3,8 @@import { Flexbox, Skeleton } from '@lobehub/ui';import { memo } from 'react';+import { useInterfaceDensity } from '@/styles/density';+interface ListSkeletonProps {/*** Inline padding of each placeholder row β match whatever the real row uses@@ -16,26 +18,32 @@ interface ListSkeletonProps {* Placeholder for a list of icon + title + subtitle rows (devices, credentials,* β¦). Skeletonises only the row text and leaves the surrounding card chrome to* the caller, so the list keeps its shape while the fetch is in flight.+ * Loose rows are 72px (12px padding, 48px tile); compact rows are 52px (8px+ * padding, 36px tile), matching a compact 6px-padded row with a 40px text stack.*/-const ListSkeleton = memo<ListSkeletonProps>(({ paddingInline = 12, rows = 4 }) => (- <Flexbox gap={2} width={'100%'}>- {Array.from({ length: rows }, (_, index) => (- <Flexbox- horizontal- align={'center'}- gap={16}- key={index}- style={{ paddingBlock: 12, paddingInline }}- >- <Skeleton.Avatar shape={'square'} size={48} />- <Flexbox flex={1} gap={8}>- <Skeleton height={14} width={140} />- <Skeleton height={12} width={200} />+const ListSkeleton = memo<ListSkeletonProps>(({ paddingInline = 12, rows = 4 }) => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Flexbox gap={2} width={'100%'}>+ {Array.from({ length: rows }, (_, index) => (+ <Flexbox+ horizontal+ align={'center'}+ gap={compact ? 12 : 16}+ key={index}+ style={{ paddingBlock: compact ? 8 : 12, paddingInline }}+ >+ <Skeleton.Avatar shape={'square'} size={compact ? 36 : 48} />+ <Flexbox flex={1} gap={8}>+ <Skeleton height={14} width={140} />+ <Skeleton height={12} width={200} />+ </Flexbox></Flexbox>- </Flexbox>- ))}- </Flexbox>-));+ ))}+ </Flexbox>+ );+});ListSkeleton.displayName = 'ListSkeleton';diff --git a/src/components/LiteTable/index.tsx b/src/components/LiteTable/index.tsxindex 79efd8e6c6b..88811e819e2 100644--- a/src/components/LiteTable/index.tsx+++ b/src/components/LiteTable/index.tsx@@ -4,6 +4,7 @@ import * as stylex from '@stylexjs/stylex';import { type ReactNode } from 'react';import { memo } from 'react';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';const styles = stylex.create({@@ -25,7 +26,8 @@ const styles = stylex.create({},cell: {'paddingBlockStart': {- 'default': '8px',+ // 8px loose, 6px compact: a single 20px text line fills the 32 / 36px row height.+ 'default': 'calc((var(--lobe-density-row-height) - 20px) / 2)','@container (max-width: 600px)': {'default': '6px',":is([data-list-slot='title'])": '8px',@@ -33,7 +35,7 @@ const styles = stylex.create({},},'paddingBlockEnd': {- 'default': '8px',+ 'default': 'calc((var(--lobe-density-row-height) - 20px) / 2)','@container (max-width: 600px)': {'default': '6px',":is([data-list-slot='title'])": '8px',@@ -135,8 +137,8 @@ const styles = stylex.create({},},heading: {- paddingBlockStart: '8px',- paddingBlockEnd: '8px',+ paddingBlockStart: 'calc((var(--lobe-density-row-height) - 20px) / 2)',+ paddingBlockEnd: 'calc((var(--lobe-density-row-height) - 20px) / 2)',paddingInlineStart: { 'default': '8px', ':first-child': '24px' },paddingInlineEnd: { 'default': '8px', ':last-child': '24px' },textAlign: 'start',@@ -179,7 +181,7 @@ const styles = stylex.create({},wideCell: {'paddingBlockStart': {- 'default': '8px',+ 'default': 'calc((var(--lobe-density-row-height) - 20px) / 2)','@container (max-width: 800px)': {'default': '6px',":is([data-list-slot='title'])": '8px',@@ -187,7 +189,7 @@ const styles = stylex.create({},},'paddingBlockEnd': {- 'default': '8px',+ 'default': 'calc((var(--lobe-density-row-height) - 20px) / 2)','@container (max-width: 800px)': {'default': '6px',":is([data-list-slot='title'])": '8px',@@ -289,8 +291,8 @@ const styles = stylex.create({},},wideHeading: {- paddingBlockStart: '8px',- paddingBlockEnd: '8px',+ paddingBlockStart: 'calc((var(--lobe-density-row-height) - 20px) / 2)',+ paddingBlockEnd: 'calc((var(--lobe-density-row-height) - 20px) / 2)',paddingInlineStart: { 'default': '8px', ':first-child': '24px' },paddingInlineEnd: { 'default': '8px', ':last-child': '24px' },textAlign: 'start',@@ -387,6 +389,7 @@ const LiteTableInner = <RecordType,>({const items = dataSource ?? [];const initialLoading = !!loading && items.length === 0;const wide = listBreakpoint === 800;+ const compact = useInterfaceDensity() === 'compact';const listLabelOf = (column: LiteTableColumn<RecordType>) =>column.listSlot || column.listLabel === false@@ -432,7 +435,15 @@ const LiteTableInner = <RecordType,>({data-list-slot={column.listSlot}key={column.key}>- <Skeleton style={{ height: 14, minWidth: 0, width: '100%' }} />+ <Skeleton+ style={{+ height: 14,+ // compact: 3 + 14 + 3 stands in for the 20px text line of a 32px row+ marginBlock: compact ? 3 : undefined,+ minWidth: 0,+ width: '100%',+ }}+ /></td>))}</tr>diff --git a/src/components/MemberSelectionModal/MemberSelectionModal.tsx b/src/components/MemberSelectionModal/MemberSelectionModal.tsxindex 955877a5074..166c45e1852 100644--- a/src/components/MemberSelectionModal/MemberSelectionModal.tsx+++ b/src/components/MemberSelectionModal/MemberSelectionModal.tsx@@ -31,6 +31,7 @@ import { useHomeStore } from '@/store/home';import { homeAgentListSelectors } from '@/store/home/selectors';import { useUserStore } from '@/store/user';import { authSelectors } from '@/store/user/selectors';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';const AvailableAgentItem = memo<{@@ -48,11 +49,17 @@ const AvailableAgentItem = memo<{const avatar = typeof agent.avatar === 'string' ? agent.avatar : undefined;const avatarBackground = agent.backgroundColor || undefined;+ const compact = useInterfaceDensity() === 'compact';+if (!_agentId) return null;return (- <div {...stylex.props(styles.listItem)} ref={ref} onClick={() => onToggle(_agentId)}>- <Flexbox horizontal align="center" gap={12} width="100%">+ <div+ {...stylex.props(styles.listItem, compact && styles.listItemCompact)}+ ref={ref}+ onClick={() => onToggle(_agentId)}+ >+ <Flexbox horizontal align="center" gap={compact ? 8 : 12} width="100%"><Checkboxchecked={isSelected}onChange={() => {@@ -70,11 +77,13 @@ const AvailableAgentItem = memo<{background={avatarBackground}name={title}shape={'circle'}- size={40}+ size={compact ? 28 : 40}/></Flexbox><Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>- <Text weight={500}>{title}</Text>+ <Text fontSize={compact ? 13 : undefined} weight={500}>+ {title}+ </Text>{description && (<Text ellipsis className={stylex.props(styles.description).className}>{description}@@ -142,6 +151,9 @@ const styles = stylex.create({backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },},+ listItemCompact: {+ padding: '6px',+ },modelSelectDisabled: { pointerEvents: 'none' },rightColumn: {overflowY: 'auto',@@ -196,6 +208,7 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(preSelectedAgents = [],}) => {const { t } = useTranslation(['chat', 'common']);+ const compact = useInterfaceDensity() === 'compact';const enabledModels = useEnabledChatModels();const [selectedAgents, setSelectedAgents] = useState<string[]>(preSelectedAgents);const [searchTerm, setSearchTerm] = useState('');@@ -312,7 +325,7 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(background={avatarBackground}name={title}shape="circle"- size={40}+ size={compact ? 28 : 40}/>),description,@@ -322,7 +335,7 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(};}).filter((item): item is NonNullable<typeof item> => item !== null);- }, [selectedAgents, agents, t, handleRemoveAgent]);+ }, [selectedAgents, agents, t, handleRemoveAgent, compact]);const handleReset = () => {setSelectedAgents(preSelectedAgents);@@ -449,7 +462,7 @@ const MemberSelectionModal = memo<MemberSelectionModalProps>(><Flexbox flex={1} gap={2}><Text- style={{ fontSize: 14, fontWeight: 500 }}+ style={{ fontSize: 'var(--lobe-density-font-size)', fontWeight: 500 }}type={isHostRemoved ? 'secondary' : undefined}>{t('groupWizard.host.title')}diff --git a/src/components/ModelSelect/index.tsx b/src/components/ModelSelect/index.tsxindex adf367a6f9e..06bb90afcf9 100644--- a/src/components/ModelSelect/index.tsx+++ b/src/components/ModelSelect/index.tsx@@ -24,6 +24,7 @@ import { useTranslation } from 'react-i18next';import { ProductLogo } from '@/components/Branding/ProductLogo';import { ModelIcon, ProviderIcon } from '@/components/LobeIcons';import { isCustomBranding } from '@/const/version';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import { type AiProviderSourceType } from '@/types/aiProvider';import { formatTokenNumber } from '@/utils/format';@@ -284,6 +285,8 @@ export const ModelItemRender = memo<ModelItemRenderProps>(style,}) => {const { mobile } = useResponsive();+ const compact = useInterfaceDensity() === 'compact';+ const { iconSize } = useDensityTokens();const displayNameOrId = displayName || id;return (@@ -291,7 +294,7 @@ export const ModelItemRender = memo<ModelItemRenderProps>(horizontalalign={'center'}className={className}- gap={32}+ gap={compact ? 16 : 32}justify={'space-between'}style={{overflow: 'hidden',@@ -306,7 +309,7 @@ export const ModelItemRender = memo<ModelItemRenderProps>(gap={8}style={{ flexShrink: 1, minWidth: 0, overflow: 'hidden' }}>- <ModelIcon model={id} size={20} />+ <ModelIcon model={id} size={compact ? iconSize : 20} /><Textstyle={mobile ? { maxWidth: '60vw' } : { minWidth: 0, overflow: 'hidden' }}ellipsis={{diff --git a/src/components/SettingCard/index.tsx b/src/components/SettingCard/index.tsxindex b90eddfa27f..8d8e13ff990 100644--- a/src/components/SettingCard/index.tsx+++ b/src/components/SettingCard/index.tsx@@ -5,6 +5,8 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { memo, type ReactNode } from 'react';+import { useInterfaceDensity } from '@/styles/density';+const styles = stylex.create({footer: {backgroundColor: cssVar.colorFillQuaternary,@@ -14,6 +16,11 @@ const styles = stylex.create({paddingBlock: 12,paddingInline: 20,},+ // Compact density: the footer follows the card body's 14px inset.+ footerCompact: {+ paddingBlock: 8,+ paddingInline: 14,+ },hint: {color: cssVar.colorTextSecondary,fontSize: 13,@@ -37,38 +44,42 @@ export interface SettingCardProps {* then a footer with a hint and the card's action.*/const SettingCard = memo<SettingCardProps>(- ({ title, description, children, extra, hint, action }) => (- <Block variant="outlined">- <Flexbox gap={12} padding={20}>- <Flexbox horizontal align="center" gap={16} justify="space-between">- <Flexbox gap={4}>- <Text strong as="h3" style={{ fontSize: 16, margin: 0 }}>- {title}- </Text>- {description && (- <Text style={{ fontSize: 13 }} type="secondary">- {description}+ ({ title, description, children, extra, hint, action }) => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Block variant="outlined">+ <Flexbox gap={compact ? 10 : 12} padding={compact ? 14 : 20}>+ <Flexbox horizontal align="center" gap={16} justify="space-between">+ <Flexbox gap={compact ? 2 : 4}>+ <Text strong as="h3" style={{ fontSize: compact ? 14 : 16, margin: 0 }}>+ {title}</Text>- )}+ {description && (+ <Text style={{ fontSize: compact ? 12 : 13 }} type="secondary">+ {description}+ </Text>+ )}+ </Flexbox>+ {extra}</Flexbox>- {extra}+ {children}</Flexbox>- {children}- </Flexbox>- {(hint || action) && (- <Flexbox- horizontal- align="center"- gap={12}- justify="space-between"- {...stylex.props(styles.footer)}- >- <span {...stylex.props(styles.hint)}>{hint ?? ''}</span>- {action}- </Flexbox>- )}- </Block>- ),+ {(hint || action) && (+ <Flexbox+ horizontal+ align="center"+ gap={12}+ justify="space-between"+ {...stylex.props(styles.footer, compact && styles.footerCompact)}+ >+ <span {...stylex.props(styles.hint)}>{hint ?? ''}</span>+ {action}+ </Flexbox>+ )}+ </Block>+ );+ },);SettingCard.displayName = 'SettingCard';diff --git a/src/components/Skeleton/AgentViewAll.tsx b/src/components/Skeleton/AgentViewAll.tsxindex 057e58a1977..efe74778b35 100644--- a/src/components/Skeleton/AgentViewAll.tsx+++ b/src/components/Skeleton/AgentViewAll.tsx@@ -8,7 +8,7 @@ import WideScreenContainer from '@/features/WideScreenContainer';import type { RouteSkeletonProps } from '@/spa/router/routeMeta';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors';-import { useDensityTokens } from '@/styles/density';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import SkeletonBar from './Bar';@@ -76,41 +76,53 @@ export const AgentViewAllSidebarSectionSkeleton = () => {/*** Dense `AgentRow`s of the list view (`agentListViewMode: 'list'`,- * `groupBy: 'none'`): padding 8/12, 28px square avatar, then the name / role /- * description columns, then the+ * `groupBy: 'none'`): padding 8/12 (compact 6/12), 28px (compact 24px) square+ * avatar, then the name / role / description columns, then the* right-aligned 88px update-time column and the 64px eye / "β¦" action column.* Also the page's own loading state while the agent list initialises.*/-export const AgentViewAllRowsSkeleton = ({ rows = 8 }: { rows?: number }) => (- <Flexbox aria-busy gap={2}>- {Array.from({ length: rows }).map((_, index) => (- <Flexbox horizontal align={'center'} gap={12} key={index} paddingBlock={8} paddingInline={12}>- <Flexbox horizontal align={'center'} flex={1} gap={12} style={{ minWidth: 0 }}>- <SkeletonBar height={28} width={28} />- <Flexbox flex={'0 1 auto'} style={{ minWidth: 0, width: NAME_COL_WIDTH }}>- <SkeletonBar height={14} width={`${50 + (index % 4) * 10}%`} />+export const AgentViewAllRowsSkeleton = ({ rows = 8 }: { rows?: number }) => {+ const compact = useInterfaceDensity() === 'compact';+ const avatarSize = compact ? 24 : 28;++ return (+ <Flexbox aria-busy gap={2}>+ {Array.from({ length: rows }).map((_, index) => (+ <Flexbox+ horizontal+ align={'center'}+ gap={12}+ key={index}+ paddingBlock={compact ? 6 : 8}+ paddingInline={12}+ >+ <Flexbox horizontal align={'center'} flex={1} gap={12} style={{ minWidth: 0 }}>+ <SkeletonBar height={avatarSize} width={avatarSize} />+ <Flexbox flex={'0 1 auto'} style={{ minWidth: 0, width: NAME_COL_WIDTH }}>+ <SkeletonBar height={14} width={`${50 + (index % 4) * 10}%`} />+ </Flexbox>+ <Flexbox flex={'0 1 auto'} style={{ minWidth: 0, width: ROLE_COL_WIDTH }}>+ <SkeletonBar height={12} width={`${40 + (index % 3) * 15}%`} />+ </Flexbox>+ <Flexbox flex={1} style={{ minWidth: 0 }}>+ <SkeletonBar height={12} width={`${30 + (index % 5) * 8}%`} />+ </Flexbox></Flexbox>- <Flexbox flex={'0 1 auto'} style={{ minWidth: 0, width: ROLE_COL_WIDTH }}>- <SkeletonBar height={12} width={`${40 + (index % 3) * 15}%`} />+ <Flexbox align={'flex-end'} flex={'none'} style={{ minWidth: 88 }}>+ <SkeletonBar height={12} width={56} /></Flexbox>- <Flexbox flex={1} style={{ minWidth: 0 }}>- <SkeletonBar height={12} width={`${30 + (index % 5) * 8}%`} />+ <Flexbox horizontal align={'center'} flex={'none'} gap={4} width={ACTION_COL_WIDTH}>+ {[0, 1].map((key) => (+ <Center height={24} key={key} width={24}>+ <SkeletonBar height={14} width={14} />+ </Center>+ ))}</Flexbox></Flexbox>- <Flexbox align={'flex-end'} flex={'none'} style={{ minWidth: 88 }}>- <SkeletonBar height={12} width={56} />- </Flexbox>- <Flexbox horizontal align={'center'} flex={'none'} gap={4} width={ACTION_COL_WIDTH}>- {[0, 1].map((key) => (- <Center height={24} key={key} width={24}>- <SkeletonBar height={14} width={14} />- </Center>- ))}- </Flexbox>- </Flexbox>- ))}- </Flexbox>-);+ ))}+ </Flexbox>+ );+};/*** Route-level skeleton for `/agents` (`features/AgentViewAll/AgentViewAllPage.tsx`):@@ -119,7 +131,7 @@ export const AgentViewAllRowsSkeleton = ({ rows = 8 }: { rows?: number }) => (* create button right) over list-view rows (also the loading state of the card view).*/const AgentViewAllSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => {- const { headerActionSmallSize, headerHeight } = useDensityTokens();+ const { controlHeight, headerActionSmallSize, headerHeight } = useDensityTokens();return (<Flexbox aria-busy flex={1} height={'100%'} style={{ minHeight: 0, overflow: 'hidden' }}>@@ -144,8 +156,8 @@ const AgentViewAllSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => {<WideScreenContainer fullWidth gap={16} paddingBlock={16} paddingInline={16}><AgentViewAllSidebarSectionSkeleton /><Flexbox horizontal align={'center'} gap={12} justify={'space-between'}>- <SkeletonBar height={32} width={206} />- <SkeletonBar height={32} width={64} />+ <SkeletonBar height={controlHeight} width={206} />+ <SkeletonBar height={controlHeight} width={64} /></Flexbox><AgentViewAllRowsSkeleton /></WideScreenContainer>diff --git a/src/components/Skeleton/Goal.tsx b/src/components/Skeleton/Goal.tsxindex fa9cbe61fbf..76de11cc5c7 100644--- a/src/components/Skeleton/Goal.tsx+++ b/src/components/Skeleton/Goal.tsx@@ -7,6 +7,7 @@ import * as stylex from '@stylexjs/stylex';import NavHeader from '@/features/NavHeader';import WideScreenContainer from '@/features/WideScreenContainer';import type { RouteSkeletonProps } from '@/spa/router/routeMeta';+import { useInterfaceDensity } from '@/styles/density';import SkeletonBar from './Bar';@@ -23,22 +24,28 @@ const styles = stylex.create({/*** The three row shapes a goal list settles into. Exported so a list that is* re-reading one of its tabs can hold the same shape instead of collapsing to- * blank while the server answers.+ * blank while the server answers. Compact rows (6px padding, 14px title over a+ * 12px requirement) settle at ~57px, so the skeleton pads 11px around its 35px+ * bar stack.*/-export const GoalListRowsSkeleton = () => (- <Flexbox aria-busy className={stylex.props(styles.listRows).className}>- {Array.from({ length: 3 }).map((_, index) => (- <Flexbox horizontal align={'center'} gap={12} key={index} paddingBlock={14}>- <SkeletonBar height={20} radius={'50%'} width={20} />- <Flexbox flex={1} gap={7}>- <SkeletonBar height={16} width={`${36 + index * 8}%`} />- <SkeletonBar height={12} width={`${54 + index * 6}%`} />+export const GoalListRowsSkeleton = () => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Flexbox aria-busy className={stylex.props(styles.listRows).className}>+ {Array.from({ length: 3 }).map((_, index) => (+ <Flexbox horizontal align={'center'} gap={12} key={index} paddingBlock={compact ? 11 : 14}>+ <SkeletonBar height={20} radius={'50%'} width={20} />+ <Flexbox flex={1} gap={7}>+ <SkeletonBar height={16} width={`${36 + index * 8}%`} />+ <SkeletonBar height={12} width={`${54 + index * 6}%`} />+ </Flexbox>+ <SkeletonBar height={24} width={72} /></Flexbox>- <SkeletonBar height={24} width={72} />- </Flexbox>- ))}- </Flexbox>-);+ ))}+ </Flexbox>+ );+};const GoalSkeleton = ({ chrome = 'page' }: RouteSkeletonProps) => (<Flexbox aria-busy flex={1} height={'100%'}>diff --git a/src/components/Skeleton/Settings/Section.tsx b/src/components/Skeleton/Settings/Section.tsxindex 0e620f4058e..69a9dd9e7d1 100644--- a/src/components/Skeleton/Settings/Section.tsx+++ b/src/components/Skeleton/Settings/Section.tsx@@ -7,6 +7,7 @@ import * as stylex from '@stylexjs/stylex';import { type ReactNode } from 'react';import { FORM_STYLE } from '@/const/layoutTokens';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import SkeletonBar from '../Bar';import { sectionGroupStyles } from './sectionGroupStyles';@@ -26,6 +27,11 @@ const styles = stylex.create({minHeight: '64px',paddingBlock: '16px',},+ // Compact forms drop `--lobe-form-item-padding-block` to 10px around a 28px control.+ rowCompact: {+ minHeight: '48px',+ paddingBlock: '10px',+ },});export interface SettingsSectionSkeletonControl {@@ -43,29 +49,34 @@ const Row = ({index: number;label?: ReactNode;withDesc: boolean;-}) => (- <div {...stylex.props(styles.row)}>- {/* Line boxes match the loaded label (14px / 22px) and description (12px / 13px) stack. */}- <Flexbox gap={4}>- <Flexbox height={22} justify={'center'}>- {label ?? <SkeletonBar height={16} width={112 + (index % 2) * 40} />}- </Flexbox>- {withDesc && (- <Flexbox height={13} justify={'center'}>- <SkeletonBar height={12} width={224 + (index % 3) * 36} />+}) => {+ const compact = useInterfaceDensity() === 'compact';+ const { controlHeight } = useDensityTokens();++ return (+ <div {...stylex.props(styles.row, compact && styles.rowCompact)}>+ {/* Line boxes match the loaded label (14px / 22px) and description (12px / 13px) stack. */}+ <Flexbox gap={4}>+ <Flexbox height={22} justify={'center'}>+ {label ?? <SkeletonBar height={16} width={112 + (index % 2) * 40} />}</Flexbox>- )}- </Flexbox>- <SkeletonBar- height={control?.height ?? 32}- radius={control ? cssVar.borderRadiusLG : undefined}- width={control?.width ?? (index % 2 ? 152 : 88)}- />- </div>-);+ {withDesc && (+ <Flexbox height={13} justify={'center'}>+ <SkeletonBar height={12} width={224 + (index % 3) * 36} />+ </Flexbox>+ )}+ </Flexbox>+ <SkeletonBar+ height={control?.height ?? controlHeight}+ radius={control ? cssVar.borderRadiusLG : undefined}+ width={control?.width ?? (index % 2 ? 152 : 88)}+ />+ </div>+ );+};export interface SettingsSectionSkeletonGroup {- /** Control size for every row without an entry in `controls` (default 32px tall). */+ /** Control size for rows without a `controls` entry (default: control height, 32 / 28px). */control?: SettingsSectionSkeletonControl;/*** Control size overrides keyed by row index, for fields taller than a 32px input@@ -149,7 +160,8 @@ const Group = ({export interface SettingsSectionSkeletonProps {/*** Gap between groups. Groups of one `<Form itemsType="group">` sit 16px apart;- * separate forms stacked in the settings container sit 36px apart.+ * separate forms stacked in the settings container sit 36px (compact 24px) apart,+ * the default.*/gap?: number;/** One entry per `Form.Group` in the loaded form. Defaults to a 2-row + 3-row pair. */@@ -162,20 +174,24 @@ export interface SettingsSectionSkeletonProps {* per field, so the real form swaps in without relayout.*/const SettingsSectionSkeleton = ({- gap = 36,+ gap,groups = DEFAULT_GROUPS,-}: SettingsSectionSkeletonProps) => (- <Flexbox aria-busy data-testid={'settings-section-skeleton'} gap={gap}>- {groups.map((group, index) => (- <Group key={index} {...group} />- ))}- </Flexbox>-);+}: SettingsSectionSkeletonProps) => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Flexbox aria-busy data-testid={'settings-section-skeleton'} gap={gap ?? (compact ? 24 : 36)}>+ {groups.map((group, index) => (+ <Group key={index} {...group} />+ ))}+ </Flexbox>+ );+};export default SettingsSectionSkeleton;export interface SettingsFormSkeletonItem {- /** Placeholder for the field's control; defaults to a 32px input filling the control column. */+ /** Placeholder for the field's control; defaults to a control-height bar filling the column. */control?: { height: number; radius?: number | string; width?: number | string } | ReactNode;/** The field's real description (static copy). */desc?: ReactNode;@@ -210,12 +226,13 @@ const isControlSize = (*/export const SettingsFormSkeleton = ({ groups }: { groups: SettingsFormSkeletonGroup[] }) => {const form = useForm();+ const { controlHeight } = useDensityTokens();const items: FormGroupItem[] = groups.map((group) => ({children: group.items.map(({ control, desc, label, layout, ...rest }) => ({children: isControlSize(control) ? (<SkeletonBar height={control.height} radius={control.radius} width={control.width} />) : (- (control ?? <SkeletonBar height={32} />)+ (control ?? <SkeletonBar height={controlHeight} />)),desc,label,diff --git a/src/components/Skeleton/Settings/Sections.tsx b/src/components/Skeleton/Settings/Sections.tsxindex 954ed40c9b5..344a164044e 100644--- a/src/components/Skeleton/Settings/Sections.tsx+++ b/src/components/Skeleton/Settings/Sections.tsx@@ -14,6 +14,7 @@ import { useTranslation } from 'react-i18next';import NavHeader from '@/features/NavHeader';import SettingContainer from '@/features/Setting/SettingContainer';import type { RouteSkeletonProps } from '@/spa/router/routeMeta';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';import SkeletonBar from '../Bar';@@ -785,23 +786,35 @@ const PageTabs = ({ count }: { count: number }) => (</Flexbox>);-/** Large page title + divider, matching a settings page that renders its own heading. */-const PageTitle = () => (- <Flexbox gap={24} style={{ paddingTop: 12 }}>- <Flexbox height={38} justify={'center'}>- <SkeletonBar height={28} width={96} />+/**+ * Large page title + divider, matching `SettingHeader`: a 24px title (38px line,+ * compact 20px / 31px) 24px (compact 16px) above the divider.+ */+const PageTitle = () => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Flexbox gap={compact ? 16 : 24} style={{ paddingTop: 12 }}>+ <Flexbox height={compact ? 31 : 38} justify={'center'}>+ <SkeletonBar height={compact ? 24 : 28} width={96} />+ </Flexbox>+ <div {...stylex.props(styles.divider)} /></Flexbox>- <div {...stylex.props(styles.divider)} />- </Flexbox>-);+ );+};/*** The sections of a settings page without any surrounding chrome. Use it* directly where a layout already draws the header and padded container.*/export const SettingsSectionsBody = ({ shape }: { shape: SettingsSectionsShape }) => {+ const compact = useInterfaceDensity() === 'compact';const sections = (- <Flexbox aria-busy data-testid={'settings-sections-skeleton'} gap={shape.gap ?? 36}>+ <Flexbox+ aria-busy+ data-testid={'settings-sections-skeleton'}+ gap={shape.gap ?? (compact ? 24 : 36)}+ >{shape.title && <PageTitle />}{shape.sections.map((section, index) => (<Section key={index} section={section} />diff --git a/src/components/Skeleton/Settings/tabs/Creds.tsx b/src/components/Skeleton/Settings/tabs/Creds.tsxindex b7ff096ec33..0fa529f476a 100644--- a/src/components/Skeleton/Settings/tabs/Creds.tsx+++ b/src/components/Skeleton/Settings/tabs/Creds.tsx@@ -2,6 +2,8 @@import { cssVar, Flexbox } from '@lobehub/ui';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';+import SkeletonBar from '../../Bar';import type { SettingsTabSkeleton } from './types';@@ -17,37 +19,47 @@ const ROW_WIDTHS = [* tile, a name + type-tag line over a key line, and the "..." menu button. Rows* sit edge to edge (gap 0), like the settled list.*/-export const CredsListSkeleton = ({ rows = 4 }: { rows?: number }) => (- <Flexbox aria-busy data-testid={'settings-creds-skeleton'} gap={0} width={'100%'}>- {Array.from({ length: rows }, (_, index) => {- const [title, key] = ROW_WIDTHS[index % ROW_WIDTHS.length];- return (- <Flexbox- horizontal- align={'center'}- gap={16}- justify={'space-between'}- key={index}- style={{ paddingBlock: 12 }}- >- <Flexbox horizontal align={'center'} flex={1} gap={16}>- <SkeletonBar height={48} radius={12} width={48} />- <Flexbox gap={4}>- <Flexbox horizontal align={'center'} gap={8} height={22}>- <SkeletonBar height={15} width={title} />- <SkeletonBar height={22} radius={cssVar.borderRadiusSM} width={52} />- </Flexbox>- <Flexbox height={18} justify={'center'}>- <SkeletonBar height={12} width={key} />+export const CredsListSkeleton = ({ rows = 4 }: { rows?: number }) => {+ // Compact `CredItem`: 6px padding, 36px tile, 22px title line + 2 + 18px key line = 54px.+ const compact = useInterfaceDensity() === 'compact';+ const { controlHeight } = useDensityTokens();++ return (+ <Flexbox aria-busy data-testid={'settings-creds-skeleton'} gap={0} width={'100%'}>+ {Array.from({ length: rows }, (_, index) => {+ const [title, key] = ROW_WIDTHS[index % ROW_WIDTHS.length];+ return (+ <Flexbox+ horizontal+ align={'center'}+ gap={compact ? 12 : 16}+ justify={'space-between'}+ key={index}+ style={{ paddingBlock: compact ? 6 : 12 }}+ >+ <Flexbox horizontal align={'center'} flex={1} gap={compact ? 12 : 16}>+ <SkeletonBar+ height={compact ? 36 : 48}+ radius={compact ? 10 : 12}+ width={compact ? 36 : 48}+ />+ <Flexbox gap={compact ? 2 : 4}>+ <Flexbox horizontal align={'center'} gap={8} height={22}>+ <SkeletonBar height={compact ? 14 : 15} width={title} />+ <SkeletonBar height={22} radius={cssVar.borderRadiusSM} width={52} />+ </Flexbox>+ <Flexbox height={18} justify={'center'}>+ <SkeletonBar height={12} width={key} />+ </Flexbox></Flexbox></Flexbox>+ <SkeletonBar height={controlHeight} width={controlHeight} /></Flexbox>- <SkeletonBar height={32} width={32} />- </Flexbox>- );- })}- </Flexbox>-);+ );+ })}+ </Flexbox>+ );+};/** The small primary "Create" button the page portals into the header. */const PageActions = () => <SkeletonBar height={32} width={96} />;diff --git a/src/components/Skeleton/Settings/tabs/Labels.tsx b/src/components/Skeleton/Settings/tabs/Labels.tsxindex 90c80871b43..7bce80f2085 100644--- a/src/components/Skeleton/Settings/tabs/Labels.tsx+++ b/src/components/Skeleton/Settings/tabs/Labels.tsx@@ -3,6 +3,7 @@import { Flexbox, Tabs, Text } from '@lobehub/ui';import { LABEL_COLUMN_WIDTHS } from '@/features/WorkspaceSetting/Labels/constants';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import SkeletonBar from '../../Bar';import { useSkeletonText } from '../useSkeletonText';@@ -12,11 +13,12 @@ const ROWS = 4;/*** The label table while the registry loads: the static column header, then- * 42px rows (color dot + name, description, usage, created date, menu) on the- * same column widths as the loaded rows.+ * 42px (compact 36px) rows (color dot + name, description, usage, created date,+ * menu) on the same column widths as the loaded rows.*/export const LabelsListSkeleton = () => {const text = useSkeletonText('setting');+ const compact = useInterfaceDensity() === 'compact';const head = (key: string, width: number) =>text(`workspaceSetting.labels.columns.${key}`, width, 12);@@ -50,7 +52,14 @@ export const LabelsListSkeleton = () => {<span style={{ flex: 'none', width: LABEL_COLUMN_WIDTHS.action }} /></Flexbox>{Array.from({ length: ROWS }, (_, index) => (- <Flexbox horizontal align={'center'} gap={12} height={42} key={index} paddingInline={12}>+ <Flexbox+ horizontal+ align={'center'}+ gap={12}+ height={compact ? 36 : 42}+ key={index}+ paddingInline={12}+ ><Flexboxhorizontalalign={'center'}@@ -83,6 +92,7 @@ export const LabelsListSkeleton = () => {*/const Body = () => {const text = useSkeletonText('setting');+ const { controlHeight, radius } = useDensityTokens();return (<Flexbox gap={16}>@@ -95,10 +105,10 @@ const Body = () => {/><Flexbox horizontal align={'center'} gap={12} justify={'space-between'}><Flexbox horizontal align={'center'} gap={8}>- <SkeletonBar height={32} radius={8} width={200} />- <SkeletonBar height={32} radius={8} width={76} />+ <SkeletonBar height={controlHeight} radius={radius} width={200} />+ <SkeletonBar height={controlHeight} radius={radius} width={76} /></Flexbox>- <SkeletonBar height={32} radius={8} width={104} />+ <SkeletonBar height={controlHeight} radius={radius} width={104} /></Flexbox><LabelsListSkeleton /></Flexbox>diff --git a/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsxindex 7044cf91668..24d86783658 100644--- a/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx+++ b/src/components/Skeleton/Settings/tabs/SkillCatalog.tsx@@ -6,6 +6,7 @@ import * as stylex from '@stylexjs/stylex';import { useTranslation } from 'react-i18next';import NavHeader from '@/features/NavHeader';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import SkeletonBar from '../../Bar';@@ -25,6 +26,9 @@ interface SkillCatalogProps {/** The shared catalog header and two-column rows used by skills and connectors. */export const SkillCatalogListSkeleton = ({ viewMode }: SkillCatalogProps) => {const { t } = useTranslation('setting');+ // Compact `SkillListRow` page rows: 6px padding, 32px tile, 20 + 2 + 18px text β 52px.+ const compact = useInterfaceDensity() === 'compact';+ const { controlHeight } = useDensityTokens();const skills = viewMode === 'skill';const sections = skills? (['skillGroup.builtinSkills', 'skillGroup.communitySkills'] as const)@@ -49,8 +53,8 @@ export const SkillCatalogListSkeleton = ({ viewMode }: SkillCatalogProps) => {</Text></Flexbox><Flexbox horizontal align={'center'} gap={8}>- <SkeletonBar height={32} width={240} />- <SkeletonBar height={32} width={80} />+ <SkeletonBar height={controlHeight} width={240} />+ <SkeletonBar height={controlHeight} width={80} /></Flexbox></Flexbox><Flexbox gap={40} paddingBlock={24}>@@ -69,16 +73,20 @@ export const SkillCatalogListSkeleton = ({ viewMode }: SkillCatalogProps) => {align={'center'}gap={12}key={index}- paddingBlock={12}+ paddingBlock={compact ? 6 : 12}paddingInline={12}- style={{ minHeight: 64, minWidth: 0 }}+ style={{ minHeight: compact ? 48 : 64, minWidth: 0 }}>- <SkeletonBar height={40} radius={cssVar.borderRadiusLG} width={40} />+ <SkeletonBar+ height={compact ? 32 : 40}+ radius={cssVar.borderRadiusLG}+ width={compact ? 32 : 40}+ /><Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>- <Flexbox height={22} justify={'center'}>+ <Flexbox height={compact ? 20 : 22} justify={'center'}><SkeletonBar height={14} width={96 + (index % 3) * 32} /></Flexbox>- <Flexbox height={20} justify={'center'}>+ <Flexbox height={compact ? 18 : 20} justify={'center'}><SkeletonBar height={12} width={`${64 + (index % 2) * 16}%`} /></Flexbox></Flexbox>diff --git a/src/components/Skeleton/Settings/tabs/Stats.tsx b/src/components/Skeleton/Settings/tabs/Stats.tsxindex d53751a9f1d..5d913fdb5e0 100644--- a/src/components/Skeleton/Settings/tabs/Stats.tsx+++ b/src/components/Skeleton/Settings/tabs/Stats.tsx@@ -4,6 +4,8 @@ import { cssVar, Divider, Flexbox } from '@lobehub/ui';import { Form } from '@lobehub/ui/form';import type { ReactNode } from 'react';+import { useInterfaceDensity } from '@/styles/density';+import SkeletonBar from '../../Bar';import { useSkeletonText } from '../useSkeletonText';import type { SettingsTabSkeleton } from './types';@@ -39,14 +41,15 @@ const Rank = ({ title }: { title: ReactNode }) => (/*** The stats tab: the overview group (figures, activity heatmap, rankings) and- * the usage group (spend cards, trend chart, table), 36px apart like the two+ * the usage group (spend cards, trend chart, table), 36px (compact 24px) apart like the two* settled `Form.Group`s. Group and section titles are static copy.*/const Body = () => {const text = useSkeletonText('auth');+ const compact = useInterfaceDensity() === 'compact';return (- <Flexbox aria-busy gap={36}>+ <Flexbox aria-busy gap={compact ? 24 : 36}><Form.Groupcollapsible={false}extra={<SkeletonBar height={32} width={32} />}diff --git a/src/components/Skeleton/SkeletonInput.tsx b/src/components/Skeleton/SkeletonInput.tsxindex 8c992a65007..60a8f1b4d9e 100644--- a/src/components/Skeleton/SkeletonInput.tsx+++ b/src/components/Skeleton/SkeletonInput.tsx@@ -2,4 +2,10 @@import { Skeleton } from '@lobehub/ui';-export const SkeletonInput = () => <Skeleton height={36} />;+import { useInterfaceDensity } from '@/styles/density';++export const SkeletonInput = () => {+ const compact = useInterfaceDensity() === 'compact';++ return <Skeleton height={compact ? 28 : 36} />;+};diff --git a/src/components/TablePagination/index.tsx b/src/components/TablePagination/index.tsxindex b7e680cc7bb..9d90c8db768 100644--- a/src/components/TablePagination/index.tsx+++ b/src/components/TablePagination/index.tsx@@ -7,6 +7,7 @@ import { ChevronLeft, ChevronRight } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';import { formatIntergerNumber } from '@/utils/format';@@ -29,6 +30,9 @@ const styles = stylex.create({borderBlockStartStyle: 'solid',borderBlockStartColor: cssVar.colorBorderSecondary,},+ rootCompact: {+ paddingBlock: '6px',+ },total: {fontSize: '13px',fontVariantNumeric: 'tabular-nums',@@ -84,6 +88,7 @@ const TablePagination = memo<TablePaginationProps>(total,}) => {const { t } = useTranslation('spend');+ const compact = useInterfaceDensity() === 'compact';const totalPages = Math.max(1, Math.ceil(total / pageSize));const page = Math.min(current, totalPages);@@ -101,7 +106,7 @@ const TablePagination = memo<TablePaginationProps>(align={'center'}gap={12}justify={'space-between'}- {...sx(styles.root, className)}+ {...sx(styles.root, compact && styles.rootCompact, className)}><span {...stylex.props(styles.total)}>{t('table.pagination.range', {diff --git a/src/features/AddAgentMemberModal/AgentItem.tsx b/src/features/AddAgentMemberModal/AgentItem.tsxindex 8f39657213d..fda1d04b547 100644--- a/src/features/AddAgentMemberModal/AgentItem.tsx+++ b/src/features/AddAgentMemberModal/AgentItem.tsx@@ -9,6 +9,7 @@ import { X } from 'lucide-react';import { memo, useRef } from 'react';import AgentAvatar from '@/components/AgentAvatar';+import { sidebarRow } from '@/styles/density.stylex';import { useAgentSelectionStore } from './store';@@ -36,7 +37,13 @@ const styles = stylex.create({backgroundColor: { 'default': null, ':hover': cssVar.colorFillSecondary },backgroundImage: { 'default': null, ':hover': 'none' },},- title: { overflow: 'hidden', flex: '1', textOverflow: 'ellipsis', whiteSpace: 'nowrap' },+ title: {+ overflow: 'hidden',+ flex: '1',+ fontSize: sidebarRow.textFontSize,+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap',+ },});export interface AgentItemData {diff --git a/src/features/AgentGoals/GoalListItem.tsx b/src/features/AgentGoals/GoalListItem.tsxindex 47e28229965..97ae63acf23 100644--- a/src/features/AgentGoals/GoalListItem.tsx+++ b/src/features/AgentGoals/GoalListItem.tsx@@ -6,7 +6,7 @@ import { memo } from 'react';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { useActiveRouteParams } from '@/hooks/useActiveRouteParams';-import { useDensityTokens } from '@/styles/density';+import { DENSITY_TOKENS, useInterfaceDensity } from '@/styles/density';import GoalAgentLabel from './GoalAgentLabel';import GoalArchivedMark from './GoalArchivedMark';@@ -50,7 +50,8 @@ const styles = createStaticStyles(({ css }) => ({}));export const GoalListItem = memo<GoalItemProps>(({ globalScopeId, goal: item, projectId }) => {- const { listRowHeight } = useDensityTokens();+ const density = useInterfaceDensity();+ const { listRowHeight } = DENSITY_TOKENS[density];const navigate = useWorkspaceAwareNavigate();const { aid } = useActiveRouteParams<{ aid?: string }>();const { goal } = item;@@ -94,7 +95,7 @@ export const GoalListItem = memo<GoalItemProps>(({ globalScopeId, goal: item, pr<Flexbox className={styles.title} gap={4}><Flexbox horizontal align={'center'} gap={7}><GoalStatusGlyph size={13} status={goal.status} />- <Text ellipsis fontSize={15} weight={600}>+ <Text ellipsis fontSize={density === 'compact' ? 14 : 15} weight={600}>{goal.title}</Text><GoalPrivateMark goal={goal} />diff --git a/src/features/AgentSetting/SettingsModalLayout.tsx b/src/features/AgentSetting/SettingsModalLayout.tsxindex 562c4b3af5c..c16aff06571 100644--- a/src/features/AgentSetting/SettingsModalLayout.tsx+++ b/src/features/AgentSetting/SettingsModalLayout.tsx@@ -8,6 +8,7 @@ import { memo, type ReactNode } from 'react';import { useTranslation } from 'react-i18next';import AgentAvatar from '@/components/AgentAvatar';+import { useHeaderActionSize, useInterfaceDensity } from '@/styles/density';export interface SettingsModalTabItem {icon?: LucideIcon;@@ -36,6 +37,10 @@ const styles = stylex.create({borderBlockEndStyle: 'solid',borderBlockEndColor: cssVar.colorBorderSecondary,},+ // 6px + the 28px close button = the 40px compact header height.+ headerCompact: {+ paddingBlock: '6px',+ },tabsBar: {flexShrink: 0,paddingInline: '12px',@@ -49,6 +54,9 @@ const SettingsModalLayout = memo<SettingsModalLayoutProps>(({ agentId, avatar, background, title, tabs, activeTab, onTabChange, children }) => {const { t } = useTranslation('common');const { close } = useModalContext();+ const compact = useInterfaceDensity() === 'compact';+ // Loose keeps the ActionIcon default; compact takes the 28px header action.+ const headerActionSize = useHeaderActionSize();const tabItems = tabs?.map(({ icon, key, label }) => ({icon: icon ? <Icon icon={icon} size={16} /> : undefined,@@ -61,7 +69,7 @@ const SettingsModalLayout = memo<SettingsModalLayoutProps>(<Flexboxhorizontalalign={'center'}- className={stylex.props(styles.header).className}+ className={stylex.props(styles.header, compact && styles.headerCompact).className}justify={'space-between'}><Flexbox horizontal align={'center'} gap={8} style={{ minWidth: 0 }}>@@ -86,7 +94,12 @@ const SettingsModalLayout = memo<SettingsModalLayoutProps>({title}</Text></Flexbox>- <ActionIcon icon={XIcon} title={t('cancel')} onClick={close} />+ <ActionIcon+ icon={XIcon}+ size={compact ? headerActionSize : undefined}+ title={t('cancel')}+ onClick={close}+ /></Flexbox>{tabItems && tabItems.length >= 2 && (diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsxindex 6abef8193cc..3faeaf46b2f 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByAgentMode/GroupItem.test.tsx@@ -94,6 +94,7 @@ vi.mock('@/store/user', () => ({}));vi.mock('@/store/user/selectors', () => ({preferenceSelectors: { topicSortBy: () => 'updatedAt' },+ userGeneralSettingsSelectors: { interfaceDensity: () => 'loose' },}));vi.mock('@/store/chat', () => ({diff --git a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsxindex 3f634e9a006..f21693f7dd3 100644--- a/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx+++ b/src/features/AgentSidebar/Topic/TopicListContent/ByProjectMode/GroupItem.test.tsx@@ -170,6 +170,7 @@ vi.mock('@/store/user', () => ({}));vi.mock('@/store/user/selectors', () => ({preferenceSelectors: { topicSortBy: () => 'updatedAt' },+ userGeneralSettingsSelectors: { interfaceDensity: () => 'loose' },userProfileSelectors: { userId: () => 'user-1' },}));diff --git a/src/features/AgentViewAll/AgentRow.tsx b/src/features/AgentViewAll/AgentRow.tsxindex 389a65645c3..19b2d633f11 100644--- a/src/features/AgentViewAll/AgentRow.tsx+++ b/src/features/AgentViewAll/AgentRow.tsx@@ -21,6 +21,7 @@ import { memo, type MouseEvent, useCallback, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import WorkspaceLink from '@/features/Workspace/WorkspaceLink';+import { useInterfaceDensity } from '@/styles/density';import ItemActions from './ItemActions';import LabelTags from './LabelTags';@@ -103,6 +104,11 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillTertiary};}`,+ /** Compact density: 6px block padding + 24px avatar β 36px rows, 13px text. */+ rowCompact: css`+ padding-block: 6px;+ font-size: 13px;+ `,/*** Reserved width, right-aligned: "3 倩ε" and "2026-07-22" differ by ~30px,* and a content-sized column puts the author avatar and the label pills at a@@ -155,6 +161,7 @@ const AgentRow = memo<AgentRowProps>(const displayTitle = agentDisplayName(item, t('agentViewAll.untitled'));const role = agentSecondaryDisplayName(item);const [anchor, setAnchor] = useState<HTMLElement | null>(null);+ const compact = useInterfaceDensity() === 'compact';// Right-click support (Task-List-style): the hook-bearing menu mounts on// the ROW's pointer-enter (which always precedes a right-click) and hands@@ -180,7 +187,7 @@ const AgentRow = memo<AgentRowProps>(<Flexboxhorizontalalign={'center'}- className={styles.row}+ className={cx(styles.row, compact && styles.rowCompact)}gap={12}ref={setAnchor}onPointerEnter={activateMenu}@@ -190,7 +197,7 @@ const AgentRow = memo<AgentRowProps>(className={styles.identity}to={type === 'group' ? GROUP_CHAT_URL(id) : AGENT_CHAT_URL(id, false)}>- <SidebarItemAvatar item={item} size={28} />+ <SidebarItemAvatar item={item} size={compact ? 24 : 28} />{/* Three single-line columns: who the agent is, the role it plays,and what it is responsible for. */}<Text ellipsis className={cx('agent-row-title', styles.name)} weight={500}>diff --git a/src/features/AgentViewAll/AgentViewAllPage.tsx b/src/features/AgentViewAll/AgentViewAllPage.tsxindex 2dd367e67d6..0446d41910d 100644--- a/src/features/AgentViewAll/AgentViewAllPage.tsx+++ b/src/features/AgentViewAll/AgentViewAllPage.tsx@@ -47,6 +47,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';import { useHomeStore } from '@/store/home';import { homeAgentListSelectors } from '@/store/home/selectors';import { useUserStore } from '@/store/user';+import { useInterfaceDensity } from '@/styles/density';import AgentCard, { AgentCardGrid } from './AgentCard';import AgentRow, { type AgentRowAuthor } from './AgentRow';@@ -103,43 +104,48 @@ const groupHeaderStyles = createStaticStyles(({ css, cssVar }) => ({}));const GroupHeader = memo<GroupHeaderProps>(- ({ avatar, collapsed, color, count, index, label, onToggle }) => (- <Flexbox- horizontal- align={'center'}- gap={8}- className={cx(- groupHeaderStyles.bar,- index % 2 === 0 ? groupHeaderStyles.barEven : groupHeaderStyles.barOdd,- )}- onClick={onToggle}- >- <Icon- color={cssVar.colorTextSecondary}- icon={collapsed ? ChevronRightIcon : ChevronDownIcon}- size={14}- />- {avatar ? (- <Avatar avatar={avatar} size={20} />- ) : color ? (- <span- style={{- background: color,- borderRadius: '50%',- display: 'inline-block',- height: 9,- width: 9,- }}+ ({ avatar, collapsed, color, count, index, label, onToggle }) => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <Flexbox+ horizontal+ align={'center'}+ gap={8}+ paddingBlock={compact ? 6 : undefined}+ className={cx(+ groupHeaderStyles.bar,+ index % 2 === 0 ? groupHeaderStyles.barEven : groupHeaderStyles.barOdd,+ )}+ onClick={onToggle}+ >+ <Icon+ color={cssVar.colorTextSecondary}+ icon={collapsed ? ChevronRightIcon : ChevronDownIcon}+ size={14}/>- ) : null}- <Text fontSize={13} weight={500}>- {label}- </Text>- <Text fontSize={12} type={'secondary'}>- {count}- </Text>- </Flexbox>- ),+ {avatar ? (+ <Avatar avatar={avatar} size={20} />+ ) : color ? (+ <span+ style={{+ background: color,+ borderRadius: '50%',+ display: 'inline-block',+ height: 9,+ width: 9,+ }}+ />+ ) : null}+ <Text fontSize={13} weight={500}>+ {label}+ </Text>+ <Text fontSize={12} type={'secondary'}>+ {count}+ </Text>+ </Flexbox>+ );+ },);GroupHeader.displayName = 'AgentViewAllGroupHeader';diff --git a/src/features/Channels/BrowseChannels.tsx b/src/features/Channels/BrowseChannels.tsxindex 0fada24001f..05840e13469 100644--- a/src/features/Channels/BrowseChannels.tsx+++ b/src/features/Channels/BrowseChannels.tsx@@ -19,6 +19,7 @@ import { useTranslation } from 'react-i18next';import AsyncBoundary from '@/components/AsyncBoundary';import { channelActions, channelSelectors, useChannelStore } from '@/store/channel';+import { useInterfaceDensity } from '@/styles/density';const styles = stylex.create({list: {@@ -35,6 +36,10 @@ const styles = stylex.create({borderRadius: cssVar.borderRadius,backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },},+ rowCompact: {+ gap: 8,+ paddingBlock: 4,+ },note: { paddingBlock: 24, textAlign: 'center' },});@@ -46,6 +51,7 @@ interface BrowseChannelsProps {function BrowseChannels({ onJoined }: BrowseChannelsProps) {const { t } = useTranslation('channel');const { close } = useModalContext();+ const compact = useInterfaceDensity() === 'compact';const [search, setSearch] = useState('');const [joining, setJoining] = useState<string>();const query = useDebounce(search.trim(), { wait: 200 });@@ -91,10 +97,10 @@ function BrowseChannels({ onJoined }: BrowseChannelsProps) {onRetry={() => void sync.revalidate()}>{data?.map((channel) => (- <div key={channel.id} {...stylex.props(styles.row)}>+ <div key={channel.id} {...stylex.props(styles.row, compact && styles.rowCompact)}><Icon icon={Hash} size={16} /><Flexbox flex={1} style={{ minWidth: 0 }}>- <Text ellipsis weight={500}>+ <Text ellipsis fontSize={compact ? 13 : undefined} weight={500}>{channel.title}</Text><Text fontSize={12} type="secondary">diff --git a/src/features/Channels/ChannelList.tsx b/src/features/Channels/ChannelList.tsxindex 2bb947ecc16..00b5a9c6fba 100644--- a/src/features/Channels/ChannelList.tsx+++ b/src/features/Channels/ChannelList.tsx@@ -33,6 +33,7 @@ import { channelActions, channelSelectors, useChannelStore } from '@/store/channimport { useGlobalStore } from '@/store/global';import type { ChannelListSort } from '@/store/global/initialState';import { systemStatusSelectors } from '@/store/global/selectors';+import { sidebarRow } from '@/styles/density.stylex';import { openBrowseChannels } from './BrowseChannels';import { channelsInScope } from './channelScope';@@ -45,10 +46,10 @@ import { useChannelMenu } from './useChannelMenu';import { useChannelsEnabled } from './useChannelsEnabled';import { useThreadMenu } from './useThreadMenu';-// The connector runs down from the centre of the Channel's icon (4px row padding + half-// its 28px slot) and bends into each thread row, the way Discord nests threads. A 2px line+// The connector runs down from the centre of the Channel's icon (row paddingInline + half+// its iconBox slot) and bends into each thread row, the way Discord nests threads. A 2px line// centres on that axis; Chromium floors fractional border widths, so 1.5px drew as 1px.-const SPINE_X = 17;+const SPINE_X = `calc(${sidebarRow.paddingInline} + ${sidebarRow.iconBox} / 2 - 1px)`;const SORT_BYS: ChannelListSort['by'][] = ['createdAt', 'updatedAt', 'title'];const SORT_ORDERS: ChannelListSort['order'][] = ['desc', 'asc'];@@ -56,7 +57,7 @@ const SORT_ORDERS: ChannelListSort['order'][] = ['desc', 'asc'];const styles = stylex.create({thread: {position: 'relative',- paddingInlineStart: 32,+ paddingInlineStart: `calc(${sidebarRow.paddingInline} + ${sidebarRow.iconBox})`,},// colorTextQuaternary is solid (unlike the fill tokens), so the elbow drawn over the spine never// shows a darker overlap; colorBorder vanished against the dark sidebar.@@ -93,7 +94,7 @@ const styles = stylex.create({unreadPill: {pointerEvents: 'none',position: 'absolute',- insetBlockStart: 14,+ insetBlockStart: `calc((${sidebarRow.height} - 8px) / 2)`,insetInlineStart: 0,width: 4,height: 8,diff --git a/src/features/ChatInput/ActionBar/Knowledge/useControls.tsx b/src/features/ChatInput/ActionBar/Knowledge/useControls.tsxindex 7069f65607c..f20a43f1957 100644--- a/src/features/ChatInput/ActionBar/Knowledge/useControls.tsx+++ b/src/features/ChatInput/ActionBar/Knowledge/useControls.tsx@@ -11,6 +11,7 @@ import FileIcon from '@/components/FileIcon';import RepoIcon from '@/components/LibIcon';import { useAgentStore } from '@/store/agent';import { agentByIdSelectors } from '@/store/agent/selectors';+import { sidebarRow } from '@/styles/density.stylex';import { useAgentId } from '../../hooks/useAgentId';import CheckboxItem from '../components/CheckboxWithLoading';@@ -30,15 +31,15 @@ const styles = stylex.create({// submenu) and lets the row span full width; padding-inline 12 lines its icon/text// up with the menu items above.width: '320px',- minHeight: '32px',+ minHeight: sidebarRow.controlHeight,// The footer wrapper adds padding-block: 8px top & bottom; the top keeps it separated// from the list, but the bottom leaves a dead gap against the popup edge β cancel it.marginBlockEnd: '-8px',marginInline: '-12px',paddingInline: '12px',borderStyle: 'none',- borderRadius: '6px',- fontSize: '14px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,color: cssVar.colorText,backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': 'none', ':hover': 'none' },diff --git a/src/features/ChatInput/ActionBar/Plus/index.tsx b/src/features/ChatInput/ActionBar/Plus/index.tsxindex e481bf189fd..57532da1327 100644--- a/src/features/ChatInput/ActionBar/Plus/index.tsx+++ b/src/features/ChatInput/ActionBar/Plus/index.tsx@@ -28,6 +28,7 @@ import { systemStatusSelectors } from '@/store/global/selectors';import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';import { useUserStore } from '@/store/user';import { labPreferSelectors } from '@/store/user/selectors';+import { useDensityTokens } from '@/styles/density';import { useAgentId } from '../../hooks/useAgentId';import { useChatInputResourceAccess } from '../../hooks/useChatInputResourceAccess';@@ -461,11 +462,12 @@ const usePlusMenuItems = ({ close }: { close: () => void }): ActionDropdownMenuI*/const PlusAction = memo(() => {const { t } = useTranslation('chat');+ const { controlHeight, iconSize } = useDensityTokens();return (<ChatInputActionicon={PlusIcon}- size={{ blockSize: 32, borderRadius: 16, size: 18 }}+ size={{ blockSize: controlHeight, borderRadius: controlHeight / 2, size: iconSize }}title={t('plus.contextTooltip')}tooltipProps={{ placement: 'top' }}dropdown={{@@ -479,19 +481,23 @@ const PlusAction = memo(() => {PlusAction.displayName = 'PlusAction';-const Plus = () => (- <Suspense- fallback={- <ChatInputAction- disabled- icon={PlusIcon}- size={{ blockSize: 32, borderRadius: 16, size: 18 }}- title=""- />- }- >- <PlusAction />- </Suspense>-);+const Plus = () => {+ const { controlHeight, iconSize } = useDensityTokens();++ return (+ <Suspense+ fallback={+ <ChatInputAction+ disabled+ icon={PlusIcon}+ size={{ blockSize: controlHeight, borderRadius: controlHeight / 2, size: iconSize }}+ title=""+ />+ }+ >+ <PlusAction />+ </Suspense>+ );+};export default Plus;diff --git a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsxindex a9a049d4e5d..58a7a67116f 100644--- a/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx+++ b/src/features/ChatInput/ActionBar/Tools/ToolsList.tsx@@ -5,19 +5,24 @@ import * as stylex from '@stylexjs/stylex';import type { ReactNode } from 'react';import { Fragment, isValidElement, memo } from 'react';+import { useDensityTokens } from '@/styles/density';+import { sidebarRow } from '@/styles/density.stylex';+import { useDetailPopoverState } from '../components/useDetailPopoverState';import { useScrollSignal } from './ScrollSignalContext';const styles = stylex.create({- groupLabel: { paddingBlockStart: '12px', paddingBlockEnd: '4px', paddingInline: '12px' },+ groupLabel: { paddingBlockStart: '10px', paddingBlockEnd: '4px', paddingInline: '10px' },item: {cursor: 'pointer',display: 'flex',- gap: '12px',+ gap: '10px',alignItems: 'center',- paddingBlock: '8px',- paddingInline: '12px',- borderRadius: '6px',+ minHeight: sidebarRow.controlHeight,+ paddingBlock: '4px',+ paddingInline: '10px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,transition: 'background-color 0.2s',backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },@@ -28,8 +33,8 @@ const styles = stylex.create({flexShrink: 0,alignItems: 'center',justifyContent: 'center',- width: '24px',- height: '24px',+ width: sidebarRow.iconBox,+ height: sidebarRow.iconBox,},});@@ -73,6 +78,7 @@ const RegularItem = memo<{item: ToolItemData;}>(({ detailPopoverDisabled, item, index }) => {const { close, onOpenChange, open } = useDetailPopoverState(detailPopoverDisabled);+ const { iconSize } = useDensityTokens();// Close hover popover whenever the surrounding list scrolls β avoids the// detail panel hovering in mid-air after its anchor row has moved away.@@ -82,7 +88,7 @@ const RegularItem = memo<{isValidElement(item.icon) ? (item.icon) : (- <Icon icon={item.icon as any} size={20} />+ <Icon icon={item.icon as any} size={iconSize} />)) : null;diff --git a/src/features/ChatInput/ActionBar/Tools/useControls.styles.ts b/src/features/ChatInput/ActionBar/Tools/useControls.styles.tsindex f68537e7bf4..30c93b90872 100644--- a/src/features/ChatInput/ActionBar/Tools/useControls.styles.ts+++ b/src/features/ChatInput/ActionBar/Tools/useControls.styles.ts@@ -1,6 +1,8 @@import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';+import { sidebarRow } from '@/styles/density.stylex';+// StyleX can only fold constants declared in this module (or in a `.stylex.ts` file), so// these mirror ./constants β keep the two in sync.const SKILL_ICON_GAP = 14;@@ -14,15 +16,15 @@ export const styles = stylex.create({gap: `${SKILL_ICON_GAP}px`,alignItems: 'center',width: 'calc(100% + 24px)',- minHeight: '32px',+ minHeight: sidebarRow.controlHeight,// The footer adds 8px block padding; cancel it on the last action row so the// bottom row sits flush against the popup edge instead of leaving a gap.marginBlockEnd: { 'default': null, ':last-child': '-8px' },marginInline: '-12px',paddingInline: '12px',borderStyle: 'none',- borderRadius: '6px',- fontSize: '14px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,color: cssVar.colorText,backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': 'none', ':hover': 'none' },@@ -34,12 +36,12 @@ export const styles = stylex.create({gap: '10px',alignItems: 'center',width: '100%',- minHeight: '36px',- paddingBlock: '8px',+ minHeight: sidebarRow.controlHeight,+ paddingBlock: '4px',paddingInline: '10px',borderStyle: 'none',- borderRadius: '6px',- fontSize: '14px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,lineHeight: '20px',color: cssVar.colorError,opacity: { 'default': null, ':disabled': 0.45 },@@ -102,12 +104,12 @@ export const styles = stylex.create({gap: '10px',alignItems: 'center',width: '100%',- minHeight: '36px',- paddingBlock: '8px',+ minHeight: sidebarRow.controlHeight,+ paddingBlock: '4px',paddingInline: '10px',borderStyle: 'none',- borderRadius: '6px',- fontSize: '14px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,lineHeight: '20px',color: cssVar.colorText,opacity: { 'default': null, ':disabled': 0.45 },diff --git a/src/features/ChatInput/ActionBar/components/Action.tsx b/src/features/ChatInput/ActionBar/components/Action.tsxindex 8d83608a8a7..c49a0ecf8f5 100644--- a/src/features/ChatInput/ActionBar/components/Action.tsx+++ b/src/features/ChatInput/ActionBar/components/Action.tsx@@ -7,6 +7,7 @@ import useMergeState from 'use-merge-value';import { usePermission } from '@/hooks/usePermission';import { useServerConfigStore } from '@/store/serverConfig';+import { useDensityTokens } from '@/styles/density';import { useActionBarContext } from '../context';import type { ActionDropdownProps } from './ActionDropdown';@@ -44,6 +45,7 @@ const Action = memo<ActionProps>(value: open,});const mobile = useServerConfigStore((s) => s.isMobile);+ const { controlHeight, iconSize } = useDensityTokens();const { actionSize, dropdownPlacement } = useActionBarContext();const { allowed: canUseChatInputAction, reason } = usePermission('create_content');const blocked = disabled || !canUseChatInputAction;@@ -74,8 +76,8 @@ const Action = memo<ActionProps>(size={actionSize ??size ?? {- blockSize: 32,- size: 18,+ blockSize: controlHeight,+ size: iconSize,}}/>diff --git a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx b/src/features/ChatInput/ControlBar/BranchSwitcher.tsxindex a735786f5c7..1a2939e8dca 100644--- a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx@@ -44,6 +44,8 @@ import { useTranslation } from 'react-i18next';import { gitService } from '@/services/git';import { useFetchGitWorkingTreeStatus } from '@/store/device';+import { useDensityTokens } from '@/styles/density';+import { sidebarRow } from '@/styles/density.stylex';import { openCreateBranchModal } from './CreateBranchModal';import { gitMenuTriggerStyles } from './gitMenuTrigger';@@ -83,11 +85,11 @@ const styles = stylex.create({gap: '8px',alignItems: 'center',height: 'auto',- minHeight: '32px',+ minHeight: sidebarRow.controlHeight,paddingBlock: '4px',paddingInline: '8px',- borderRadius: '4px',- fontSize: '14px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,lineHeight: '20px',color: cssVar.colorText,},@@ -235,6 +237,7 @@ const BranchSwitcher = memo<BranchSwitcherProps>(}) => {const { t } = useTranslation('device');const { t: tCommon } = useTranslation('common');+ const { controlHeight } = useDensityTokens();const [search, setSearch] = useState('');const [busyBranch, setBusyBranch] = useState<string | null>(null);const currentRowRef = useRef<HTMLDivElement>(null);@@ -525,11 +528,13 @@ const BranchSwitcher = memo<BranchSwitcherProps>(// refresh that adds branches while the dropdown is open// would otherwise leave the extra rows (often the current// branch, last) undrawn. Remount when the count changes.- key={filtered.length}- listItemHeight={32}+ key={`${filtered.length}:${controlHeight}`}+ listItemHeight={controlHeight}style={selection- ? { height: Math.min(filtered.length, PICK_LIST_MAX_ROWS) * 32 + 8 }+ ? {+ height: Math.min(filtered.length, PICK_LIST_MAX_ROWS) * controlHeight + 8,+ }: undefined}>diff --git a/src/features/ChatInput/ControlBar/HeteroModel/ModelCatalogSelector.tsx b/src/features/ChatInput/ControlBar/HeteroModel/ModelCatalogSelector.tsxindex b73f3c53bb2..0ae3e7568c4 100644--- a/src/features/ChatInput/ControlBar/HeteroModel/ModelCatalogSelector.tsx+++ b/src/features/ChatInput/ControlBar/HeteroModel/ModelCatalogSelector.tsx@@ -41,6 +41,8 @@ import {import { memo, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';+import { sidebarRow } from '@/styles/density.stylex';+import { useMenuContentLifecycle } from '../useMenuContentLifecycle';import { getModelLabel, getModelOptionDescription } from './labels';import { useModelCatalogView } from './useModelCatalogView';@@ -58,7 +60,7 @@ const styles = stylex.create({textAlign: 'center',},groupLabel: { textTransform: 'none', letterSpacing: 'normal' },- item: { minHeight: '42px' },+ item: { minHeight: sidebarRow.listRowHeight },popup: {overflow: 'hidden',display: 'flex',@@ -66,7 +68,7 @@ const styles = stylex.create({width: '340px',maxHeight: '430px',},- search: { display: 'flex', gap: '8px', alignItems: 'center', paddingBlock: '10px' },+ search: { display: 'flex', gap: '8px', alignItems: 'center', paddingBlock: '6px' },spinning: {animationName: spin,animationDuration: '0.8s',diff --git a/src/features/ChatInput/ControlBar/OptionRow.tsx b/src/features/ChatInput/ControlBar/OptionRow.tsxindex 4d8a1ccb015..d7613e2ace5 100644--- a/src/features/ChatInput/ControlBar/OptionRow.tsx+++ b/src/features/ChatInput/ControlBar/OptionRow.tsx@@ -6,6 +6,8 @@ import * as stylex from '@stylexjs/stylex';import { CheckIcon, ChevronRightIcon } from 'lucide-react';import { memo, type ReactNode } from 'react';+import { sidebarRow } from '@/styles/density.stylex';+/*** One choice in a composer menu: framed icon, title over a description, and a* check when it is the current one.@@ -35,9 +37,9 @@ const styles = stylex.create({display: 'flex',gap: '10px',alignItems: 'center',- paddingBlock: '8px',+ paddingBlock: '6px',paddingInline: '8px',- borderRadius: cssVar.borderRadius,+ borderRadius: sidebarRow.radius,transition: 'background-color 0.2s',backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },@@ -75,12 +77,12 @@ const styles = stylex.create({flex: 'none',alignItems: 'center',justifyContent: 'center',- width: '28px',- height: '28px',+ width: sidebarRow.iconBox,+ height: sidebarRow.iconBox,borderWidth: '1px',borderStyle: 'solid',borderColor: cssVar.colorBorderSecondary,- borderRadius: cssVar.borderRadius,+ borderRadius: sidebarRow.radius,color: cssVar.colorText,backgroundColor: cssVar.colorBgElevated,backgroundImage: 'none',diff --git a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsxindex 6ba0cda45b8..850543b6a10 100644--- a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx+++ b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx@@ -37,6 +37,7 @@ import {import { useTranslation } from 'react-i18next';import { gitService } from '@/services/git';+import { sidebarRow } from '@/styles/density.stylex';import { openCreateWorktreeModal } from './CreateWorktreeModal';import { gitMenuTriggerStyles } from './gitMenuTrigger';@@ -100,10 +101,11 @@ const styles = stylex.create({display: 'flex',gap: '8px',alignItems: 'center',- paddingBlock: '6px',+ minHeight: sidebarRow.controlHeight,+ paddingBlock: '4px',paddingInline: '8px',- borderRadius: '8px',- fontSize: '13px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,color: cssVar.colorText,backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },@@ -145,11 +147,11 @@ const styles = stylex.create({gridTemplateColumns: 'minmax(0, 1fr) minmax(44px, auto) 20px',gap: '10px',alignItems: 'center',- minHeight: '48px',- paddingBlock: '6px',+ minHeight: sidebarRow.listRowHeight,+ paddingBlock: '4px',paddingInline: '8px',- borderRadius: '8px',- fontSize: '13px',+ borderRadius: sidebarRow.radius,+ fontSize: sidebarRow.textFontSize,color: cssVar.colorText,backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },diff --git a/src/features/CommandMenu/styles.ts b/src/features/CommandMenu/styles.tsindex 433e3d7a83b..a35537a22c5 100644--- a/src/features/CommandMenu/styles.ts+++ b/src/features/CommandMenu/styles.ts@@ -95,7 +95,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({align-items: center;justify-content: center;- padding-block: 12px;+ padding-block: calc(var(--lobe-density-section-gap) - 4px);padding-inline: 16px;border-block-start: 1px solid ${cssVar.colorBorderSecondary};`,@@ -125,7 +125,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({border: none;font-family: inherit;- font-size: 16px;+ font-size: var(--lobe-density-page-title-font-size);color: ${cssVar.colorText};background: transparent;@@ -139,14 +139,14 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({[cmdk-list] {overflow-y: auto;max-height: 400px;- padding: 8px;+ padding: 6px;}[cmdk-empty] {padding-block: 32px;padding-inline: 16px;- font-size: 14px;+ font-size: var(--lobe-density-font-size);color: ${cssVar.colorTextTertiary};text-align: center;}@@ -156,12 +156,13 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({user-select: none;display: flex;- gap: 12px;+ gap: 10px;align-items: center;- padding-block: 12px;- padding-inline: 16px;- border-radius: ${cssVar.borderRadius};+ min-height: var(--lobe-density-row-height);+ padding-block: calc((var(--lobe-density-row-height) - 20px) / 2);+ padding-inline: var(--lobe-density-section-gap);+ border-radius: var(--lobe-density-radius);color: ${cssVar.colorText};@@ -179,8 +180,8 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({[cmdk-group-heading] {user-select: none;- padding-block: 8px;- padding-inline: 16px;+ padding-block: 6px;+ padding-inline: var(--lobe-density-section-gap);font-size: 12px;font-weight: 500;@@ -201,13 +202,13 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({gap: 8px;align-items: center;- padding-block: 8px;- padding-inline: 16px;+ padding-block: 6px;+ padding-inline: var(--lobe-density-section-gap);`,icon: css`flex-shrink: 0;- width: 20px;- height: 20px;+ width: var(--lobe-density-icon-size);+ height: var(--lobe-density-icon-size);color: ${cssVar.colorTextSecondary};`,inputWrapper: css`@@ -215,14 +216,14 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({gap: 8px;align-items: center;- padding-block: 12px;- padding-inline: 16px;+ padding-block: calc(var(--lobe-density-section-gap) - 4px);+ padding-inline: var(--lobe-density-section-gap);border-block-start: 1px solid ${cssVar.colorBorderSecondary};`,itemContent: css`display: flex;flex: 1;- gap: 12px;+ gap: 10px;align-items: center;min-width: 0;@@ -248,20 +249,20 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({align-items: center;justify-content: center;- width: 20px;- height: 20px;+ width: var(--lobe-density-icon-size);+ height: var(--lobe-density-icon-size);color: ${cssVar.colorTextSecondary};`,itemLabel: css`- font-size: 14px;+ font-size: var(--lobe-density-font-size);font-weight: 500;line-height: 1.4;`,itemTitle: css`overflow: hidden;- font-size: 14px;+ font-size: var(--lobe-density-font-size);font-weight: 500;line-height: 1.4;text-overflow: ellipsis;diff --git a/src/features/Conversation/WorkingSidebar/index.tsx b/src/features/Conversation/WorkingSidebar/index.tsxindex b6baf9e2d4b..d3c477b1f17 100644--- a/src/features/Conversation/WorkingSidebar/index.tsx+++ b/src/features/Conversation/WorkingSidebar/index.tsx@@ -62,7 +62,13 @@ import { deviceSelectors, useDeviceStore } from '@/store/device';import { useElectronStore } from '@/store/electron';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors';-import { useHeaderActionSize } from '@/styles/density';+import {+ PanelDensityContext,+ useDensityTokens,+ useHeaderActionSize,+ useInterfaceDensity,+} from '@/styles/density';+import { sidebarRow } from '@/styles/density.stylex';import { openTrustedExternalUrl } from '@/utils/openTrustedExternalUrl';import { type ComposerTarget, createComposerTarget, resolveThreadComposerTarget } from '../types';@@ -133,7 +139,7 @@ const styles = stylex.create({height: '100%',paddingBlockStart: {'default': null,- '@container agent-chat-layout (min-width: 1200px)': '44px',+ '@container agent-chat-layout (min-width: 1200px)': sidebarRow.headerHeight,},},tabs: {@@ -167,6 +173,8 @@ interface AgentWorkingSidebarProps {}const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth }) => {+ const interfaceDensity = useInterfaceDensity();+ const { headerHeight } = useDensityTokens();const headerActionSize = useHeaderActionSize(true);const { t } = useTranslation(['chat', 'setting']);// Keep the panel frame + tabs on the navigation commit; the pane contents@@ -895,7 +903,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth }));return (- <>+ <PanelDensityContext value={interfaceDensity}>{overviewPanel}<TopicPullRequestProbesdeviceId={remoteDeviceId}@@ -924,7 +932,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })align={'center'}className={stylex.props(styles.header).className}gap={4}- height={44}+ height={headerHeight}justify={'space-between'}paddingInline={6}>@@ -1118,7 +1126,7 @@ const AgentWorkingSidebar = memo<AgentWorkingSidebarProps>(({ availableWidth })</Flexbox></Flexbox></RightPanel>- </>+ </PanelDensityContext>);});diff --git a/src/features/DocumentModal/Header.tsx b/src/features/DocumentModal/Header.tsxindex 7b1e0374141..47882832642 100644--- a/src/features/DocumentModal/Header.tsx+++ b/src/features/DocumentModal/Header.tsx@@ -27,12 +27,10 @@ import ToggleRightPanelButton from '@/features/RightPanel/ToggleRightPanelButtonimport { useAppOrigin } from '@/hooks/useAppOrigin';import { useDocumentStore } from '@/store/document';import { editorSelectors } from '@/store/document/slices/editor';-import { useHeaderActionSize } from '@/styles/density';+import { useDensityTokens, useHeaderActionSize } from '@/styles/density';import { buildDocumentModalUrl } from './url';-const HEADER_HEIGHT = 44;-const styles = createStaticStyles(({ css }) => ({shareButton: css`& button:not(:hover, :focus-visible) {@@ -42,6 +40,7 @@ const styles = createStaticStyles(({ css }) => ({}));const DocumentModalHeader = memo(() => {+ const { fontSize, headerHeight } = useDensityTokens();const headerActionSize = useHeaderActionSize();const headerActionSmallSize = useHeaderActionSize(true);const { t } = useTranslation(['file', 'common']);@@ -69,7 +68,7 @@ const DocumentModalHeader = memo(() => {align={'center'}flex={'none'}gap={4}- height={HEADER_HEIGHT}+ height={headerHeight}justify={'space-between'}padding={8}style={{ borderBlockEnd: `1px solid ${cssVar.colorBorderSecondary}` }}@@ -79,7 +78,7 @@ const DocumentModalHeader = memo(() => {{isDocumentLoading && !title ? (<Skeleton style={{ height: 14, minWidth: 120, width: 120 }} />) : (- <Text ellipsis style={{ minWidth: 0 }} weight={500}>+ <Text ellipsis fontSize={fontSize} style={{ minWidth: 0 }} weight={500}>{title || t('pageEditor.titlePlaceholder')}</Text>)}diff --git a/src/features/EnvironmentManager/EnvironmentItem.tsx b/src/features/EnvironmentManager/EnvironmentItem.tsxindex 6b808d1abea..7ba2b4a7247 100644--- a/src/features/EnvironmentManager/EnvironmentItem.tsx+++ b/src/features/EnvironmentManager/EnvironmentItem.tsx@@ -22,6 +22,7 @@ import { useTranslation } from 'react-i18next';import UserAvatar from '@/components/UserAvatar';import VisibilityConfirmContent from '@/features/VisibilityConfirmContent';+import { useInterfaceDensity } from '@/styles/density';import { describeError } from './errorMessage';import { repositoryPath } from './repository';@@ -60,6 +61,12 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorFillTertiary};`,+ /** Compact density: 36px tile in a 52px row (6px padding, 20px + 2 + 18px text). */+ iconTileCompact: css`+ width: 36px;+ height: 36px;+ border-radius: 10px;+ `,metaDivider: css`flex: none;width: 1px;@@ -105,6 +112,9 @@ const styles = createStaticStyles(({ css }) => ({background: ${cssVar.colorFillSecondary};}`,+ rowCompact: css`+ padding-block: 6px;+ `,}));interface EnvironmentItemProps {@@ -139,6 +149,7 @@ const EnvironmentItem = memo<EnvironmentItemProps>((props) => {const { t: tCommon } = useTranslation('common');const actions = useEnvironmentActions();const canEdit = useCanEditEnvironment()(environment);+ const compact = useInterfaceDensity() === 'compact';// A row restored from storage carries only its plain `owner/name`.const repository = environment.configuration@@ -226,8 +237,8 @@ const EnvironmentItem = memo<EnvironmentItemProps>((props) => {<Flexboxhorizontalalign={'center'}- className={cx(styles.row, selected && styles.rowActive)}- gap={16}+ className={cx(styles.row, compact && styles.rowCompact, selected && styles.rowActive)}+ gap={compact ? 12 : 16}role={'button'}tabIndex={0}onClick={onSelect}@@ -241,7 +252,7 @@ const EnvironmentItem = memo<EnvironmentItemProps>((props) => {}}}>- <div className={styles.iconTile}>+ <div className={cx(styles.iconTile, compact && styles.iconTileCompact)}><Github size={20} /></div>@@ -254,8 +265,18 @@ const EnvironmentItem = memo<EnvironmentItemProps>((props) => {own: it is a gloss on the name, not a second fact, and a thirdline made every row taller for the rows that have one. It givesway first, since the name is what the row is found by. */}- <Flexbox horizontal align={'baseline'} gap={8} style={{ minWidth: 0 }}>- <Text ellipsis fontSize={15} style={{ flex: '0 1 auto', minWidth: 0 }} weight={500}>+ <Flexbox+ horizontal+ align={'baseline'}+ gap={8}+ style={{ lineHeight: compact ? '20px' : undefined, minWidth: 0 }}+ >+ <Text+ ellipsis+ fontSize={compact ? 14 : 15}+ style={{ flex: '0 1 auto', minWidth: 0 }}+ weight={500}+ >{environment.name}</Text>{environment.description && (@@ -271,7 +292,12 @@ const EnvironmentItem = memo<EnvironmentItemProps>((props) => {</Text>)}</Flexbox>- <Flexbox horizontal align={'center'} gap={8} style={{ minWidth: 0 }}>+ <Flexbox+ horizontal+ align={'center'}+ gap={8}+ style={{ lineHeight: compact ? '18px' : undefined, minWidth: 0 }}+ >{/* The repository leads because it is what the name is usually takenfrom, and it truncates because it is the only part of this linethat can afford to. */}diff --git a/src/features/EnvironmentManager/Skeleton.tsx b/src/features/EnvironmentManager/Skeleton.tsxindex ce9f1c817ca..a77b6ac9517 100644--- a/src/features/EnvironmentManager/Skeleton.tsx+++ b/src/features/EnvironmentManager/Skeleton.tsx@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';import ListSkeleton from '@/components/ListSkeleton';import SkeletonBar from '@/components/Skeleton/Bar';+import { useDensityTokens } from '@/styles/density';const styles = stylex.create({// Same frame as the manager's `listCol`.@@ -24,7 +25,7 @@ const styles = stylex.create({/*** The environment list while it loads: the bordered list frame with the same- * 4px inset and 72px rows (`EnvironmentItem`, 2px apart) the loaded list uses.+ * 4px inset and 72px (compact 52px) rows (`EnvironmentItem`, 2px apart) the loaded list uses.*/export const EnvironmentListSkeleton = () => (<Flexbox {...stylex.props(styles.listCol)}>@@ -54,6 +55,7 @@ export const EnvironmentDefinitionSkeleton = () => (*/export const EnvironmentManagerSkeleton = ({ leading }: { leading?: ReactNode }) => {const { t } = useTranslation('setting');+ const { controlHeight } = useDensityTokens();return (<Flexbox aria-busy data-testid={'environments-skeleton'} gap={16}>@@ -64,8 +66,8 @@ export const EnvironmentManagerSkeleton = ({ leading }: { leading?: ReactNode })</Text>)}<Flexbox horizontal align={'center'} gap={8}>- <SkeletonBar height={32} width={32} />- <SkeletonBar height={32} width={128} />+ <SkeletonBar height={controlHeight} width={controlHeight} />+ <SkeletonBar height={controlHeight} width={128} /></Flexbox></Flexbox><EnvironmentListSkeleton />diff --git a/src/features/ExecutionTargetPicker/index.tsx b/src/features/ExecutionTargetPicker/index.tsxindex a6d924c3946..8a201a9b43f 100644--- a/src/features/ExecutionTargetPicker/index.tsx+++ b/src/features/ExecutionTargetPicker/index.tsx@@ -51,10 +51,10 @@ const styles = createStaticStyles(({ css }) => ({align-items: center;justify-content: center;- width: 24px;- height: 24px;+ width: var(--lobe-density-icon-box);+ height: var(--lobe-density-icon-box);border: 1px solid ${cssVar.colorBorderSecondary};- border-radius: ${cssVar.borderRadius};+ border-radius: var(--lobe-density-radius);color: ${cssVar.colorText};@@ -63,7 +63,7 @@ const styles = createStaticStyles(({ css }) => ({optionName: css`overflow: hidden;- font-size: 14px;+ font-size: var(--lobe-density-font-size);font-weight: 500;line-height: 20px;color: ${cssVar.colorText};@@ -71,7 +71,7 @@ const styles = createStaticStyles(({ css }) => ({white-space: nowrap;`,selectItem: css`- min-height: 40px;+ min-height: var(--lobe-density-list-row-height);`,selectPopup: css`max-width: calc(100vw - 24px);diff --git a/src/features/ExplorerTree/view/ExplorerTree.tsx b/src/features/ExplorerTree/view/ExplorerTree.tsxindex d0df5ca14ea..21c2c5a739b 100644--- a/src/features/ExplorerTree/view/ExplorerTree.tsx+++ b/src/features/ExplorerTree/view/ExplorerTree.tsx@@ -749,7 +749,7 @@ function ExplorerTree<TData>({ ref, ...props }: ExplorerTreeProps<TData>) {return (<ExplorerTreeInner- key={generation}+ key={`${generation}:${props.itemHeight ?? ''}:${props.density ?? ''}`}{...props}ref={ref}requestTreeRebuild={requestTreeRebuild}diff --git a/src/features/Home/AgentSelect/AgentList.tsx b/src/features/Home/AgentSelect/AgentList.tsxindex 9e177ac7b32..e6aeb3bbd18 100644--- a/src/features/Home/AgentSelect/AgentList.tsx+++ b/src/features/Home/AgentSelect/AgentList.tsx@@ -21,12 +21,10 @@ import AsyncBoundary from '@/components/AsyncBoundary';import SkeletonList from '@/features/NavPanel/components/SkeletonList';import { useHomeStore } from '@/store/home';import { homeAgentListSelectors } from '@/store/home/selectors';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import { type AgentRow, useHomeAgentRows } from './useHomeAgentRows';-/** Row height hint for the virtual list β keep in sync with `styles.item`. */-const ROW_HEIGHT = 36;-const SECTION_HEIGHT = 28;const MAX_LIST_HEIGHT = 360;const styles = createStaticStyles(({ css, cssVar }) => ({@@ -37,7 +35,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({padding-block: 24px;padding-inline: 12px;- font-size: 13px;+ font-size: var(--lobe-density-font-size);color: ${cssVar.colorTextTertiary};text-align: center;`,@@ -51,10 +49,10 @@ const styles = createStaticStyles(({ css, cssVar }) => ({gap: 8px;align-items: center;- height: ${ROW_HEIGHT}px;+ height: var(--lobe-density-row-height);padding-block: 0;padding-inline: 8px;- border-radius: ${cssVar.borderRadius};+ border-radius: var(--lobe-density-radius);&:hover {background: ${cssVar.colorFillSecondary};@@ -67,7 +65,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,// Same spec as the agent-detail SwitchPanel's section header.section: css`- height: ${SECTION_HEIGHT}px;+ height: var(--lobe-density-control-height);padding-block: 4px 2px;padding-inline: 8px;@@ -94,6 +92,8 @@ const toSectionRow = (key: string, label: string): ListRow => ({ key, kind: 'secconst AgentList = memo<AgentListProps>(({ activeAgentId, error, onRetry, onSelect }) => {const { t } = useTranslation('common');+ const compact = useInterfaceDensity() === 'compact';+ const { controlHeight, fontSize, rowHeight } = useDensityTokens();const [search, setSearch] = useState('');const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);@@ -128,10 +128,10 @@ const AgentList = memo<AgentListProps>(({ activeAgentId, error, onRetry, onSelec// The virtual viewport needs an explicit height; clamp to the old 360px cap// so a long list scrolls instead of growing the popup.const contentHeight = rows.reduce(- (sum, item) => sum + (item.kind === 'section' ? SECTION_HEIGHT : ROW_HEIGHT),+ (sum, item) => sum + (item.kind === 'section' ? controlHeight : rowHeight),0,);- const listHeight = Math.min(Math.max(contentHeight, ROW_HEIGHT), MAX_LIST_HEIGHT);+ const listHeight = Math.min(Math.max(contentHeight, rowHeight), MAX_LIST_HEIGHT);// Error gated ahead of the skeleton so a failed list fetch shows Retry instead// of a permanent skeleton (`isAgentListInit` only flips on success).@@ -171,8 +171,8 @@ const AgentList = memo<AgentListProps>(({ activeAgentId, error, onRetry, onSelec// virtua sizes itself on mount; remount when the filtered count changes// so a narrowed list never leaves stale rows undrawn.virtual- key={rows.length}- listItemHeight={ROW_HEIGHT}+ key={`${rows.length}:${rowHeight}`}+ listItemHeight={rowHeight}style={{ height: listHeight }}getItemLabel={(_, index) => {const item = rows[index];@@ -198,10 +198,11 @@ const AgentList = memo<AgentListProps>(({ activeAgentId, error, onRetry, onSelecbackground={item.row.backgroundColor}name={item.row.title}shape={'square'}- size={24}+ size={compact ? 20 : 24}/><Textellipsis+ fontSize={fontSize}style={{ flex: 1 }}weight={item.row.id === activeAgentId ? 600 : 500}color={diff --git a/src/features/Home/AgentSelect/index.tsx b/src/features/Home/AgentSelect/index.tsxindex 854647ccff1..43271f95f45 100644--- a/src/features/Home/AgentSelect/index.tsx+++ b/src/features/Home/AgentSelect/index.tsx@@ -34,8 +34,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({transition: opacity 0.2s ${cssVar.motionEaseOut};`,name: css`- font-size: 14px;- line-height: 20px;+ font-size: var(--lobe-density-font-size);+ line-height: var(--lobe-density-line-height);`,popup: css`overflow: hidden;diff --git a/src/features/HomeInbox/NewsList.tsx b/src/features/HomeInbox/NewsList.tsxindex 752bd6964c8..0358d886c6c 100644--- a/src/features/HomeInbox/NewsList.tsx+++ b/src/features/HomeInbox/NewsList.tsx@@ -13,6 +13,7 @@ import { useSelfReviewBriefView } from '@/features/DailyBrief/useSelfReviewBriefimport { homeType } from '@/features/Home/components/homeType';import Time from '@/features/Home/components/Time';import { useBriefStore } from '@/store/brief';+import { useInterfaceDensity } from '@/styles/density';import NewsChatActions from './NewsChatActions';@@ -49,6 +50,9 @@ const styles = createStaticStyles(({ css, cssVar }) => ({padding-block-end: 12px;padding-inline: ${ROW_PADDING_INLINE + HEADLINE_INSET}px ${ROW_PADDING_INLINE}px;`,+ bodyCompact: css`+ padding-block-end: 8px;+ `,list: css`overflow: hidden;border: 1px solid ${cssVar.colorBorderSecondary};@@ -72,11 +76,19 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillQuaternary};}`,+ // Compact rows (plain and bare) land on the 32px row height: 6px + 20px line + 6px.+ rowCompact: css`+ padding-block: 6px;+ `,section: css`&:not(:last-child) {border-block-end: 1px solid ${cssVar.colorBorderSecondary};}`,+ titleCompact: css`+ font-size: 13px;+ line-height: 20px;+ `,}));interface NewsItemProps {@@ -94,6 +106,7 @@ const NewsItem = memo<NewsItemProps>(({ bare, brief, showTime }) => {const markBriefRead = useBriefStore((s) => s.markBriefRead);// Nightly self-review ideas list themselves from metadata, like proposals do.const selfReview = useSelfReviewBriefView(brief.metadata);+ const compact = useInterfaceDensity() === 'compact';const [expanded, setExpanded] = useState(false);const [localRead, setLocalRead] = useState(false);@@ -122,7 +135,11 @@ const NewsItem = memo<NewsItemProps>(({ bare, brief, showTime }) => {return (<Flexbox className={bare ? undefined : styles.section}>- <Button className={cx(styles.row, bare && styles.bareRow)} type={'text'} onClick={toggle}>+ <Button+ className={cx(styles.row, bare && styles.bareRow, compact && styles.rowCompact)}+ type={'text'}+ onClick={toggle}+ ><Flexbox horizontal align={'center'} gap={ROW_GAP} style={{ width: '100%' }}>{/* Priority leads the row, so a scan down the list reads levels first. */}<BriefPriorityIcon muted={read} priority={brief.priority} />@@ -142,7 +159,7 @@ const NewsItem = memo<NewsItemProps>(({ bare, brief, showTime }) => {)}<Textellipsis- className={homeType.itemTitle}+ className={cx(homeType.itemTitle, compact && styles.titleCompact)}style={{color: read ? cssVar.colorTextTertiary : undefined,flex: 1,@@ -162,7 +179,10 @@ const NewsItem = memo<NewsItemProps>(({ bare, brief, showTime }) => {</Button>{expanded && (brief.summary || brief.artifacts || hasTopicChat) && (- <Flexbox className={bare ? styles.bareBody : styles.body} gap={8}>+ <Flexbox+ className={bare ? styles.bareBody : cx(styles.body, compact && styles.bodyCompact)}+ gap={8}+ >{selfReview ? (<SelfReviewBriefDetails content={selfReview.content} details={selfReview.details} />) : (@@ -205,6 +225,7 @@ interface NewsListProps {const NewsList = memo<NewsListProps>(({ bare, news, showTime }) => {const { t } = useTranslation('home');const [expanded, setExpanded] = useState(false);+ const compact = useInterfaceDensity() === 'compact';if (news.length === 0) return null;@@ -220,8 +241,13 @@ const NewsList = memo<NewsListProps>(({ bare, news, showTime }) => {))}{collapsed && (<Button- className={cx(styles.row, styles.bareRow, homeType.supporting)}type={'text'}+ className={cx(+ styles.row,+ styles.bareRow,+ compact && styles.rowCompact,+ homeType.supporting,+ )}onClick={() => setExpanded(true)}>{t('inbox.news.showAll', { count: news.length })}diff --git a/src/features/HomeInbox/TopicRow.tsx b/src/features/HomeInbox/TopicRow.tsxindex 356920a3cfe..bf1f38e267a 100644--- a/src/features/HomeInbox/TopicRow.tsx+++ b/src/features/HomeInbox/TopicRow.tsx@@ -1,12 +1,13 @@import { AGENT_CHAT_TOPIC_URL, GROUP_CHAT_TOPIC_URL } from '@lobechat/const';import { agentDisplayName } from '@lobechat/types';-import { createStaticStyles, Flexbox, Text } from '@lobehub/ui';+import { createStaticStyles, cx, Flexbox, Text } from '@lobehub/ui';import { memo, type ReactNode } from 'react';import AgentAvatar from '@/components/AgentAvatar';import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';import Time from '@/features/Home/components/Time';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';+import { useInterfaceDensity } from '@/styles/density';import { resolveTopicTriggerTime, RunningElapsedTime } from './RunningElapsedTime';import { type InboxTopic } from './useHomeInboxTopics';@@ -25,6 +26,10 @@ const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorFillQuaternary};}`,+ // 6px + 20px content + 6px = the 32px compact row height.+ rowCompact: css`+ padding-block: 6px;+ `,}));/**@@ -51,6 +56,7 @@ interface TopicRowProps {const TopicRow = memo<TopicRowProps>(({ action, topic, leading, trailing }) => {const navigate = useWorkspaceAwareNavigate();const agent = useAgentDisplayMeta(topic.agentId);+ const compact = useInterfaceDensity() === 'compact';const open = () => {const url = getTopicChatUrl(topic);@@ -58,7 +64,13 @@ const TopicRow = memo<TopicRowProps>(({ action, topic, leading, trailing }) => {};return (- <Flexbox horizontal align={'center'} className={styles.row} gap={10} onClick={open}>+ <Flexbox+ horizontal+ align={'center'}+ className={cx(styles.row, compact && styles.rowCompact)}+ gap={compact ? 8 : 10}+ onClick={open}+ >{leading}{agent && (<AgentAvatar@@ -66,7 +78,7 @@ const TopicRow = memo<TopicRowProps>(({ action, topic, leading, trailing }) => {avatar={agent.avatar}background={agent.backgroundColor}shape={'circle'}- size={22}+ size={compact ? 20 : 22}style={{ flex: 'none' }}title={agentDisplayName(agent)}/>diff --git a/src/features/HomeSidebar/Header/components/InboxModal/NotificationItem.tsx b/src/features/HomeSidebar/Header/components/InboxModal/NotificationItem.tsxindex 72a918ca7be..ce8b7a96731 100644--- a/src/features/HomeSidebar/Header/components/InboxModal/NotificationItem.tsx+++ b/src/features/HomeSidebar/Header/components/InboxModal/NotificationItem.tsx@@ -24,6 +24,7 @@ import { ProductLogo } from '@/components/Branding';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { useAppOrigin } from '@/hooks/useAppOrigin';import type { NativeContextMenuItem } from '@/libs/contextMenu/types';+import { useInterfaceDensity } from '@/styles/density';import { openTrustedExternalUrl } from '@/utils/openTrustedExternalUrl';import { formatNotificationRelativeTime } from './formatNotificationRelativeTime';@@ -43,6 +44,8 @@ const styles = stylex.create({backgroundColor: cssVar.colorInfo,backgroundImage: 'none',},+ // Centers the dot on the first 20px compact text line.+ unreadDotCompact: { marginBlockStart: '6px' },});const TYPE_ICON_MAP: Record<string, typeof BellIcon> = {@@ -80,6 +83,8 @@ const NotificationItem = memo<NotificationItemProps>(onArchive,}) => {const { i18n, t } = useTranslation('notification');+ const compact = useInterfaceDensity() === 'compact';+ const avatarSize = compact ? 24 : 32;const { close } = useModalContext();const navigate = useWorkspaceAwareNavigate();const appOrigin = useAppOrigin();@@ -150,20 +155,22 @@ const NotificationItem = memo<NotificationItemProps>(<Blockaria-label={title}gap={4}- paddingBlock={12}- paddingInline={20}+ paddingBlock={compact ? 8 : 12}+ paddingInline={compact ? 16 : 20}style={{ cursor: 'pointer' }}variant="borderless"onClick={handleOpenDetail}>- <Flexbox horizontal align="flex-start" gap={12}>- {!isRead && <span {...stylex.props(styles.unreadDot)} />}+ <Flexbox horizontal align="flex-start" gap={compact ? 8 : 12}>+ {!isRead && (+ <span {...stylex.props(styles.unreadDot, compact && styles.unreadDotCompact)} />+ )}{actor ? (<Avataralt={actor.name}avatar={actor.avatar || DEFAULT_USER_AVATAR_URL}shape="circle"- size={32}+ size={avatarSize}style={{ flex: 'none' }}/>) : agent ? (@@ -174,14 +181,18 @@ const NotificationItem = memo<NotificationItemProps>(background={agent.backgroundColor}name={agent.title}shape="circle"- size={32}+ size={avatarSize}style={{ flex: 'none' }}/>) : (- <ProductLogo size={32} style={{ flex: 'none' }} />+ <ProductLogo size={avatarSize} style={{ flex: 'none' }} />)}- <Flexbox flex={1} gap={6} style={{ minWidth: 0, overflow: 'hidden' }}>- <Text ellipsis={{ rows: 2 }} wordBreak="break-word">+ <Flexbox flex={1} gap={compact ? 2 : 6} style={{ minWidth: 0, overflow: 'hidden' }}>+ <Text+ ellipsis={{ rows: 2 }}+ fontSize={compact ? 13 : undefined}+ wordBreak="break-word"+ >{preview}</Text><Flexbox horizontal align="center" gap={6}>diff --git a/src/features/HomeSidebar/Header/components/InboxModal/index.tsx b/src/features/HomeSidebar/Header/components/InboxModal/index.tsxindex 79d84cd8ffd..bc931e70754 100644--- a/src/features/HomeSidebar/Header/components/InboxModal/index.tsx+++ b/src/features/HomeSidebar/Header/components/InboxModal/index.tsx@@ -71,6 +71,8 @@ const styles = stylex.create({borderBlockEndColor: cssVar.colorFillSecondary,},headerMain: { minWidth: '0', paddingBlock: '12px', paddingInline: '16px' },+ // Small tabs/actions are 28px tall, so 6px block padding lands on the 40px compact header.+ headerMainCompact: { paddingBlock: '6px' },headerTitle: {flex: 'none',boxSizing: 'border-box',@@ -128,6 +130,7 @@ const CATEGORY_ICONS: Record<string, LucideIcon> = {const InboxModalContent = memo(() => {const headerActionSize = useHeaderActionSize(true);const interfaceDensity = useInterfaceDensity();+ const compact = interfaceDensity === 'compact';const { i18n, t } = useTranslation('notification');const workspaceId = useActiveWorkspaceId();const [navigationFilter, setNavigationFilter] = useState(ALL_FILTER);@@ -284,7 +287,7 @@ const InboxModalContent = memo(() => {<Flexboxhorizontalalign="center"- className={stylex.props(styles.headerMain).className}+ className={stylex.props(styles.headerMain, compact && styles.headerMainCompact).className}flex={1}justify="space-between">@@ -403,13 +406,17 @@ const InboxModalContent = memo(() => {</NavPanelDensityContext><Flexbox className={stylex.props(styles.main).className} flex={1}><Flexbox flex={1} style={{ minHeight: 0 }}>- <Content- category={category}- isRead={isRead}- onArchive={handleArchive}- onMarkAsRead={handleMarkAsRead}- onRefreshInbox={refreshInbox}- />+ {/* Compact only: loose skeletons keep their context-free metrics. The dynamic+ loading fallback renders inside this provider, so it follows density too. */}+ <NavPanelDensityContext value={compact ? interfaceDensity : undefined}>+ <Content+ category={category}+ isRead={isRead}+ onArchive={handleArchive}+ onMarkAsRead={handleMarkAsRead}+ onRefreshInbox={refreshInbox}+ />+ </NavPanelDensityContext></Flexbox></Flexbox></Flexbox>diff --git a/src/features/HomeTeamBoard/AttentionList.tsx b/src/features/HomeTeamBoard/AttentionList.tsxindex 4f3829c8025..94c6d473a2c 100644--- a/src/features/HomeTeamBoard/AttentionList.tsx+++ b/src/features/HomeTeamBoard/AttentionList.tsx@@ -10,6 +10,7 @@ import AgentAvatar from '@/components/AgentAvatar';import AuthorChip from '@/features/HomeInbox/AuthorChip';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';import { formatDuration } from './layout';@@ -33,6 +34,7 @@ const styles = stylex.create({paddingBlock: 16,paddingInline: 16,},+ cardCompact: { paddingBlock: 12, paddingInline: 12 },count: { color: cssVar.colorTextTertiary, fontSize: 12 },// Folded: a slim column that still says how much is waiting, so putting the// list away never hides that something is stuck.@@ -87,12 +89,14 @@ const styles = stylex.create({textAlign: 'start',width: 'calc(100% + 16px)',},+ itemCompact: { paddingBlock: 6 },meta: { flexShrink: 0, fontSize: 12, whiteSpace: 'nowrap' },});const Item = ({ item, now }: { item: AgentRunBoardAttentionItem; now: Date }) => {const { t } = useTranslation('home');const openDrawer = useOpenRunDrawer();+ const compact = useInterfaceDensity() === 'compact';const failed = item.kind === 'failed';const canAct = item.isMine && !failed;const elapsed = formatDuration(now.getTime() - item.since.getTime());@@ -103,7 +107,7 @@ const Item = ({ item, now }: { item: AgentRunBoardAttentionItem; now: Date }) =>data-testid={`team-board-attention-${item.kind}`}disabled={!item.topicId}type={'button'}- {...stylex.props(styles.item)}+ {...stylex.props(styles.item, compact && styles.itemCompact)}onClick={() =>openDrawer({agentId: item.agentId,@@ -122,7 +126,7 @@ const Item = ({ item, now }: { item: AgentRunBoardAttentionItem; now: Date }) =>name={item.agentTitle ?? undefined}size={20}/>- <Text ellipsis style={{ flex: 1 }} weight={500}>+ <Text ellipsis fontSize={compact ? 13 : undefined} style={{ flex: 1 }} weight={500}>{title}</Text>{!item.isMine && <AuthorChip avatarOnly userId={item.ownerUserId} />}@@ -173,6 +177,7 @@ const Section = ({const AttentionList = ({ items, now }: { items: AgentRunBoardAttentionItem[]; now: Date }) => {const { t } = useTranslation('home');+ const compact = useInterfaceDensity() === 'compact';const collapsed = useGlobalStore(systemStatusSelectors.teamBoardAttentionCollapsed);const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);const setCollapsed = (next: boolean) =>@@ -188,7 +193,11 @@ const AttentionList = ({ items, now }: { items: AgentRunBoardAttentionItem[]; no].filter((section) => section.items.length > 0);const card = (- <Flexbox gap={16} {...stylex.props(styles.card)} data-testid={'team-board-attention'}>+ <Flexbox+ gap={compact ? 12 : 16}+ {...stylex.props(styles.card, compact && styles.cardCompact)}+ data-testid={'team-board-attention'}+ >{sections.map((section, index) => (<Sectionitems={section.items}diff --git a/src/features/HomeTeamBoard/Timeline.tsx b/src/features/HomeTeamBoard/Timeline.tsxindex 08841a7605e..e7a5de5d0ef 100644--- a/src/features/HomeTeamBoard/Timeline.tsx+++ b/src/features/HomeTeamBoard/Timeline.tsx@@ -11,6 +11,7 @@ import { useWorkspaceMemberProfiles } from '@/business/client/hooks/useWorkspaceimport AgentAvatar from '@/components/AgentAvatar';import { useAgentDisplayMeta } from '@/features/AgentTasks/shared/useAgentDisplayMeta';import AuthorChip from '@/features/HomeInbox/AuthorChip';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';import {@@ -51,6 +52,8 @@ const styles = stylex.create({paddingInline: 0,textAlign: 'start',},+ // 4px + 20px avatar + 4px = the 28px compact section header.+ agentCompact: { paddingBlock: 4 },moreButton: {backgroundColor: 'transparent',borderStyle: 'none',@@ -88,6 +91,7 @@ const styles = stylex.create({paddingBlock: 16,paddingInline: 16,},+ cardCompact: { paddingBlock: 12, paddingInline: 12 },gridLine: {backgroundColor: cssVar.colorFillQuaternary,bottom: 0,@@ -357,6 +361,7 @@ const Lane = ({}) => {const { t } = useTranslation('home');const meta = useAgentDisplayMeta(lane.agentId);+ const compact = useInterfaceDensity() === 'compact';const [collapsed, setCollapsed] = useState(false);const [expanded, setExpanded] = useState(false);const { overflow, rows } = layoutLaneTopics(lane.runs, windowStart, now, { expanded });@@ -368,7 +373,7 @@ const Lane = ({aria-expanded={!collapsed}data-testid={'team-board-lane-toggle'}type={'button'}- {...stylex.props(styles.agent)}+ {...stylex.props(styles.agent, compact && styles.agentCompact)}onClick={() => setCollapsed((value) => !value)}><Icon@@ -381,9 +386,9 @@ const Lane = ({avatar={lane.avatar ?? undefined}background={lane.backgroundColor ?? undefined}name={agentTitle}- size={24}+ size={compact ? 20 : 24}/>- <Text ellipsis weight={500}>+ <Text ellipsis fontSize={compact ? 13 : undefined} weight={500}>{agentTitle}</Text><AuthorChip avatarOnly userId={lane.ownerUserId} />@@ -432,12 +437,13 @@ const Lane = ({const Timeline = ({ board }: { board: AgentRunBoardData }) => {const { t } = useTranslation('home');+ const compact = useInterfaceDensity() === 'compact';const { generatedAt, hiddenLaneCount, lanes, windowStart } = board;const ticks = buildAxisTicks(windowStart, generatedAt);const tickPercent = (index: number) => `${axisPercent(ticks[index], windowStart, generatedAt)}%`;return (- <div {...stylex.props(styles.card)}>+ <div {...stylex.props(styles.card, compact && styles.cardCompact)}><div {...stylex.props(styles.axis)}>{ticks.map((tick, index) => (<spandiff --git a/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx b/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsxindex 79436c2b838..22e9c6641ac 100644--- a/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx+++ b/src/features/LibraryModal/AssignKnowledgeBase/Item/index.tsx@@ -7,6 +7,7 @@ import { memo, type ReactNode } from 'react';import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';import KnowledgeIcon from '@/components/KnowledgeIcon';import { buildFilePath, buildLibraryPath } from '@/features/ResourceManager/utils/resourcePath';+import { useInterfaceDensity } from '@/styles/density';import { type KnowledgeItem, KnowledgeType } from '@/types/knowledgeBase';import Actions from './Action';@@ -29,7 +30,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,title: css`margin: 0 !important;- font-size: 14px;+ font-size: var(--lobe-density-font-size);line-height: 1;`,}));@@ -68,13 +69,16 @@ const PluginItem = memo<PluginItemProps>(.filter(Boolean).join(' Β· ');+ const compact = useInterfaceDensity() === 'compact';+ const iconSize = compact ? 28 : 40;+return (<Flexboxhorizontalalign={'center'}gap={8}justify={'space-between'}- paddingBlock={12}+ paddingBlock={compact ? 6 : 12}paddingInline={16}style={{ position: 'relative' }}>@@ -89,7 +93,7 @@ const PluginItem = memo<PluginItemProps>(fileType={fileType}locked={memberRestricted}name={name}- size={{ file: 40, repo: 40 }}+ size={{ file: iconSize, repo: iconSize }}type={type}/><Flexbox flex={1} gap={4} style={{ overflow: 'hidden', position: 'relative' }}>diff --git a/src/features/LobeBench/CaseTable.tsx b/src/features/LobeBench/CaseTable.tsxindex b216faff054..f26e6ac9036 100644--- a/src/features/LobeBench/CaseTable.tsx+++ b/src/features/LobeBench/CaseTable.tsx@@ -41,6 +41,7 @@ import { openCreateDatasetModal } from '@/features/LobeBench/PicksDatasetModal';import { type LobeBenchCase, useDatasetCases } from '@/features/LobeBench/useLobeBench';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { agentEvalService } from '@/services/agentEval';+import { useInterfaceDensity } from '@/styles/density';/** The preset Memory records an attempt starts with, flattened across layers. */const presetMemoryRecords = (environment?: EvalCaseEnvironment) =>@@ -91,6 +92,11 @@ const styles = stylex.create({borderRadius: cssVar.borderRadius,backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },},+ // Compact density: 6px block padding and 13px text β ~34px rows.+ rowCompact: {+ paddingBlock: 6,+ fontSize: 13,+ },mono: { fontFamily: cssVar.fontFamilyCode, fontVariantNumeric: 'tabular-nums' },pre: {overflow: 'auto',@@ -142,6 +148,7 @@ type EditorState = { draft?: CaseDraft; testCase?: LobeBenchCase } | undefined;const CaseTable = memo<CaseTableProps>(({ benchmarkIds, dataset, editable, memberships, selectable }) => {const { t } = useTranslation('eval');+ const compact = useInterfaceDensity() === 'compact';const navigate = useWorkspaceAwareNavigate();const datasetId = dataset?.id;const benchmarkId = dataset?.benchmarkId ?? benchmarkIds[0];@@ -427,8 +434,12 @@ const CaseTable = memo<CaseTableProps>(<divkey={item.id}className={- stylex.props(styles.table, picking && styles.tableSelectable, styles.row)- .className+ stylex.props(+ styles.table,+ picking && styles.tableSelectable,+ styles.row,+ compact && styles.rowCompact,+ ).className}onClick={() => setOpen(item)}>diff --git a/src/features/LobeBench/ExperimentCaseRow.tsx b/src/features/LobeBench/ExperimentCaseRow.tsxindex a04de7a9eb6..875c21be49c 100644--- a/src/features/LobeBench/ExperimentCaseRow.tsx+++ b/src/features/LobeBench/ExperimentCaseRow.tsx@@ -3,6 +3,8 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import type { CSSProperties } from 'react';+import { useInterfaceDensity } from '@/styles/density';+import type { CaseAttempt } from './caseResults';const styles = stylex.create({@@ -22,6 +24,8 @@ const styles = stylex.create({cursor: 'pointer',},cell: { paddingBlock: 8, paddingInline: 8, minWidth: 0 },+ // Compact density: 4px cell padding and 28px heat chips β ~48px rows.+ cellCompact: { paddingBlock: 4 },index: {color: cssVar.colorTextQuaternary,fontFamily: cssVar.fontFamilyCode,@@ -36,6 +40,7 @@ const styles = stylex.create({fontFamily: cssVar.fontFamilyCode,fontSize: 12,},+ heatCompact: { minHeight: 28 },});interface ExperimentCaseRowProps {@@ -55,31 +60,39 @@ export const ExperimentCaseRow = ({results,subtitle,title,-}: ExperimentCaseRowProps) => (- <button- className={stylex.props(styles.row).className}- style={{ gridTemplateColumns: columns }}- type={'button'}- onClick={onOpen}- >- <Flexbox className={stylex.props(styles.cell).className} gap={2}>- <Text ellipsis fontSize={13}>- <span className={stylex.props(styles.index).className}>{index}</span>- {title}- </Text>- <Text ellipsis fontSize={11} type={'secondary'}>- {subtitle}- </Text>- </Flexbox>- {results.map((result) => (- <div className={stylex.props(styles.cell).className} key={result.id}>- <div className={stylex.props(styles.heat).className} style={result.style}>- {result.label}+}: ExperimentCaseRowProps) => {+ const compact = useInterfaceDensity() === 'compact';+ const cellClassName = stylex.props(styles.cell, compact && styles.cellCompact).className;++ return (+ <button+ className={stylex.props(styles.row).className}+ style={{ gridTemplateColumns: columns }}+ type={'button'}+ onClick={onOpen}+ >+ <Flexbox className={cellClassName} gap={2}>+ <Text ellipsis fontSize={13}>+ <span className={stylex.props(styles.index).className}>{index}</span>+ {title}+ </Text>+ <Text ellipsis fontSize={11} type={'secondary'}>+ {subtitle}+ </Text>+ </Flexbox>+ {results.map((result) => (+ <div className={cellClassName} key={result.id}>+ <div+ className={stylex.props(styles.heat, compact && styles.heatCompact).className}+ style={result.style}+ >+ {result.label}+ </div></div>- </div>- ))}- </button>-);+ ))}+ </button>+ );+};export const verdictStyle = (verdict: CaseAttempt['verdict']) => {switch (verdict) {diff --git a/src/features/LobeBench/Layout/Sidebar/Body.tsx b/src/features/LobeBench/Layout/Sidebar/Body.tsxindex 7f3e29d74df..b0773b96d69 100644--- a/src/features/LobeBench/Layout/Sidebar/Body.tsx+++ b/src/features/LobeBench/Layout/Sidebar/Body.tsx@@ -126,8 +126,8 @@ const Body = memo(() => {style={{ gap: 8 }}><AccordionItem value={'experiments'}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('lobeBench.sidebar.experiments')}</SectionTitle>{experiments.length > 0 && (@@ -224,8 +224,8 @@ const Body = memo(() => {</AccordionItem>{/* Same three groups as the Evaluation Lab: experiments, benchmarks, datasets. */}<AccordionItem value={'benchmarks'}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('lobeBench.sidebar.benchmarks')}</SectionTitle>{benchmarks.length > 0 && (@@ -281,8 +281,8 @@ const Body = memo(() => {{/* The datasets the benchmarks are made of, then the account's own (casespicked from the library, or its own), flat like the Evaluation Lab's list. */}<AccordionItem value={'datasets'}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('lobeBench.sidebar.datasets')}</SectionTitle>{sidebarDatasets.length > 0 && (diff --git a/src/features/MemoryEntities/EntityList/ListItem.tsx b/src/features/MemoryEntities/EntityList/ListItem.tsxindex e5dd8ae4190..1776baf22d7 100644--- a/src/features/MemoryEntities/EntityList/ListItem.tsx+++ b/src/features/MemoryEntities/EntityList/ListItem.tsx@@ -2,6 +2,9 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { memo } from 'react';+import { useInterfaceDensity } from '@/styles/density';+import { sidebarRow } from '@/styles/density.stylex';+import KindIcon from '../components/KindIcon';import { useEntityFormat } from '../format';import { type MemoryEntity } from '../types';@@ -10,7 +13,7 @@ const styles = stylex.create({row: {alignItems: 'flex-start',backgroundColor: {- default: 'transparent',+ 'default': 'transparent',':hover': cssVar.colorFillTertiary,},borderRadius: cssVar.borderRadius,@@ -24,9 +27,10 @@ const styles = stylex.create({textAlign: 'start',width: '100%',},+ rowCompact: { paddingBlock: '6px' },active: {backgroundColor: {- default: cssVar.colorFillSecondary,+ 'default': cssVar.colorFillSecondary,':hover': cssVar.colorFillSecondary,},},@@ -35,7 +39,7 @@ const styles = stylex.create({titleLine: { alignItems: 'baseline', display: 'flex', gap: '8px' },title: {flex: '1',- fontSize: '14px',+ fontSize: sidebarRow.textFontSize,fontWeight: 500,lineHeight: '20px',minWidth: 0,@@ -73,22 +77,28 @@ interface ListItemProps {*/const ListItem = memo<ListItemProps>(({ active, entity, lastTouchedAt, muted, onSelect }) => {const format = useEntityFormat();+ const compact = useInterfaceDensity() === 'compact';return (- <button- aria-current={active ? 'page' : undefined}- type={'button'}- {...stylex.props(styles.row, active && styles.active, muted && styles.muted)}- onClick={() => onSelect(entity.id)}- >- <KindIcon kind={entity.kind} />- <span {...stylex.props(styles.body)}>- <span {...stylex.props(styles.titleLine)}>- <span {...stylex.props(styles.title)}>{format.title(entity)}</span>- <span {...stylex.props(styles.meta)}>{format.ago(lastTouchedAt)}</span>+ <button+ aria-current={active ? 'page' : undefined}+ type={'button'}+ {...stylex.props(+ styles.row,+ compact && styles.rowCompact,+ active && styles.active,+ muted && styles.muted,+ )}+ onClick={() => onSelect(entity.id)}+ >+ <KindIcon kind={entity.kind} />+ <span {...stylex.props(styles.body)}>+ <span {...stylex.props(styles.titleLine)}>+ <span {...stylex.props(styles.title)}>{format.title(entity)}</span>+ <span {...stylex.props(styles.meta)}>{format.ago(lastTouchedAt)}</span>+ </span>+ <span {...stylex.props(styles.now)}>{entity.summary || entity.description}</span></span>- <span {...stylex.props(styles.now)}>{entity.summary || entity.description}</span>- </span>- </button>+ </button>);});diff --git a/src/features/MemoryEntities/states.tsx b/src/features/MemoryEntities/states.tsxindex 79e2687c587..d2b772f87dc 100644--- a/src/features/MemoryEntities/states.tsx+++ b/src/features/MemoryEntities/states.tsx@@ -6,6 +6,7 @@ import { memo } from 'react';import { useTranslation } from 'react-i18next';import MemoryAnalysis from '@/routes/(main)/memory/features/MemoryAnalysis';+import { useInterfaceDensity } from '@/styles/density';import KindIcon from './components/KindIcon';import { useEntityFormat } from './format';@@ -68,6 +69,8 @@ const styles = stylex.create({paddingInline: '16px',width: '320px',},+ // Compact entity rows are 4px shorter (6px block padding), so the skeleton pitch follows.+ loadingListCompact: { gap: '12px' },loadingRow: { alignItems: 'flex-start', display: 'flex', gap: '12px' },loadingPage: {display: 'flex',@@ -131,27 +134,31 @@ export const ErrorState = memo<{ onRetry: () => void }>(({ onRetry }) => {ErrorState.displayName = 'ErrorState';/** Same frame as the loaded page, so nothing jumps when data arrives. */-export const LoadingState = memo(() => (- <div aria-busy {...stylex.props(styles.loading)}>- <div {...stylex.props(styles.loadingList)}>- <Skeleton height={22} width={64} />- <Skeleton height={32} radius={8} width={'100%'} />- {Array.from({ length: 7 }, (_, i) => (- <div key={i} {...stylex.props(styles.loadingRow)}>- <SkeletonAvatar shape={'square'} size={24} />- <SkeletonText fontSize={12} rows={2} width={['60%', '90%']} />+export const LoadingState = memo(() => {+ const compact = useInterfaceDensity() === 'compact';++ return (+ <div aria-busy {...stylex.props(styles.loading)}>+ <div {...stylex.props(styles.loadingList, compact && styles.loadingListCompact)}>+ <Skeleton height={22} width={64} />+ <Skeleton height={32} radius={8} width={'100%'} />+ {Array.from({ length: 7 }, (_, i) => (+ <div key={i} {...stylex.props(styles.loadingRow)}>+ <SkeletonAvatar shape={'square'} size={24} />+ <SkeletonText fontSize={12} rows={2} width={['60%', '90%']} />+ </div>+ ))}+ </div>+ <div {...stylex.props(styles.loadingPage)}>+ <div {...stylex.props(styles.loadingRow)}>+ <SkeletonAvatar shape={'square'} size={40} />+ <SkeletonText fontSize={20} rows={2} width={['40%', '25%']} /></div>- ))}- </div>- <div {...stylex.props(styles.loadingPage)}>- <div {...stylex.props(styles.loadingRow)}>- <SkeletonAvatar shape={'square'} size={40} />- <SkeletonText fontSize={20} rows={2} width={['40%', '25%']} />+ <SkeletonText fontSize={17} rows={3} width={['15%', '100%', '70%']} />+ <SkeletonText rows={6} width={['15%', '90%', '60%', '95%', '80%', '50%']} /></div>- <SkeletonText fontSize={17} rows={3} width={['15%', '100%', '70%']} />- <SkeletonText rows={6} width={['15%', '90%', '60%', '95%', '80%', '50%']} /></div>- </div>-));+ );+});LoadingState.displayName = 'LoadingState';diff --git a/src/features/MemoryRules/GroupSection.tsx b/src/features/MemoryRules/GroupSection.tsxindex ea9b56ad1e5..3cdee3d27bc 100644--- a/src/features/MemoryRules/GroupSection.tsx+++ b/src/features/MemoryRules/GroupSection.tsx@@ -13,6 +13,7 @@ import { ChevronRightIcon, MoreHorizontalIcon, PlusIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';import type { RuleGroup } from '@/services/expertise';+import { useInterfaceDensity } from '@/styles/density';import { useScopeLabel } from './labels';import { styles } from './styles';@@ -34,12 +35,20 @@ const GroupSection = ({ collapsed, count, group, menu, onToggle, onWrite }: Grouconst { t } = useTranslation('memory');const scopeLabel = useScopeLabel();const owner = group.owner;+ const compact = useInterfaceDensity() === 'compact';const onlyItsAgent =owner.kind === 'agent' &&group.scopes.every((scope) => scope.kind === 'agent' && scope.id === owner.agent.id);return (- <div className={cx(styles.section, collapsed && styles.sectionCollapsed)} onClick={onToggle}>+ <div+ className={cx(+ styles.section,+ compact && styles.sectionCompact,+ collapsed && styles.sectionCollapsed,+ )}+ onClick={onToggle}+ ><span className={cx(styles.chevron, !collapsed && styles.chevronOpen)}><Icon icon={ChevronRightIcon} size={14} /></span>diff --git a/src/features/MemoryRules/RuleRow.tsx b/src/features/MemoryRules/RuleRow.tsxindex 86eebe122e8..12e1e2ef877 100644--- a/src/features/MemoryRules/RuleRow.tsx+++ b/src/features/MemoryRules/RuleRow.tsx@@ -16,6 +16,7 @@ import { MoreHorizontalIcon } from 'lucide-react';import { useTranslation } from 'react-i18next';import type { RuleItem } from '@/services/expertise';+import { useInterfaceDensity } from '@/styles/density';import DirectionToggle from './DirectionToggle';import EnforcementToggle from './EnforcementToggle';@@ -57,6 +58,7 @@ const RuleRow = ({const { t } = useTranslation('memory');const archived = rule.status === 'retired';const authored = rule.authored;+ const compact = useInterfaceDensity() === 'compact';const archivedWhy = archivedInto? t('rules.archived.mergedInto', { title: archivedInto })@@ -68,6 +70,7 @@ const RuleRow = ({className={cx(styles.grid,styles.row,+ compact && styles.rowCompact,styles.rowHover,active && styles.rowActive,archived && styles.rowArchived,diff --git a/src/features/MemoryRules/styles.ts b/src/features/MemoryRules/styles.tsindex ed715f1e00f..d340209b36b 100644--- a/src/features/MemoryRules/styles.ts+++ b/src/features/MemoryRules/styles.ts@@ -115,6 +115,9 @@ export const styles = createStaticStyles(({ css }) => ({rowArchived: css`color: ${cssVar.colorTextTertiary};`,+ rowCompact: css`+ padding-block: 6px;+ `,rowHover: css`&:hover [data-hover] {opacity: 1;@@ -156,6 +159,11 @@ export const styles = createStaticStyles(({ css }) => ({sectionCollapsed: css`background: ${cssVar.colorFillQuaternary};`,+ // Compact group rows sit on the shared section-header height.+ sectionCompact: css`+ height: var(--lobe-density-control-height);+ margin-block-start: 6px;+ `,sectionCount: css`font-size: 12px;font-weight: 400;diff --git a/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsxindex 54a43593846..6a90be4ca45 100644--- a/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx+++ b/src/features/ModelSwitchPanel/components/List/GenerationListItemRenderer.tsx@@ -28,6 +28,7 @@ import type { ListItem } from '@/features/ModelSwitchPanel/types';import { menuKey } from '@/features/ModelSwitchPanel/utils';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';+import { useInterfaceDensity } from '@/styles/density';import type { EnabledProviderWithModels } from '@/types/index';import GenerationMultipleProvidersItem from './GenerationMultipleProvidersItem';@@ -47,6 +48,7 @@ const GenerationListItemRenderer = memo<GenerationListItemRendererProps>(const { t } = useTranslation('components');const navigate = useWorkspaceAwareNavigate();const activeSlug = useActiveWorkspaceSlug();+ const compact = useInterfaceDensity() === 'compact';const [detailOpen, setDetailOpen] = useState(false);switch (item.type) {@@ -74,8 +76,8 @@ const GenerationListItemRenderer = memo<GenerationListItemRendererProps>(horizontalclassName={modelSwitchPanelStyles.groupHeader}justify="space-between"- paddingBlock="12px 4px"- paddingInline="12px 8px"+ paddingBlock={compact ? '8px 2px' : '12px 4px'}+ paddingInline={compact ? '10px 8px' : '12px 8px'}><ProviderItemRenderlogo={item.provider.logo}@@ -129,9 +131,9 @@ const GenerationListItemRenderer = memo<GenerationListItemRendererProps>(<Flexbox style={{ marginBlock: 1, marginInline: 4 }}><DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}><DropdownMenuSubmenuTrigger- style={{ paddingBlock: 8, paddingInline: 8 }}className={cx(menuSharedStyles.item,+ modelSwitchPanelStyles.rowTrigger,isActive && modelSwitchPanelStyles.menuItemActive,)}onClick={() => {@@ -171,9 +173,9 @@ const GenerationListItemRenderer = memo<GenerationListItemRendererProps>(<Flexbox style={{ marginBlock: 1, marginInline: 4 }}><DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}><DropdownMenuSubmenuTrigger- style={{ paddingBlock: 8, paddingInline: 8 }}className={cx(menuSharedStyles.item,+ modelSwitchPanelStyles.rowTrigger,isActive && modelSwitchPanelStyles.menuItemActive,)}onClick={() => {diff --git a/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx b/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsxindex 6f4ff8da9dc..38e42765c47 100644--- a/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx+++ b/src/features/ModelSwitchPanel/components/List/GenerationMultipleProvidersItem.tsx@@ -47,8 +47,11 @@ const GenerationMultipleProvidersItem = memo<GenerationMultipleProvidersItemProp<Flexbox style={{ marginBlock: 1, marginInline: 4 }}><DropdownMenuSubmenuRoot open={subOpen} onOpenChange={setSubOpen}><DropdownMenuSubmenuTrigger- className={cx(menuSharedStyles.item, isActive && modelSwitchPanelStyles.menuItemActive)}- style={{ paddingBlock: 8, paddingInline: 8 }}+ className={cx(+ menuSharedStyles.item,+ modelSwitchPanelStyles.rowTrigger,+ isActive && modelSwitchPanelStyles.menuItemActive,+ )}onClick={() => {setSubOpen(false);onModelChange(item.data.model.id, (activeProvider ?? item.data.providers[0]).id);diff --git a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsxindex 15713f80e0c..eaa4184c8a3 100644--- a/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx+++ b/src/features/ModelSwitchPanel/components/List/ListItemRenderer.tsx@@ -21,6 +21,7 @@ import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaimport { ProviderItemRender } from '@/components/ModelSelect';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import { buildWorkspaceAwarePath } from '@/features/Workspace/workspaceAwarePath';+import { useInterfaceDensity } from '@/styles/density';import { styles } from '../../styles';import { type ListItem } from '../../types';@@ -62,6 +63,7 @@ export const ListItemRenderer = memo<ListItemRendererProps>(const { t } = useTranslation('components');const navigate = useWorkspaceAwareNavigate();const activeSlug = useActiveWorkspaceSlug();+ const compact = useInterfaceDensity() === 'compact';const [detailOpen, setDetailOpen] = useState(false);const selectModel = async (modelId: string, providerId: string) => {@@ -104,8 +106,8 @@ export const ListItemRenderer = memo<ListItemRendererProps>(className={styles.groupHeader}justify="space-between"key={`header-${item.provider.id}`}- paddingBlock={'12px 4px'}- paddingInline={'12px 8px'}+ paddingBlock={compact ? '8px 2px' : '12px 4px'}+ paddingInline={compact ? '10px 8px' : '12px 8px'}><ProviderItemRenderlogo={item.provider.logo}@@ -162,8 +164,11 @@ export const ListItemRenderer = memo<ListItemRendererProps>(<Flexbox style={{ marginBlock: 1, marginInline: 4 }}><DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}><DropdownMenuSubmenuTrigger- className={cx(menuSharedStyles.item, isActive && styles.menuItemActive)}- style={{ paddingBlock: 8, paddingInline: 8 }}+ className={cx(+ menuSharedStyles.item,+ styles.rowTrigger,+ isActive && styles.menuItemActive,+ )}onClick={(e) => {e.preventDefault();setDetailOpen(false);@@ -208,8 +213,11 @@ export const ListItemRenderer = memo<ListItemRendererProps>(<Flexbox style={{ marginBlock: 1, marginInline: 4 }}><DropdownMenuSubmenuRoot open={detailOpen} onOpenChange={setDetailOpen}><DropdownMenuSubmenuTrigger- className={cx(menuSharedStyles.item, isActive && styles.menuItemActive)}- style={{ paddingBlock: 8, paddingInline: 8 }}+ className={cx(+ menuSharedStyles.item,+ styles.rowTrigger,+ isActive && styles.menuItemActive,+ )}onClick={(e) => {e.preventDefault();setDetailOpen(false);diff --git a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsxindex dec6dd03604..de306bb700c 100644--- a/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx+++ b/src/features/ModelSwitchPanel/components/List/MultipleProvidersModelItem.tsx@@ -19,6 +19,7 @@ import { memo, useState } from 'react';import { useTranslation } from 'react-i18next';import { ProviderItemRender } from '@/components/ModelSelect';+import { useDensityTokens } from '@/styles/density';import { styles } from '../../styles';import { type ModelWithProviders } from '../../types';@@ -56,6 +57,7 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(onRestrictedModelClick,}) => {const { t } = useTranslation('components');+ const { iconSize } = useDensityTokens();const [submenuOpen, setSubmenuOpen] = useState(false);const activeProvider = data.providers.find((p) => menuKey(p.id, data.model.id) === activeKey);@@ -87,8 +89,11 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(}}><DropdownMenuSubmenuTrigger- className={cx(menuSharedStyles.item, isActive && styles.menuItemActive)}- style={{ paddingBlock: 8, paddingInline: 8 }}+ className={cx(+ menuSharedStyles.item,+ styles.rowTrigger,+ isActive && styles.menuItemActive,+ )}onClick={() => {if (defaultProviderRestricted) {onRestrictedModelClick?.();@@ -153,7 +158,7 @@ export const MultipleProvidersModelItem = memo<MultipleProvidersModelItemProps>(logo={p.logo}name={p.name}provider={p.id}- size={20}+ size={iconSize}source={p.source}type={'avatar'}/>diff --git a/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx b/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsxindex 374c6568197..a2d12ed0e8a 100644--- a/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx+++ b/src/features/ModelSwitchPanel/components/ModelDetailPanel.tsx@@ -35,7 +35,7 @@ export type { PricingMode } from '../types';const styles = createStaticStyles(({ css, cssVar }) => ({actionText: css`- font-size: 14px;+ font-size: var(--lobe-density-font-size);font-weight: 500;color: ${cssVar.colorText};`,@@ -53,7 +53,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({`,radarClickable: css`cursor: pointer;- border-radius: 8px;+ border-radius: var(--lobe-density-radius);transition: background 0.2s ${cssVar.motionEaseInOut};&:hover {@@ -89,7 +89,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({font-variant-numeric: tabular-nums;`,titleText: css`- font-size: 14px;+ font-size: var(--lobe-density-font-size);font-weight: 400;color: ${cssVar.colorTextSecondary};`,diff --git a/src/features/ModelSwitchPanel/components/Toolbar.tsx b/src/features/ModelSwitchPanel/components/Toolbar.tsxindex b05409da846..c9b244cfd74 100644--- a/src/features/ModelSwitchPanel/components/Toolbar.tsx+++ b/src/features/ModelSwitchPanel/components/Toolbar.tsx@@ -4,6 +4,8 @@ import { Brain } from 'lucide-react';import { memo } from 'react';import { useTranslation } from 'react-i18next';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';+import { styles } from '../styles';import { type GroupMode } from '../types';@@ -18,6 +20,8 @@ interface ToolbarProps {export const Toolbar = memo<ToolbarProps>(({ groupMode, onGroupModeChange, searchKeyword, onSearchKeywordChange, showGroupModeSwitch }) => {const { t } = useTranslation('components');+ const compact = useInterfaceDensity() === 'compact';+ const { toolbarHeight } = useDensityTokens();return (<Flexbox@@ -25,8 +29,9 @@ export const Toolbar = memo<ToolbarProps>(align="center"className={styles.toolbar}gap={4}+ height={toolbarHeight}justify="space-between"- paddingBlock={8}+ paddingBlock={compact ? 4 : 8}paddingInline={8}width="100%">diff --git a/src/features/ModelSwitchPanel/hooks/usePanelSize.ts b/src/features/ModelSwitchPanel/hooks/usePanelSize.tsindex fa6608c178e..6ae6118c658 100644--- a/src/features/ModelSwitchPanel/hooks/usePanelSize.ts+++ b/src/features/ModelSwitchPanel/hooks/usePanelSize.ts@@ -2,24 +2,19 @@ import { useCallback, useMemo } from 'react';import { useGlobalStore } from '@/store/global';import { systemStatusSelectors } from '@/store/global/selectors/systemStatus';+import { useDensityTokens } from '@/styles/density';-import {- FOOTER_HEIGHT,- ITEM_HEIGHT,- MAX_PANEL_HEIGHT,- TOOLBAR_HEIGHT,-} from '../const';+import { FOOTER_HEIGHT, MAX_PANEL_HEIGHT } from '../const';export const usePanelSize = (enabledListLength: number) => {const panelWidth = useGlobalStore(systemStatusSelectors.modelSwitchPanelWidth);const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);+ const { controlHeight, toolbarHeight } = useDensityTokens();const panelHeight = useMemo(() =>- enabledListLength === 0- ? TOOLBAR_HEIGHT + ITEM_HEIGHT['no-provider'] + FOOTER_HEIGHT- : MAX_PANEL_HEIGHT,- [enabledListLength],+ enabledListLength === 0 ? toolbarHeight + controlHeight + FOOTER_HEIGHT : MAX_PANEL_HEIGHT,+ [controlHeight, enabledListLength, toolbarHeight],);const handlePanelWidthChange = useCallback(diff --git a/src/features/ModelSwitchPanel/styles.ts b/src/features/ModelSwitchPanel/styles.tsindex d25c4c575ad..25b63738983 100644--- a/src/features/ModelSwitchPanel/styles.ts+++ b/src/features/ModelSwitchPanel/styles.ts@@ -22,6 +22,15 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({padding-inline: 8px;border-radius: ${cssVar.borderRadiusSM};}++ html[data-density='compact'] & [role='menuitem'] {+ min-height: var(--lobe-density-control-height);+ padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);+ border-radius: var(--lobe-density-radius);++ font-size: var(--lobe-density-font-size);+ line-height: 20px;+ }`,groupHeader: css`width: 100%;@@ -46,6 +55,28 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({padding-block: 8px;padding-inline: 8px;border-radius: ${cssVar.borderRadiusSM};++ html[data-density='compact'] & {+ min-height: var(--lobe-density-control-height);+ padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);+ border-radius: var(--lobe-density-radius);++ font-size: var(--lobe-density-font-size);+ line-height: 20px;+ }+ `,+ rowTrigger: css`+ padding-block: 8px;+ padding-inline: 8px;++ html[data-density='compact'] & {+ min-height: var(--lobe-density-control-height);+ padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);+ border-radius: var(--lobe-density-radius);++ font-size: var(--lobe-density-font-size);+ line-height: 20px;+ }`,menuItemActive: css`background: ${cssVar.colorFillTertiary};diff --git a/src/features/NavPanel/SideBarDrawer.tsx b/src/features/NavPanel/SideBarDrawer.tsxindex 7b883f38175..218126ace7f 100644--- a/src/features/NavPanel/SideBarDrawer.tsx+++ b/src/features/NavPanel/SideBarDrawer.tsx@@ -17,6 +17,7 @@ import { useHeaderActionSize } from '@/styles/density';import SkeletonList from './components/SkeletonList';import { NAV_PANEL_RIGHT_DRAWER_ID } from './constants';+import { useNavItemMetrics } from './density';import { OverlayContainerContext } from './OverlayContainer';import SideBarHeaderLayout from './SideBarHeaderLayout';@@ -58,6 +59,7 @@ interface SideBarDrawerProps {const SideBarDrawer = memo<SideBarDrawerProps>(({ subHeader, open, onClose, children, title, action, width = DRAWER_WIDTH }) => {const headerActionSize = useHeaderActionSize(true);+ const { headerLabelFontSize, headerLabelWeight } = useNavItemMetrics();const [overlayContainer, setOverlayContainer] = useState<HTMLDivElement | null>(null);const [portalContainer, setPortalContainer] = useState<HTMLElement | null>(null);@@ -92,9 +94,9 @@ const SideBarDrawer = memo<SideBarDrawerProps>(typeof title === 'string' ? (<Textellipsis- fontSize={14}- style={{ fontWeight: 600, paddingLeft: 8 }}- weight={400}+ fontSize={headerLabelFontSize}+ style={{ paddingLeft: 8 }}+ weight={headerLabelWeight}>{title}</Text>diff --git a/src/features/NavPanel/components/EmptyNavItem.tsx b/src/features/NavPanel/components/EmptyNavItem.tsxindex d370b0d5335..f447c3081ba 100644--- a/src/features/NavPanel/components/EmptyNavItem.tsx+++ b/src/features/NavPanel/components/EmptyNavItem.tsx@@ -2,6 +2,8 @@ import { Block, Center, Icon, Text } from '@lobehub/ui';import { PlusIcon } from 'lucide-react';import { memo } from 'react';+import { useNavItemMetrics } from '../density';+interface EmptyStatusProps {className?: string;disabled?: boolean;@@ -10,26 +12,36 @@ interface EmptyStatusProps {}const EmptyNavItem = memo<EmptyStatusProps>(({ title, onClick, className, disabled }) => {+ const metrics = useNavItemMetrics();+ const mergedStyle =+ disabled || metrics.radius !== undefined+ ? {+ ...(metrics.radius === undefined ? undefined : { borderRadius: metrics.radius }),+ ...(disabled ? { cursor: 'not-allowed', opacity: 0.5 } : undefined),+ }+ : undefined;+return (<Blockhorizontalalign={'center'}className={className}clickable={!disabled}- gap={8}- height={32}- paddingInline={2}- style={disabled ? { cursor: 'not-allowed', opacity: 0.5 } : undefined}+ gap={metrics.gap}+ height={metrics.rowHeight}+ paddingInline={metrics.paddingInline}+ style={mergedStyle}variant={'borderless'}onClick={disabled ? undefined : onClick}>- <Center flex={'none'} height={28} width={28}>+ <Center flex={'none'} height={metrics.iconBox} width={metrics.iconBox}><Icon icon={PlusIcon} size={'small'} /></Center>{/* One line like a NavItem: a long title (e.g. in a narrow sidebar) truncatesinstead of wrapping out of the fixed-height row. */}<Textellipsis={{ tooltipWhenOverflow: true }}+ fontSize={metrics.fontSize}style={{ flex: 1, minWidth: 0 }}type={'secondary'}>diff --git a/src/features/NavPanel/components/NavItem.tsx b/src/features/NavPanel/components/NavItem.tsxindex 099591509a1..9ba25898ef9 100644--- a/src/features/NavPanel/components/NavItem.tsx+++ b/src/features/NavPanel/components/NavItem.tsx@@ -268,7 +268,7 @@ const NavItem = memo<NavItemProps>(// With a description the row is two lines tall; align the leading icon// to the title's first line (match its line-height) instead of letting// it center across both lines, which drops it into the gap.- height={description ? 22 : metrics.iconBox}+ height={description ? metrics.lineHeight : metrics.iconBox}style={description ? { alignSelf: 'flex-start' } : undefined}width={metrics.iconBox}>@@ -289,7 +289,7 @@ const NavItem = memo<NavItemProps>(data-nav-item=""gap={metrics.gap}height={description ? undefined : metrics.rowHeight}- paddingBlock={description ? 8 : undefined}+ paddingBlock={description ? metrics.twoLinePaddingBlock : undefined}paddingInline={metrics.paddingInline}style={mergedStyle}variant={variant}@@ -337,7 +337,7 @@ const NavItem = memo<NavItemProps>(>{titlePrefix}{description ? (- <Flexbox flex={1} gap={3} style={{ overflow: 'hidden' }}>+ <Flexbox flex={1} gap={metrics.twoLineGap} style={{ overflow: 'hidden' }}>{titleNode}{description}</Flexbox>diff --git a/src/features/NavPanel/components/NavPanelDraggable.tsx b/src/features/NavPanel/components/NavPanelDraggable.tsxindex 9e9a4e388e4..b6814f1078a 100644--- a/src/features/NavPanel/components/NavPanelDraggable.tsx+++ b/src/features/NavPanel/components/NavPanelDraggable.tsx@@ -84,12 +84,12 @@ const draggableStyles = createStaticStyles(({ css, cssVar }) => ({width 0.2s ${cssVar.motionEaseOut};}#${BACK_BUTTON_ID} {- width: 24px !important;+ width: var(--lobe-density-icon-box) !important;}&:hover {#${TOGGLE_BUTTON_ID} {- width: 32px !important;+ width: var(--lobe-density-icon-box) !important;opacity: 1;}diff --git a/src/features/NavPanel/density.ts b/src/features/NavPanel/density.tsindex f2d786a6ad1..36c9cd9b67e 100644--- a/src/features/NavPanel/density.ts+++ b/src/features/NavPanel/density.ts@@ -2,7 +2,7 @@ import { type InterfaceDensity } from '@lobechat/types';import { cssVar } from '@lobehub/ui';import { useContext } from 'react';-import { DENSITY_TOKENS, PanelDensityContext } from '@/styles/density';+import { DENSITY_TOKENS, PanelDensityContext, useInterfaceDensity } from '@/styles/density';export interface NavItemMetrics {fontSize: number;@@ -15,6 +15,7 @@ export interface NavItemMetrics {headerTitleWeight: number;iconBox: number;iconSize: number;+ lineHeight: number;paddingInline: number;panelPaddingInline: number;radius?: number;@@ -23,6 +24,8 @@ export interface NavItemMetrics {sectionLabelColor: string;sectionTriggerPaddingBlock: number;sectionTriggerPaddingInline: string;+ twoLineGap: number;+ twoLinePaddingBlock: number;}const SECTION_ACTION_SIZE = 24;@@ -42,6 +45,7 @@ export const resolveNavItemMetrics = (density: InterfaceDensity | null): NavItemheaderTitleWeight: compact ? 600 : 500,iconBox: tokens.iconBox,iconSize: tokens.iconSize,+ lineHeight: tokens.lineHeight,paddingInline: tokens.paddingInline,panelPaddingInline: tokens.panelPaddingInline,radius: density ? tokens.radius : undefined,@@ -50,10 +54,15 @@ export const resolveNavItemMetrics = (density: InterfaceDensity | null): NavItemsectionLabelColor: compact ? cssVar.colorTextTertiary : cssVar.colorTextSecondary,sectionTriggerPaddingBlock: (tokens.sectionHeaderHeight - SECTION_ACTION_SIZE) / 2,sectionTriggerPaddingInline: compact ? '6px 4px' : '8px 4px',+ twoLineGap: compact ? 2 : 3,+ twoLinePaddingBlock: compact ? 6 : 8,};};export const NavPanelDensityContext = PanelDensityContext;-export const useNavItemMetrics = (): NavItemMetrics =>- resolveNavItemMetrics(useContext(NavPanelDensityContext));+export const useNavItemMetrics = (): NavItemMetrics => {+ const contextDensity = useContext(NavPanelDensityContext);+ const interfaceDensity = useInterfaceDensity();+ return resolveNavItemMetrics(contextDensity === undefined ? interfaceDensity : contextDensity);+};diff --git a/src/features/NavPanel/switcher/SwitcherRow.tsx b/src/features/NavPanel/switcher/SwitcherRow.tsxindex 00458f2b49e..3b1c1183b5d 100644--- a/src/features/NavPanel/switcher/SwitcherRow.tsx+++ b/src/features/NavPanel/switcher/SwitcherRow.tsx@@ -18,7 +18,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({flex: none;padding-inline: 8px;- border-radius: ${cssVar.borderRadius};+ border-radius: var(--lobe-density-radius);&:hover {background: ${cssVar.colorFillTertiary};diff --git a/src/features/Pages/PageLayout/Header/AddButton.tsx b/src/features/Pages/PageLayout/Header/AddButton.tsxindex b974a761fa9..8c4a8557c19 100644--- a/src/features/Pages/PageLayout/Header/AddButton.tsx+++ b/src/features/Pages/PageLayout/Header/AddButton.tsx@@ -7,9 +7,11 @@ import { useTranslation } from 'react-i18next';import { usePermission } from '@/hooks/usePermission';import { pageActions } from '@/store/page';+import { useHeaderActionSize } from '@/styles/density';const AddButton = memo(() => {const { t } = useTranslation('file');+ const headerActionSize = useHeaderActionSize(true);const { allowed: canCreate } = usePermission('create_content');const handleNewDocument = () => {@@ -23,7 +25,7 @@ const AddButton = memo(() => {<ActionIcondisabled={!canCreate}icon={SquarePenIcon}- size={{ blockSize: 32, size: 18 }}+ size={headerActionSize}title={t('header.newPageButton')}onClick={handleNewDocument}/>diff --git a/src/features/Portal/components/Header.tsx b/src/features/Portal/components/Header.tsxindex dd513c48a1b..745594cb72c 100644--- a/src/features/Portal/components/Header.tsx+++ b/src/features/Portal/components/Header.tsx@@ -41,7 +41,7 @@ const Header = memo<{return (<NavHeadershowTogglePanelButton={false}- style={{ paddingBlock: 8, paddingInline, width: '100%', ...style }}+ style={{ paddingInline, width: '100%', ...style }}left={<Flexbox horizontal align="center" flex={1} gap={4} style={{ minWidth: 0 }}>{canGoBack && (diff --git a/src/features/Projects/KnowledgeBases/index.tsx b/src/features/Projects/KnowledgeBases/index.tsxindex c60a9d0f0b9..f42199e1f24 100644--- a/src/features/Projects/KnowledgeBases/index.tsx+++ b/src/features/Projects/KnowledgeBases/index.tsx@@ -16,7 +16,7 @@ import KnowledgeIcon from '@/components/KnowledgeIcon';import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';import type { ProjectDetail } from '@/store/project';import { useProjectStore } from '@/store/project';-import { useDensityTokens } from '@/styles/density';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import { KnowledgeType } from '@/types/knowledgeBase';import { openAddKnowledgeBaseModal } from './AddKnowledgeBaseModal';@@ -26,6 +26,7 @@ type ProjectKnowledgeBase = NonNullable<ProjectDetail['knowledgeBases']>[number]export function ProjectKnowledgeBaseSettings({ detail }: { detail: ProjectDetail }) {const { t } = useTranslation('project');const { pageTitleFontSize } = useDensityTokens();+ const compact = useInterfaceDensity() === 'compact';const navigate = useWorkspaceAwareNavigate();const updateProjectKnowledgeBase = useProjectStore((s) => s.updateProjectKnowledgeBase);const removeProjectKnowledgeBase = useProjectStore((s) => s.removeProjectKnowledgeBase);@@ -91,12 +92,13 @@ export function ProjectKnowledgeBaseSettings({ detail }: { detail: ProjectDetailalign="center"gap={12}key={item.knowledgeBase.id}- padding={16}+ paddingBlock={compact ? 8 : 16}+ paddingInline={16}style={index ? { borderTop: `1px solid ${cssVar.colorBorderSecondary}` } : undefined}><KnowledgeIconname={item.knowledgeBase.name}- size={28}+ size={compact ? 24 : 28}type={KnowledgeType.KnowledgeBase}/><Flexboxdiff --git a/src/features/Projects/LinearSync/IssueList.tsx b/src/features/Projects/LinearSync/IssueList.tsxindex b9951c4b955..784e3bde8a3 100644--- a/src/features/Projects/LinearSync/IssueList.tsx+++ b/src/features/Projects/LinearSync/IssueList.tsx@@ -13,6 +13,7 @@ import useSWRInfinite from 'swr/infinite';import LinearIcon from '@/features/Integrations/Linear/LinearIcon';import { linearKeys } from '@/features/Integrations/Linear/swrKeys';import { type LinearIssueFilterParams, linearService } from '@/services/linear';+import { useInterfaceDensity } from '@/styles/density';import StateIcon from './StateIcon';import { linearIssueListCounts, linearSyncErrorMessage } from './utils';@@ -26,6 +27,13 @@ const styles = stylex.create({bodyWithoutHead: {height: 360,},+ // Compact: 32px header and rows; the headless body still adds the header back.+ bodyWithoutHeadCompact: {+ height: 352,+ },+ compactLine: {+ height: 32,+ },frame: {borderColor: cssVar.colorBorder,borderRadius: cssVar.borderRadiusLG,@@ -80,6 +88,7 @@ interface IssueListProps {/** The issues matching the filter, pick-able one by one, newest activity first. */const IssueList = memo<IssueListProps>(({ disabled, filter, onSelectionChange, selected }) => {const { t } = useTranslation('integration');+ const compact = useInterfaceDensity() === 'compact';const { data, error, isLoading, isValidating, setSize, size } = useSWRInfinite((index: number, previous: LinearIssuePage | null) => {@@ -125,7 +134,8 @@ const IssueList = memo<IssueListProps>(({ disabled, filter, onSelectionChange, sbody = placeholder(<Text type={'danger'}>{linearSyncErrorMessage(error, t)}</Text>);} else if (isLoading || !data) {body = (- <Flexbox gap={12} padding={12}>+ // Compact: 16px bars on a 32px pitch, centred on the rows they stand in for.+ <Flexbox gap={compact ? 16 : 12} padding={compact ? 8 : 12}>{[0, 1, 2, 3].map((index) => (<Skeleton height={16} key={index} />))}@@ -144,7 +154,11 @@ const IssueList = memo<IssueListProps>(({ disabled, filter, onSelectionChange, salign={'center'}gap={12}key={issue.id}- {...stylex.props(styles.row, disabled && styles.rowDisabled)}+ {...stylex.props(+ styles.row,+ compact && styles.compactLine,+ disabled && styles.rowDisabled,+ )}onClick={(event) => {// The checkbox and the Linear link handle their own clicks.const target = event.target as HTMLElement;@@ -207,7 +221,12 @@ const IssueList = memo<IssueListProps>(({ disabled, filter, onSelectionChange, sreturn (<div {...stylex.props(styles.frame)}>{filter ? (- <Flexbox horizontal align={'center'} gap={12} {...stylex.props(styles.head)}>+ <Flexbox+ horizontal+ align={'center'}+ gap={12}+ {...stylex.props(styles.head, compact && styles.compactLine)}+ ><Checkboxaria-label={t('linear.sync.list.selectAll', { count: issues.length })}checked={allSelected}@@ -227,7 +246,14 @@ const IssueList = memo<IssueListProps>(({ disabled, filter, onSelectionChange, s) : null}</Flexbox>) : null}- <div {...stylex.props(styles.body, !filter && styles.bodyWithoutHead)}>{body}</div>+ <div+ {...stylex.props(+ styles.body,+ !filter && (compact ? styles.bodyWithoutHeadCompact : styles.bodyWithoutHead),+ )}+ >+ {body}+ </div></div>);});diff --git a/src/features/Projects/Members/index.tsx b/src/features/Projects/Members/index.tsxindex 68990bd1f14..bed55982e4c 100644--- a/src/features/Projects/Members/index.tsx+++ b/src/features/Projects/Members/index.tsx@@ -35,7 +35,7 @@ import { useHomeStore } from '@/store/home';import { homeAgentListSelectors } from '@/store/home/selectors';import type { ProjectDetail } from '@/store/project';import { useProjectStore } from '@/store/project';-import { useDensityTokens } from '@/styles/density';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import { directoryAgentName } from '../WorkingDirectories/useDirectoryAgent';import { openEditMemberModal } from './EditMemberModal';@@ -63,6 +63,8 @@ const rowStyle = (index: number) =>export function ProjectMemberSettings({ detail }: { detail: ProjectDetail }) {const { t } = useTranslation('project');const { pageTitleFontSize } = useDensityTokens();+ const compact = useInterfaceDensity() === 'compact';+ const rowPaddingBlock = compact ? 8 : 16;const [inviteOpen, setInviteOpen] = useState(false);const addProjectAgents = useProjectStore((s) => s.addProjectAgents);const updateProjectAgent = useProjectStore((s) => s.updateProjectAgent);@@ -205,7 +207,8 @@ export function ProjectMemberSettings({ detail }: { detail: ProjectDetail }) {align="center"gap={12}key={member.agent.id}- padding={16}+ paddingBlock={rowPaddingBlock}+ paddingInline={16}style={rowStyle(index)}><WorkspaceLink@@ -217,7 +220,7 @@ export function ProjectMemberSettings({ detail }: { detail: ProjectDetail }) {avatar={member.agent.avatar}background={member.agent.backgroundColor ?? undefined}shape={'circle'}- size={36}+ size={compact ? 28 : 36}title={name}/><Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>@@ -279,7 +282,12 @@ export function ProjectMemberSettings({ detail }: { detail: ProjectDetail }) {);})}{members.length <= 1 && (- <Flexbox gap={4} padding={16} style={rowStyle(members.length)}>+ <Flexbox+ gap={4}+ paddingBlock={rowPaddingBlock}+ paddingInline={16}+ style={rowStyle(members.length)}+ ><Text type="secondary">{t('members.empty')}</Text></Flexbox>)}diff --git a/src/features/Projects/ProjectCreator/index.tsx b/src/features/Projects/ProjectCreator/index.tsxindex d45f8dabdcf..f83ef8e5258 100644--- a/src/features/Projects/ProjectCreator/index.tsx+++ b/src/features/Projects/ProjectCreator/index.tsx@@ -10,6 +10,7 @@ import { useHasActiveWorkspace } from '@/business/client/hooks/useHasActiveWorksimport UserAvatar from '@/components/UserAvatar';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';+import { useInterfaceDensity } from '@/styles/density';export interface ProjectCreatorProps {createdAt: Date | string;@@ -23,6 +24,7 @@ export interface ProjectCreatorProps {*/const ProjectCreator = memo<ProjectCreatorProps>(({ createdAt, userId }) => {const { t } = useTranslation('project');+ const compact = useInterfaceDensity() === 'compact';const hasActiveWorkspace = useHasActiveWorkspace();const member = useAuthorInfo(userId);const currentUserId = useUserStore(userProfileSelectors.userId);@@ -36,7 +38,7 @@ const ProjectCreator = memo<ProjectCreatorProps>(({ createdAt, userId }) => {const name = creator?.fullName || t('settings.creatorUnknown');return (- <Flexbox horizontal align="center" gap={12} paddingBlock={12} paddingInline={16}>+ <Flexbox horizontal align="center" gap={12} paddingBlock={compact ? 8 : 12} paddingInline={16}><UserAvatar avatar={creator?.avatar} name={name} size={28} /><Flexbox flex={1} style={{ minWidth: 0 }}><Text ellipsis>{name}</Text>diff --git a/src/features/Projects/Review/MemberRow.tsx b/src/features/Projects/Review/MemberRow.tsxindex 713c23bf727..9c86e4954c4 100644--- a/src/features/Projects/Review/MemberRow.tsx+++ b/src/features/Projects/Review/MemberRow.tsx@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';import UserAvatar from '@/components/UserAvatar';import type { ProjectMemberItem } from '@/services/projectReview';+import { useInterfaceDensity } from '@/styles/density';interface MemberRowProps {busy: boolean;@@ -16,8 +17,9 @@ interface MemberRowProps {export function MemberRow({ busy, isCreator, member, onRoleChange }: MemberRowProps) {const { t } = useTranslation('project');const name = member.user?.name ?? member.userId;+ const compact = useInterfaceDensity() === 'compact';return (- <Flexbox horizontal align="center" gap={12} paddingBlock={12} paddingInline={16}>+ <Flexbox horizontal align="center" gap={12} paddingBlock={compact ? 8 : 12} paddingInline={16}><UserAvatar avatar={member.user?.avatar} name={name} size={28} /><Flexbox flex={1} style={{ minWidth: 0 }}><Text ellipsis>{name}</Text>diff --git a/src/features/Projects/Review/MembersSettings.tsx b/src/features/Projects/Review/MembersSettings.tsxindex 155c79703fe..d699474a29d 100644--- a/src/features/Projects/Review/MembersSettings.tsx+++ b/src/features/Projects/Review/MembersSettings.tsx@@ -10,7 +10,7 @@ import { projectReviewService } from '@/services/projectReview';import type { ProjectDetail } from '@/store/project';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';-import { useDensityTokens } from '@/styles/density';+import { useDensityTokens, useInterfaceDensity } from '@/styles/density';import ProjectCreator from '../ProjectCreator';import { openAddMemberModal } from './AddMemberModal';@@ -25,6 +25,7 @@ interface MembersSettingsProps {export function MembersSettings({ project }: MembersSettingsProps) {const { t } = useTranslation('project');const { pageTitleFontSize } = useDensityTokens();+ const compact = useInterfaceDensity() === 'compact';const projectId = project.id;const { data, error, mutate } = useProjectMembers(projectId);const actorId = useUserStore(userProfileSelectors.userId);@@ -99,7 +100,7 @@ export function MembersSettings({ project }: MembersSettingsProps) {<Block variant="outlined">{!creatorHasRole && creatorRow}{!members.length && (- <Text style={{ padding: '12px 16px' }} type="secondary">+ <Text style={{ padding: compact ? '8px 16px' : '12px 16px' }} type="secondary">{t('review.members.empty')}</Text>)}diff --git a/src/features/ResourceManager/components/Editor/index.tsx b/src/features/ResourceManager/components/Editor/index.tsxindex f2daf9d96b6..82d9b8db668 100644--- a/src/features/ResourceManager/components/Editor/index.tsx+++ b/src/features/ResourceManager/components/Editor/index.tsx@@ -12,6 +12,7 @@ import { PageAgentProvider } from '@/features/PageEditor/PageAgentProvider';import FileDetailComponent from '@/features/ResourceManager/FileDetail';import { useResourceManagerStore } from '@/features/ResourceManager/store';import { fileManagerSelectors, useFileStore } from '@/store/file';+import { useDensityTokens, useHeaderActionSize } from '@/styles/density';import { downloadFile } from '@/utils/client/downloadFile';import { isMobileSurface } from '@/utils/mobileSurface';@@ -59,6 +60,8 @@ const openFileDetailModal = () =>const FileEditorCanvas = memo<FileEditorProps>(({ onBack }) => {const { t } = useTranslation(['common', 'file']);const theme = useTheme();+ const { controlHeight, fontSize } = useDensityTokens();+ const headerActionSize = useHeaderActionSize(true);const currentViewItemId = useResourceManagerStore((s) => s.currentViewItemId);@@ -79,14 +82,19 @@ const FileEditorCanvas = memo<FileEditorProps>(({ onBack }) => {horizontalalign={'center'}gap={12}- style={{ minHeight: 32, minWidth: 0, overflow: 'hidden' }}+ style={{ minHeight: controlHeight, minWidth: 0, overflow: 'hidden' }}>- <ActionIcon icon={ArrowLeftIcon} title={t('back')} onClick={onBack} />+ <ActionIcon+ icon={ArrowLeftIcon}+ size={headerActionSize}+ title={t('back')}+ onClick={onBack}+ /><spantitle={fileDetail?.name}style={{color: theme.colorText,- fontSize: 14,+ fontSize,fontWeight: 500,overflow: 'hidden',textOverflow: 'ellipsis',@@ -103,6 +111,7 @@ const FileEditorCanvas = memo<FileEditorProps>(({ onBack }) => {{fileDetail?.url && (<ActionIconicon={DownloadIcon}+ size={headerActionSize}title={t('download', { ns: 'common' })}onClick={() => {if (fileDetail?.url && fileDetail?.name) {@@ -111,7 +120,7 @@ const FileEditorCanvas = memo<FileEditorProps>(({ onBack }) => {}}/>)}- <ActionIcon icon={InfoIcon} onClick={openFileDetailModal} />+ <ActionIcon icon={InfoIcon} size={headerActionSize} onClick={openFileDetailModal} /></Flexbox>}style={{diff --git a/src/features/ResourceManager/components/Explorer/FileDetailPanel/index.tsx b/src/features/ResourceManager/components/Explorer/FileDetailPanel/index.tsxindex 5043773db6d..bea0660de93 100644--- a/src/features/ResourceManager/components/Explorer/FileDetailPanel/index.tsx+++ b/src/features/ResourceManager/components/Explorer/FileDetailPanel/index.tsx@@ -7,6 +7,7 @@ import { memo, useState } from 'react';import FileDetail from '@/features/ResourceManager/FileDetail';import { useResourceManagerStore } from '@/features/ResourceManager/store';+import { useDensityTokens, useHeaderActionSize } from '@/styles/density';import { downloadFile } from '@/utils/client/downloadFile';import FilePreview from './FilePreview';@@ -23,6 +24,8 @@ import { DETAIL_PANEL_MIN_WIDTH, useDetailPanelWidth } from './useDetailPanelWid*/const FileDetailPanel = memo(() => {const theme = useTheme();+ const { fontSize, headerHeight } = useDensityTokens();+ const headerActionSize = useHeaderActionSize(true);const detailPanelId = useResourceManagerStore((s) => s.detailPanelId);const detailPanelIsPage = useResourceManagerStore((s) => s.detailPanelIsPage);const closeDetailPanel = useResourceManagerStore((s) => s.closeDetailPanel);@@ -57,14 +60,14 @@ const FileDetailPanel = memo(() => {style={{flexShrink: 0,borderBottom: `1px solid ${cssVar.colorBorderSecondary}`,- minHeight: 48,+ minHeight: headerHeight,}}><spantitle={fileDetail.name}style={{color: theme.colorText,- fontSize: 14,+ fontSize,fontWeight: 500,minWidth: 0,overflow: 'hidden',@@ -78,6 +81,7 @@ const FileDetailPanel = memo(() => {{fileDetail.url && (<ActionIconicon={DownloadIcon}+ size={headerActionSize}title={i18nT('download', { ns: 'common' })}onClick={() => {if (fileDetail.url) downloadFile(fileDetail.url, fileDetail.name);@@ -87,11 +91,13 @@ const FileDetailPanel = memo(() => {<ActionIconactive={showProperties}icon={InfoIcon}+ size={headerActionSize}title={i18nT('detail.basic.title', { ns: 'file' })}onClick={() => setShowProperties((value) => !value)}/><ActionIconicon={PanelRightCloseIcon}+ size={headerActionSize}title={i18nT('close', { ns: 'common' })}onClick={closeDetailPanel}/>diff --git a/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx b/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsxindex a2d45b3d0f0..26b803facc6 100644--- a/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx+++ b/src/features/ResourceManager/components/Explorer/Header/SearchInput.tsx@@ -7,9 +7,11 @@ import { memo, useCallback, useEffect, useRef, useState } from 'react';import { useTranslation } from 'react-i18next';import { useResourceManagerStore } from '@/features/ResourceManager/store';+import { useHeaderActionSize } from '@/styles/density';const SearchInput = memo(() => {const { t } = useTranslation('components');+ const headerActionSize = useHeaderActionSize(true);const [expanded, setExpanded] = useState(false);const [showIcon, setShowIcon] = useState(true);const [localQuery, setLocalQuery] = useState('');@@ -85,7 +87,12 @@ const SearchInput = memo(() => {/></div>{showIcon && (- <ActionIcon icon={SearchIcon} style={{ marginRight: 4 }} onClick={handleExpand} />+ <ActionIcon+ icon={SearchIcon}+ size={headerActionSize}+ style={{ marginRight: 4 }}+ onClick={handleExpand}+ />)}</>);diff --git a/src/features/ResourceManager/components/Explorer/Header/index.tsx b/src/features/ResourceManager/components/Explorer/Header/index.tsxindex d6af4ffa14d..5014a68913a 100644--- a/src/features/ResourceManager/components/Explorer/Header/index.tsx+++ b/src/features/ResourceManager/components/Explorer/Header/index.tsx@@ -14,6 +14,7 @@ import { openWorkspaceDeleteAllModal } from '@/features/WorkspaceDeleteAllModal'import { useIsMobile } from '@/hooks/useIsMobile';import { usePermission } from '@/hooks/usePermission';import { useFileStore } from '@/store/file';+import { useHeaderActionSize } from '@/styles/density';import AddButton from '../../Header/AddButton';import BatchActionsDropdown from '../ToolBar/BatchActionsDropdown';@@ -29,6 +30,7 @@ import SearchInput from './SearchInput';*/const Header = memo(() => {const { t } = useTranslation(['components', 'common', 'file', 'knowledgeBase']);+ const headerActionSize = useHeaderActionSize(true);const activeWorkspaceId = useActiveWorkspaceId();@@ -69,6 +71,7 @@ const Header = memo(() => {<ActionIcondisabled={!canEditResources}icon={BookMinusIcon}+ size={headerActionSize}title={canEditResources ? t('FileManager.actions.removeFromLibrary') : reason}onClick={() => {if (!canEditResources) return;@@ -94,6 +97,7 @@ const Header = memo(() => {<ActionIcondisabled={!canEditResources}icon={FileBoxIcon}+ size={headerActionSize}title={canEditResources ? t('FileManager.actions.batchChunking') : reason}onClick={async () => {if (!canEditResources) return;@@ -106,6 +110,7 @@ const Header = memo(() => {disabled={!canEditResources}icon={action.icon}key={action.key}+ size={headerActionSize}title={canEditResources ? action.label : reason}onClick={() => {if (!canEditResources) return;@@ -117,6 +122,7 @@ const Header = memo(() => {<ActionIcondisabled={!canEditResources}icon={Trash2Icon}+ size={headerActionSize}title={canEditResources? t(isWorkspaceDeleteAll ? 'FileManager.actions.deleteAll' : 'delete', {diff --git a/src/features/ResourceManager/components/Explorer/ListView/ListViewHeader.tsx b/src/features/ResourceManager/components/Explorer/ListView/ListViewHeader.tsxindex 5b6d905fa9c..88cabecf8ec 100644--- a/src/features/ResourceManager/components/Explorer/ListView/ListViewHeader.tsx+++ b/src/features/ResourceManager/components/Explorer/ListView/ListViewHeader.tsx@@ -128,7 +128,7 @@ const ListViewHeader = ({minWidth: getListViewMinWidth(showUploader),}}>- <Center height={40} style={{ paddingInline: 4 }}>+ <Center height={'var(--lobe-density-toolbar-height)'} style={{ paddingInline: 4 }}><Checkboxchecked={allSelected}disabled={!hasSelectableItems}diff --git a/src/features/ResourceManager/components/Explorer/ListView/styles.ts b/src/features/ResourceManager/components/Explorer/ListView/styles.tsindex 0561f6f5e99..1d4b11d962c 100644--- a/src/features/ResourceManager/components/Explorer/ListView/styles.ts+++ b/src/features/ResourceManager/components/Explorer/ListView/styles.ts@@ -12,8 +12,8 @@ export const styles = createStaticStyles(({ css }) => ({`,header: css`min-width: 1040px;- height: 40px;- min-height: 40px;+ height: var(--lobe-density-toolbar-height);+ min-height: var(--lobe-density-toolbar-height);color: ${cssVar.colorTextDescription};`,headerItem: css`@@ -42,7 +42,7 @@ export const styles = createStaticStyles(({ css }) => ({selectAllHint: css`position: sticky;z-index: 1;- inset-block-start: 40px;+ inset-block-start: var(--lobe-density-toolbar-height);min-width: 1040px;padding-block: 8px;diff --git a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsxindex 1c127bd9ed6..4622fffd4ec 100644--- a/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx+++ b/src/features/ResourceManager/components/LibraryHierarchy/HierarchyNode.tsx@@ -8,6 +8,7 @@ import { useTranslation } from 'react-i18next';import { useActiveWorkspaceId } from '@/business/client/hooks/useActiveWorkspaceId';import FileIcon from '@/components/FileIcon';+import { useNavItemMetrics } from '@/features/NavPanel/density';import { PAGE_FILE_TYPE } from '@/features/ResourceManager/constants';import {getTransparentDragImage,@@ -55,6 +56,7 @@ interface HierarchyNodeProps {export const HierarchyNode = memo<HierarchyNodeProps>(({ item, level = 0, flat, isExpanded, isLoading, onToggle, selectedKey, parentKey }) => {+ const metrics = useNavItemMetrics();const navigate = useWorkspaceAwareNavigate();const [setMode, libraryId] = useResourceManagerStore((s) => [s.setMode, s.libraryId]);@@ -323,9 +325,9 @@ export const HierarchyNode = memo<HierarchyNodeProps>(data-is-folder={String(item.isFolder)}data-parent-key={flat ? undefined : parentKey}draggable={!flat}- gap={8}- height={36}- paddingInline={4}+ gap={metrics.gap}+ height={metrics.rowHeight}+ paddingInline={metrics.paddingInline}variant={isActive ? 'filled' : 'borderless'}className={cx(styles.treeItem,@@ -335,7 +337,8 @@ export const HierarchyNode = memo<HierarchyNodeProps>(isDragging && styles.dragging,)}style={{- paddingInlineStart: level * 12 + 4,+ ...(metrics.radius === undefined ? undefined : { borderRadius: metrics.radius }),+ paddingInlineStart: level * 12 + metrics.paddingInline,}}onClick={handleRowClick}onDragEnd={handleDragEnd}@@ -361,10 +364,10 @@ export const HierarchyNode = memo<HierarchyNodeProps>(horizontalalign={'center'}flex={1}- gap={8}- style={{ minHeight: 28, minWidth: 0, overflow: 'hidden' }}+ gap={metrics.gap}+ style={{ minHeight: metrics.iconBox, minWidth: 0, overflow: 'hidden' }}>- <Icon icon={isExpanded ? FolderOpenIcon : FolderIcon} size={18} />+ <Icon icon={isExpanded ? FolderOpenIcon : FolderIcon} size={metrics.iconSize} />{isRenaming ? (<Inputref={inputRef}@@ -389,6 +392,7 @@ export const HierarchyNode = memo<HierarchyNodeProps>(<spanstyle={{flex: 1,+ fontSize: metrics.fontSize,overflow: 'hidden',textOverflow: 'ellipsis',whiteSpace: 'nowrap',@@ -425,9 +429,9 @@ export const HierarchyNode = memo<HierarchyNodeProps>(data-is-folder={false}data-parent-key={flat ? undefined : parentKey}draggable={!flat}- gap={8}- height={36}- paddingInline={4}+ gap={metrics.gap}+ height={metrics.rowHeight}+ paddingInline={metrics.paddingInline}variant={isActive ? 'filled' : 'borderless'}className={cx(styles.treeItem,@@ -437,7 +441,8 @@ export const HierarchyNode = memo<HierarchyNodeProps>(dropPosition === 'after' && styles.dropAfter,)}style={{- paddingInlineStart: level * 12 + 4,+ ...(metrics.radius === undefined ? undefined : { borderRadius: metrics.radius }),+ paddingInlineStart: level * 12 + metrics.paddingInline,}}onClick={handleFileRowClick}onDragEnd={handleDragEnd}@@ -463,25 +468,26 @@ export const HierarchyNode = memo<HierarchyNodeProps>(horizontalalign={'center'}flex={1}- gap={8}- style={{ minHeight: 28, minWidth: 0, overflow: 'hidden' }}+ gap={metrics.gap}+ style={{ minHeight: metrics.iconBox, minWidth: 0, overflow: 'hidden' }}>{isPrivate ? (<Tooltip title={t('resources.visibility.privateTooltip', { ns: 'chat' })}>- <Icon icon={LockIcon} size={18} />+ <Icon icon={LockIcon} size={metrics.iconSize} /></Tooltip>) : isPage ? (emoji ? (- <span style={{ fontSize: 18 }}>{emoji}</span>+ <span style={{ fontSize: metrics.iconSize }}>{emoji}</span>) : (- <Icon icon={FileText} size={18} />+ <Icon icon={FileText} size={metrics.iconSize} />)) : (- <FileIcon fileName={item.name} fileType={item.fileType} size={18} />+ <FileIcon fileName={item.name} fileType={item.fileType} size={metrics.iconSize} />)}<spanstyle={{flex: 1,+ fontSize: metrics.fontSize,overflow: 'hidden',textOverflow: 'ellipsis',whiteSpace: 'nowrap',diff --git a/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx b/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsxindex ad5c8f9d96b..51aab423b60 100644--- a/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx+++ b/src/features/ResourceManager/components/LibraryHierarchy/TreeSkeleton.tsx@@ -9,10 +9,10 @@ const styles = createStaticStyles(({ css, cssVar }) => ({gap: 6px;align-items: center;- height: 32px;+ height: var(--lobe-density-row-height);padding-block: 4px;padding-inline: 8px;- border-radius: ${cssVar.borderRadiusSM};+ border-radius: var(--lobe-density-radius);`,}));diff --git a/src/features/SelfLearning/index.tsx b/src/features/SelfLearning/index.tsxindex 1dc009f593c..6a9abb8b7c2 100644--- a/src/features/SelfLearning/index.tsx+++ b/src/features/SelfLearning/index.tsx@@ -30,6 +30,7 @@ import type { ExpertiseDomainItem } from '@/services/expertise';import { expertiseService } from '@/services/expertise';import { useAgentStore } from '@/store/agent';import { expertiseActions, useExpertiseStore } from '@/store/expertise';+import { useHeaderActionSize } from '@/styles/density';import { countTiers, habitTier } from './helpers';import { useExpertiseOverview, useHistoryCount } from './hooks';@@ -60,6 +61,7 @@ const styles = createStaticStyles(({ css }) => ({*/const SelfLearning = memo(() => {const { t } = useTranslation('selfLearning');+ const headerActionSize = useHeaderActionSize(true);const navigate = useWorkspaceAwareNavigate();const { domainId } = useParams();const activeAgentId = useAgentStore((s) => s.activeAgentId);@@ -274,6 +276,7 @@ const SelfLearning = memo(() => {<ActionIconicon={MoreHorizontalIcon}loading={warmup.starting}+ size={headerActionSize}title={t('domain.more')}/></DropdownMenu>diff --git a/src/features/Setting/SettingContainer.tsx b/src/features/Setting/SettingContainer.tsxindex 79285c620b8..ccb2bd96d17 100644--- a/src/features/Setting/SettingContainer.tsx+++ b/src/features/Setting/SettingContainer.tsx@@ -5,6 +5,8 @@ import { cssVar, Flexbox, useTheme } from '@lobehub/ui';import { type PropsWithChildren, type ReactNode } from 'react';import { memo } from 'react';+import { useInterfaceDensity } from '@/styles/density';+interface SettingContainerProps extends FlexboxProps {addonAfter?: ReactNode;addonBefore?: ReactNode;@@ -14,6 +16,7 @@ interface SettingContainerProps extends FlexboxProps {const SettingContainer = memo<PropsWithChildren<SettingContainerProps>>(({ variant, maxWidth = 1024, children, addonAfter, addonBefore, style, ...rest }) => {const theme = useTheme(); // Keep for colorBgContainerSecondary (not in cssVar)+ const compact = useInterfaceDensity() === 'compact';return (<Flexboxalign={'center'}@@ -31,7 +34,7 @@ const SettingContainer = memo<PropsWithChildren<SettingContainerProps>>({addonBefore}<Flexboxflex={1}- gap={36}+ gap={compact ? 24 : 36}width={'100%'}style={{maxWidth,diff --git a/src/features/Settings/creds/features/CredItem.tsx b/src/features/Settings/creds/features/CredItem.tsxindex ccdfc4d1c8e..2ca1f7e6aa3 100644--- a/src/features/Settings/creds/features/CredItem.tsx+++ b/src/features/Settings/creds/features/CredItem.tsx@@ -26,6 +26,8 @@ import {import { type FC, memo } from 'react';import { useTranslation } from 'react-i18next';+import { useInterfaceDensity } from '@/styles/density';+import { styles } from './style';interface CredItemProps {@@ -62,6 +64,7 @@ const typeColors: Record<string, string> = {const CredItem: FC<CredItemProps> = memo(({ canManage, cred, extraMenuItems = [], onEdit, onDelete, onView, tags }) => {const { t } = useTranslation('setting');+ const compact = useInterfaceDensity() === 'compact';const handleDelete = () => {if (!canManage) return;@@ -116,7 +119,7 @@ const CredItem: FC<CredItemProps> = memo(const renderAvatar = () => {if (cred.type === 'oauth' && cred.oauthAvatar) {- return <Avatar avatar={cred.oauthAvatar} size={32} />;+ return <Avatar avatar={cred.oauthAvatar} size={compact ? 28 : 32} />;}return (// `display: flex` collapses the inline span's line box so the svg sits@@ -131,19 +134,31 @@ const CredItem: FC<CredItemProps> = memo(<Flexboxhorizontalalign="center"- className={stylex.props(styles.container).className}- gap={16}+ className={stylex.props(styles.container, compact && styles.containerCompact).className}+ gap={compact ? 12 : 16}justify="space-between">- <Flexbox horizontal align="center" gap={16} style={{ flex: 1, overflow: 'hidden' }}>- <div {...stylex.props(styles.icon)}>{renderAvatar()}</div>- <Flexbox gap={4} style={{ overflow: 'hidden' }}>+ <Flexbox+ horizontal+ align="center"+ gap={compact ? 12 : 16}+ style={{ flex: 1, overflow: 'hidden' }}+ >+ <div {...stylex.props(styles.icon, compact && styles.iconCompact)}>{renderAvatar()}</div>+ <Flexbox gap={compact ? 2 : 4} style={{ overflow: 'hidden' }}><Flexbox horizontal align="center" gap={8}>- <span {...stylex.props(styles.title)}>{cred.name}</span>+ <span {...stylex.props(styles.title, compact && styles.titleCompact)}>+ {cred.name}+ </span><Tag color={typeColors[cred.type]}>{t(`creds.types.${cred.type}`)}</Tag>{tags}</Flexbox>- <Flexbox horizontal align="center" gap={8}>+ <Flexbox+ horizontal+ align="center"+ gap={8}+ style={{ lineHeight: compact ? '18px' : undefined }}+ ><code {...stylex.props(styles.key)}>{cred.key}</code>{cred.description && (<>diff --git a/src/features/Settings/creds/features/style.ts b/src/features/Settings/creds/features/style.tsindex a2a9e2414a5..8929af09358 100644--- a/src/features/Settings/creds/features/style.ts+++ b/src/features/Settings/creds/features/style.ts@@ -6,6 +6,10 @@ export const styles = stylex.create({paddingBlock: '12px',paddingInline: 0,},+ // Compact density: 6px block padding, 36px tile, 14px title β ~55px two-line rows.+ containerCompact: {+ paddingBlock: '6px',+ },description: {overflow: 'hidden',fontSize: '12px',@@ -24,6 +28,11 @@ export const styles = stylex.create({backgroundColor: cssVar.colorFillTertiary,backgroundImage: 'none',},+ iconCompact: {+ width: '36px',+ height: '36px',+ borderRadius: '10px',+ },key: {fontFamily: 'monospace',fontSize: '12px',@@ -34,4 +43,7 @@ export const styles = stylex.create({fontWeight: 500,color: cssVar.colorText,},+ titleCompact: {+ fontSize: '14px',+ },});diff --git a/src/features/Settings/features/SettingHeader.tsx b/src/features/Settings/features/SettingHeader.tsxindex efa833d3815..7aa9bcf6d58 100644--- a/src/features/Settings/features/SettingHeader.tsx+++ b/src/features/Settings/features/SettingHeader.tsx@@ -1,6 +1,8 @@import { Divider, Flexbox, Text } from '@lobehub/ui';import { type FC, type ReactNode } from 'react';+import { useInterfaceDensity } from '@/styles/density';+interface SettingHeaderProps {description?: ReactNode;extra?: ReactNode;@@ -8,11 +10,13 @@ interface SettingHeaderProps {}const SettingHeader: FC<SettingHeaderProps> = ({ title, description, extra }) => {+ const compact = useInterfaceDensity() === 'compact';+return (- <Flexbox gap={24} style={{ paddingTop: 12 }}>+ <Flexbox gap={compact ? 16 : 24} style={{ paddingTop: 12 }}><Flexbox horizontal align={'center'} justify={'space-between'}><Flexbox gap={4}>- <Text strong fontSize={24}>+ <Text strong fontSize={compact ? 20 : 24}>{title}</Text>{description && <Text type={'secondary'}>{description}</Text>}diff --git a/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx b/src/features/Settings/provider/(list)/ProviderGrid/Card.tsxindex ebaf0e35271..6cb7e1bbc3f 100644--- a/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx+++ b/src/features/Settings/provider/(list)/ProviderGrid/Card.tsx@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';import { BrandingProviderCard } from '@/business/client/features/BrandingProviderCard';import { ProviderCombine, ProviderIcon } from '@/components/LobeIcons';import { useIsDark } from '@/hooks/useIsDark';+import { useDensityTokens } from '@/styles/density';import { type AiProviderListItem } from '@/types/aiProvider';import EnableSwitch from './EnableSwitch';@@ -31,6 +32,7 @@ const ProviderCard = memo<ProviderCardProps>(({ id, description, name, enabled, source, logo, loading, onProviderSelect }) => {const { t } = useTranslation('providers');const isDarkMode = useIsDark();+ const { pageTitleFontSize } = useDensityTokens();if (loading)return (@@ -75,7 +77,9 @@ const ProviderCard = memo<ProviderCardProps>(style={{ borderRadius: 6 }}type={'avatar'}/>- <Text style={{ fontSize: 16, fontWeight: 'bold' }}>{name || id}</Text>+ <Text style={{ fontSize: pageTitleFontSize, fontWeight: 'bold' }}>+ {name || id}+ </Text></Flexbox>) : (<ProviderCombine@@ -99,7 +103,9 @@ const ProviderCard = memo<ProviderCardProps>(type={'avatar'}/>)}- <Text style={{ fontSize: 16, fontWeight: 'bold' }}>{name || id}</Text>+ <Text style={{ fontSize: pageTitleFontSize, fontWeight: 'bold' }}>+ {name || id}+ </Text></Flexbox>)}</Flexbox>diff --git a/src/features/Settings/provider/features/ModelList/ModelItem.tsx b/src/features/Settings/provider/features/ModelList/ModelItem.tsxindex ba57c7e3343..489638e78f5 100644--- a/src/features/Settings/provider/features/ModelList/ModelItem.tsx+++ b/src/features/Settings/provider/features/ModelList/ModelItem.tsx@@ -24,6 +24,7 @@ import RoutingBadge from '@/components/ModelSelect/RoutingBadge';import { useIsMobile } from '@/hooks/useIsMobile';import { usePermission } from '@/hooks/usePermission';import { aiModelSelectors, useAiInfraStore } from '@/store/aiInfra';+import { useInterfaceDensity } from '@/styles/density';import { createModelConfigModal } from './ModelConfigModal';import { formatModelPricingLabels } from './pricingLabels';@@ -66,6 +67,7 @@ const ModelItem = memo<ModelItemProps>(const { t } = useTranslation(['modelProvider', 'components', 'models', 'common']);const { modelEditable, showDeployName } = use(ProviderSettingsContext);const { allowed: canManageProvider, reason } = usePermission('manage_provider_key');+ const compact = useInterfaceDensity() === 'compact';const [activeAiProvider, isModelLoading, toggleModelEnabled, removeAiModel] = useAiInfraStore((s) => [@@ -199,13 +201,20 @@ const ModelItem = memo<ModelItemProps>(className={stylex.props(styles.container, stylex.defaultMarker()).className}gap={24}justify={'space-between'}- padding={12}+ paddingBlock={compact ? 4 : 12}+ paddingInline={12}+ style={compact ? { minHeight: 40 } : undefined}width={'100%'}><Flexbox horizontal align={'center'} flex={1} gap={8} style={{ minWidth: 0 }}>- <ModelIcon model={id} size={32} />- <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>- <Flexbox horizontal align={'center'} gap={8}>+ <ModelIcon model={id} size={compact ? 24 : 32} />+ <Flexbox flex={1} gap={compact ? 0 : 2} style={{ minWidth: 0 }}>+ <Flexbox+ horizontal+ align={'center'}+ gap={8}+ style={compact ? { fontSize: 13 } : undefined}+ >{displayName || id}<RoutingBadge id={id} provider={activeAiProvider} />{ModelIdTag}@@ -214,7 +223,14 @@ const ModelItem = memo<ModelItemProps>(</Flexbox><Flexbox horizontal align={'baseline'} gap={8}>{content.length > 0 && (- <Text style={{ color: cssVar.colorTextSecondary, fontSize: 12, marginBottom: 0 }}>+ <Text+ style={{+ color: cssVar.colorTextSecondary,+ fontSize: 12,+ lineHeight: compact ? '16px' : undefined,+ marginBottom: 0,+ }}+ >{content.join(' Β· ')}</Text>)}diff --git a/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx b/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsxindex bde8e86dc5e..822c8e3e283 100644--- a/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx+++ b/src/features/Settings/provider/features/ModelList/ModelTitle/index.tsx@@ -18,6 +18,7 @@ import { useIsMobile } from '@/hooks/useIsMobile';import { usePermission } from '@/hooks/usePermission';import { useAiInfraStore } from '@/store/aiInfra';import { aiModelSelectors } from '@/store/aiInfra/selectors';+import { useDensityTokens } from '@/styles/density';import { createCreateNewModelModal } from '../CreateNewModelModal';import { ProviderSettingsContext } from '../ProviderSettingsContext';@@ -59,6 +60,7 @@ const ModelTitle = memo<ModelFetcherProps>(const { showDeployName } = use(ProviderSettingsContext);const mobile = useIsMobile();+ const { pageTitleFontSize } = useDensityTokens();useEffect(() => {useAiInfraStore.setState({ modelSearchKeyword: '' });@@ -79,7 +81,7 @@ const ModelTitle = memo<ModelFetcherProps>(><Flexbox horizontal align={'center'} gap={0} justify={'space-between'}><Flexbox horizontal align={'center'} gap={8}>- <Text strong style={{ fontSize: 16 }}>+ <Text strong style={{ fontSize: pageTitleFontSize }}>{t('providerModels.list.title')}</Text>diff --git a/src/features/Settings/provider/features/ModelList/SkeletonList.tsx b/src/features/Settings/provider/features/ModelList/SkeletonList.tsxindex 02ae4dbe761..90542c71f6d 100644--- a/src/features/Settings/provider/features/ModelList/SkeletonList.tsx+++ b/src/features/Settings/provider/features/ModelList/SkeletonList.tsx@@ -5,6 +5,8 @@ import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { memo } from 'react';+import { useInterfaceDensity } from '@/styles/density';+const styles = stylex.create({container: {display: 'flex',@@ -14,18 +16,25 @@ const styles = stylex.create({padding: '12px',borderRadius: cssVar.borderRadiusLG,},+ // Mirrors the compact ModelItem row: 4px block padding, 40px floor, 24px icon.+ containerCompact: { minHeight: '40px', paddingBlock: '4px', paddingInline: '12px' },leftContent: { display: 'flex', flex: '1', gap: '8px', alignItems: 'center', minWidth: '0' },rightContent: { display: 'flex', gap: '4px', alignItems: 'center' },textContent: { display: 'flex', flex: '1', flexDirection: 'column', gap: '4px', minWidth: '0' },});export const Placeholder = memo(() => {+ const compact = useInterfaceDensity() === 'compact';+return (- <Flexbox horizontal className={stylex.props(styles.container).className}>+ <Flexbox+ horizontal+ className={stylex.props(styles.container, compact && styles.containerCompact).className}+ ><Flexbox horizontal className={stylex.props(styles.leftContent).className}>- <Skeleton.Avatar shape="square" size={32} style={{ flex: 'none' }} />+ <Skeleton.Avatar shape="square" size={compact ? 24 : 32} style={{ flex: 'none' }} /><Flexbox className={stylex.props(styles.textContent).className}>- <Skeleton height={18} width={160} />+ <Skeleton height={compact ? 20 : 18} width={160} /><Flexbox horizontal gap={4}><Skeleton height={16} width={60} /><Skeleton height={16} width={40} />diff --git a/src/features/Settings/provider/features/ProviderConfig/index.tsx b/src/features/Settings/provider/features/ProviderConfig/index.tsxindex f3ef46dd684..6f1765afa7f 100644--- a/src/features/Settings/provider/features/ProviderConfig/index.tsx+++ b/src/features/Settings/provider/features/ProviderConfig/index.tsx@@ -41,6 +41,7 @@ import { usePermission } from '@/hooks/usePermission';import { lambdaQuery } from '@/libs/trpc/client';import { aiProviderSelectors, useAiInfraStore } from '@/store/aiInfra';import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';+import { useInterfaceDensity } from '@/styles/density';import { sx } from '@/styles/sx';import {type AiProviderDetailItem,@@ -130,6 +131,7 @@ const ProviderConfig = memo<ProviderConfigProps>(supportResponsesApi,} = settings || {};const { t } = useTranslation('modelProvider');+ const compact = useInterfaceDensity() === 'compact';const form = useForm({onValuesChange: (_, values) => handleFormValuesChange(values),});@@ -382,7 +384,7 @@ const ProviderConfig = memo<ProviderConfigProps>(showResponsesApiSwitch? {children: isLoading ? (- <Skeleton height={36} />+ <Skeleton height={compact ? 28 : 36} />) : (<Switch disabled={!canManageProvider} loading={configUpdating} />),@@ -396,7 +398,7 @@ const ProviderConfig = memo<ProviderConfigProps>(showChecker? {children: isLoading ? (- <Skeleton height={36} />+ <Skeleton height={compact ? 28 : 36} />) : (<CheckercheckErrorRender={checkErrorRender}diff --git a/src/features/Settings/skill/features/LeftPanel.tsx b/src/features/Settings/skill/features/LeftPanel.tsxindex 9038b8b6d76..fc6f77c69f6 100644--- a/src/features/Settings/skill/features/LeftPanel.tsx+++ b/src/features/Settings/skill/features/LeftPanel.tsx@@ -8,10 +8,13 @@ import { memo, useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';import { CustomConnectorModal } from '@/features/Connectors';+import { NavPanelDensityContext } from '@/features/NavPanel/density';import { createSkillStoreModal } from '@/features/SkillStore';import { openSkillImportModal } from '@/features/SkillStore/SkillImportModal';import { useConnectorManageable } from '@/hooks/useConnectorManagePolicy';import { usePermission } from '@/hooks/usePermission';+import { useInterfaceDensity } from '@/styles/density';+import { sidebarRow } from '@/styles/density.stylex';import ConnectorManagePolicy from './ConnectorManagePolicy';import { type ToolDetailType } from './SkillDetail';@@ -63,7 +66,7 @@ const styles = stylex.create({gap: '8px',alignItems: 'center',justifyContent: 'space-between',- height: '42px',+ height: sidebarRow.headerHeight,paddingInline: '16px',borderBlockEndWidth: '1px',borderBlockEndStyle: 'solid',@@ -96,6 +99,7 @@ interface LeftPanelProps {const LeftPanel = memo<LeftPanelProps>(({ fullWidth, onDeleteSelected, onSelect, page, selectedIdentifier, viewMode }) => {const { t } = useTranslation(['setting', 'tool']);+ const interfaceDensity = useInterfaceDensity();const [showAddConnector, setShowAddConnector] = useState(false);const [keyword, setKeyword] = useState('');@@ -210,13 +214,13 @@ const LeftPanel = memo<LeftPanelProps>(}return (- <>+ <NavPanelDensityContext value={fullWidth ? null : interfaceDensity}><divclassName={stylex.props(styles.root).className}style={fullWidth ? { borderInlineEnd: 'none', width: '100%' } : undefined}><div {...stylex.props(styles.header)}>- <Text strong style={{ fontSize: 14 }}>+ <Text strong style={{ fontSize: 'var(--lobe-density-font-size)' }}>{isConnectorView? t('skillView.connectors', 'Connectors'): t('skillView.skills', 'Skills')}@@ -275,7 +279,7 @@ const LeftPanel = memo<LeftPanelProps>(</div></div><CustomConnectorModal open={showAddConnector} onClose={() => setShowAddConnector(false)} />- </>+ </NavPanelDensityContext>);},);diff --git a/src/features/Settings/skill/features/SkillListRow.tsx b/src/features/Settings/skill/features/SkillListRow.tsxindex 724b208f25e..93353f183f4 100644--- a/src/features/Settings/skill/features/SkillListRow.tsx+++ b/src/features/Settings/skill/features/SkillListRow.tsx@@ -7,6 +7,7 @@ import { CircleCheck } from 'lucide-react';import { createContext, memo, type ReactNode, use } from 'react';import NavItem, { type NavItemProps } from '@/features/NavPanel/components/NavItem';+import { useInterfaceDensity } from '@/styles/density';/*** `nav` is the compact sidebar row beside a detail pane; `page` is the@@ -34,10 +35,18 @@ const styles = stylex.create({overflow: 'hidden',width: 40,},+ // Compact page row: 6px padding around a 32px tile and a 20 + 2 + 18px text stack β 52px.+ iconTileCompact: {+ height: 32,+ width: 32,+ },row: {minHeight: 64,minWidth: 0,},+ rowCompact: {+ minHeight: 48,+ },trailing: {alignItems: 'center',display: 'flex',@@ -62,6 +71,7 @@ interface SkillListRowProps {const SkillListRow = memo<SkillListRowProps>(({ active, description, extra, icon, onClick, summary, title, titleColor }) => {const variant = useSkillListVariant();+ const compact = useInterfaceDensity() === 'compact';if (variant === 'nav')return (@@ -82,23 +92,33 @@ const SkillListRow = memo<SkillListRowProps>(<Blockhorizontalalign={'center'}- {...stylex.props(styles.row)}+ {...stylex.props(styles.row, compact && styles.rowCompact)}clickable={!!onClick}gap={12}- paddingBlock={12}+ paddingBlock={compact ? 6 : 12}paddingInline={12}variant={'borderless'}onClick={onClick}>- <Center {...stylex.props(styles.iconTile)}>+ <Center {...stylex.props(styles.iconTile, compact && styles.iconTileCompact)}><IconNode /></Center><Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>- <Text ellipsis weight={500}>+ <Text+ ellipsis+ fontSize={compact ? 13 : undefined}+ lineHeight={compact ? '20px' : undefined}+ weight={500}+ >{title}</Text>{summary && (- <Text ellipsis color={cssVar.colorTextSecondary} fontSize={13}>+ <Text+ ellipsis+ color={cssVar.colorTextSecondary}+ fontSize={compact ? 12 : 13}+ lineHeight={compact ? '18px' : undefined}+ >{summary}</Text>)}diff --git a/src/features/Settings/trash/features/ProjectFilter.tsx b/src/features/Settings/trash/features/ProjectFilter.tsxindex b5c0e91bb14..847310b4960 100644--- a/src/features/Settings/trash/features/ProjectFilter.tsx+++ b/src/features/Settings/trash/features/ProjectFilter.tsx@@ -1,15 +1,7 @@'use client';import type { TrashProjectFilter } from '@lobechat/types';-import {- controlHeight,- cssVar,- Flexbox,- Icon,- Select,- type SelectOptions,- Text,-} from '@lobehub/ui';+import { cssVar, Flexbox, Icon, Select, type SelectOptions, Text } from '@lobehub/ui';import { cssVar as sxVar } from '@lobehub/ui/stylex/cssVar.stylex';import * as stylex from '@stylexjs/stylex';import { FolderKanbanIcon, LockIcon } from 'lucide-react';@@ -27,8 +19,9 @@ import {/*** The picker sits beside the type Segmented in one filter row, so it takes- * that track's height (`controlHeight.middle`), radius and surface while- * keeping the small control's 12px text. Open / hover feedback stays.+ * that track's height (the density control height: 32px loose, 28px compact),+ * radius and surface while keeping the small control's 12px text. Open /+ * hover feedback stays.*/const styles = stylex.create({trigger: {@@ -114,7 +107,7 @@ export const ProjectFilter = ({popupMatchSelectWidth={280}prefix={FolderKanbanIcon}size={'small'}- style={{ maxWidth: 260, minHeight: controlHeight.middle, minWidth: 160 }}+ style={{ maxWidth: 260, minHeight: 'var(--lobe-density-control-height)', minWidth: 160 }}// Not `virtual`: the virtual list counts the whole project group as one// row and crashes once search shrinks the options; search is the way// through a long list.diff --git a/src/features/Settings/trash/features/TrashList.tsx b/src/features/Settings/trash/features/TrashList.tsxindex fe693bb5670..222858d7a2c 100644--- a/src/features/Settings/trash/features/TrashList.tsx+++ b/src/features/Settings/trash/features/TrashList.tsx@@ -43,6 +43,7 @@ import { trashSelectors, useTrashStore } from '@/store/trash';import { TrashEmptyScopeChangedError } from '@/store/trash/action';import { useUserStore } from '@/store/user';import { labPreferSelectors, userProfileSelectors } from '@/store/user/selectors';+import { useInterfaceDensity } from '@/styles/density';import DeletedByCell, { DELETED_BY_TEXT_INSET } from './DeletedByCell';import { ProjectFilter } from './ProjectFilter';@@ -69,6 +70,8 @@ const CARD_LAYOUT_QUERY = `@container (max-width: ${TRASH_LIST_BREAKPOINT}px)`;* Type chips on the small control height: with the track's 3px padding and* 1px border the whole Segmented is `controlHeight.middle` tall, level with* the side switch, the project picker and the empty button beside it.+ * Loose only: in compact the global small-Segmented rule (20px chips, 28px+ * track) already lines up with the 28px picker and button.*/const segmentedStyles = { item: { height: controlHeight.small } };@@ -136,6 +139,7 @@ const TrashList = ({ isWorkspace = false }: TrashListProps) => {const { t } = useTranslation('setting');const { t: tc } = useTranslation('common');const mobile = useIsMobile();+ const compact = useInterfaceDensity() === 'compact';const containerRef = useRef<HTMLDivElement>(null);const containerSize = useSize(containerRef);const cardLayout = !!containerSize && containerSize.width <= TRASH_LIST_BREAKPOINT;@@ -495,7 +499,7 @@ const TrashList = ({ isWorkspace = false }: TrashListProps) => {{visibility && (<Segmentedsize={'small'}- styles={segmentedStyles}+ styles={compact ? undefined : segmentedStyles}value={visibility}options={[{ label: t('trash.side.public'), value: 'public' },@@ -511,7 +515,7 @@ const TrashList = ({ isWorkspace = false }: TrashListProps) => {options={typeOptions}size={'small'}style={{ flexWrap: 'wrap', maxWidth: '100%' }}- styles={segmentedStyles}+ styles={compact ? undefined : segmentedStyles}value={activeType ?? 'all'}onChange={(value) =>changeFilter({diff --git a/src/features/SharePopover/style.ts b/src/features/SharePopover/style.tsindex 379a7a52a4f..03507f2150c 100644--- a/src/features/SharePopover/style.ts+++ b/src/features/SharePopover/style.ts@@ -2,9 +2,9 @@ import { createStaticStyles } from '@lobehub/ui';export const styles = createStaticStyles(({ css, cssVar }) => ({badge: css`- width: 32px;- height: 32px;- border-radius: 9px;+ width: var(--lobe-density-icon-box);+ height: var(--lobe-density-icon-box);+ border-radius: var(--lobe-density-radius);color: ${cssVar.colorTextSecondary};@@ -19,7 +19,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({background: ${cssVar.colorSuccessBg};`,container: css`- padding: 16px;+ padding: var(--lobe-density-section-gap);`,divider: css`height: 1px;@@ -50,13 +50,14 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({align-items: center;width: 100%;- min-height: 44px;+ min-height: var(--lobe-density-row-height);margin-block-start: 6px;padding-inline: 10px;border: none;- border-radius: ${cssVar.borderRadius};+ border-radius: var(--lobe-density-radius);font: inherit;+ font-size: var(--lobe-density-font-size);color: ${cssVar.colorText};background: transparent;@@ -75,7 +76,7 @@ export const styles = createStaticStyles(({ css, cssVar }) => ({notice: css`padding-block: 8px;padding-inline: 10px;- border-radius: ${cssVar.borderRadius};+ border-radius: var(--lobe-density-radius);font-size: 12px;line-height: 1.5;diff --git a/src/features/SubscriptionAccounts/AccountRow.tsx b/src/features/SubscriptionAccounts/AccountRow.tsxindex 515015a86ed..27c9c4ef64b 100644--- a/src/features/SubscriptionAccounts/AccountRow.tsx+++ b/src/features/SubscriptionAccounts/AccountRow.tsx@@ -35,6 +35,7 @@ import { UsageBar } from '@/features/DeviceManager/DeviceHealth/UsageMeter';import { type QuotaAccount, useAgentQuotaStore } from '@/store/agentQuota';import { useUserStore } from '@/store/user';import { userProfileSelectors } from '@/store/user/selectors';+import { useInterfaceDensity } from '@/styles/density';import {type AccountStatus,@@ -90,6 +91,8 @@ const styles = stylex.create({},// The account whose panel is open.rowActive: { backgroundColor: cssVar.colorFillSecondary },+ // Compact density: 6px block padding and a 24px provider avatar β ~56px rows.+ rowCompact: { paddingBlock: '6px' },});const PROVIDER_META: Record<@@ -190,6 +193,7 @@ interface AccountRowProps {const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {const { t } = useTranslation('setting');+ const compact = useInterfaceDensity() === 'compact';const { t: tCommon } = useTranslation('common');const [useFetchQuotaReadings,@@ -306,7 +310,7 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {return (<div- {...stylex.props(styles.row, active && styles.rowActive)}+ {...stylex.props(styles.row, compact && styles.rowCompact, active && styles.rowActive)}aria-current={active || undefined}role={'button'}tabIndex={0}@@ -329,7 +333,7 @@ const AccountRow = ({ account, active, onOpen }: AccountRowProps) => {opacity: view.status === 'disabled' ? 0.55 : undefined,}}>- <span style={{ display: 'flex', flex: 'none' }}>{meta.icon(28)}</span>+ <span style={{ display: 'flex', flex: 'none' }}>{meta.icon(compact ? 24 : 28)}</span><Flexbox gap={2} style={{ minWidth: 0 }}>{editing ? (<Flexbox horizontal align={'center'} gap={4} {...stop}>diff --git a/src/features/WorkspaceSetting/Labels/index.tsx b/src/features/WorkspaceSetting/Labels/index.tsxindex 870bb1e794c..bdd6d83abe5 100644--- a/src/features/WorkspaceSetting/Labels/index.tsx+++ b/src/features/WorkspaceSetting/Labels/index.tsx@@ -37,6 +37,7 @@ import { useFetchAgentLabels } from '@/hooks/useFetchAgentLabels';import { usePermission } from '@/hooks/usePermission';import { useHomeStore } from '@/store/home';import { agentLabelSelectors } from '@/store/home/selectors';+import { useInterfaceDensity } from '@/styles/density';import { LABEL_COLUMN_WIDTHS } from './constants';import { openDeleteLabelModal } from './DeleteLabelModal';@@ -59,6 +60,10 @@ const styles = stylex.create({backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },backgroundImage: { 'default': null, ':hover': 'none' },},+ // Compact density: 6px block padding around the 24px menu icon β 36px rows.+ rowCompact: {+ paddingBlock: '6px',+ },});interface LabelRowProps {@@ -83,6 +88,7 @@ const LabelRow = memo<LabelRowProps>(({ canManage, label, manageBlockedReason, onDelete, onEdit, onRestoreConflict }) => {const { t } = useTranslation(['setting', 'common']);const updateAgentLabel = useHomeStore((s) => s.updateAgentLabel);+ const compact = useInterfaceDensity() === 'compact';const toggleArchive = () => {if (label.archived) {@@ -159,7 +165,12 @@ const LabelRow = memo<LabelRowProps>();return (- <Flexbox horizontal align={'center'} className={stylex.props(styles.row).className} gap={12}>+ <Flexbox+ horizontal+ align={'center'}+ className={stylex.props(styles.row, compact && styles.rowCompact).className}+ gap={12}+ ><Flexboxhorizontalalign={'center'}@@ -171,7 +182,7 @@ const LabelRow = memo<LabelRowProps>(className={stylex.props(styles.dot).className}style={label.color ? { background: label.color } : undefined}/>- <Text ellipsis weight={500}>+ <Text ellipsis fontSize={compact ? 13 : undefined} weight={500}>{label.name}</Text></Flexbox>diff --git a/src/layout/GlobalProvider/AppTheme.tsx b/src/layout/GlobalProvider/AppTheme.tsxindex ea36360cc34..6195195db8b 100644--- a/src/layout/GlobalProvider/AppTheme.tsx+++ b/src/layout/GlobalProvider/AppTheme.tsx@@ -26,6 +26,7 @@ import { compactDensityTheme } from '@/styles/densityTheme';import { sx } from '@/styles/sx';import { setCookie } from '@/utils/client/cookie';import { resolveLang } from '@/utils/client/switchLang';+import { isMobileSurface } from '@/utils/mobileSurface';import { resolveFontFamilyOverride } from './fontFamilyOverride';@@ -131,9 +132,12 @@ const AppTheme = memo<AppThemeProps>(}, [fontAntialiasing]);useEffect(() => {- document.documentElement.dataset.density = interfaceDensity;- if (interfaceDensity !== 'compact') return;- const classes = stylex.props(compactDensityTheme).className?.split(' ') ?? [];+ const effectiveDensity = isMobileSurface() ? 'loose' : interfaceDensity;+ document.documentElement.dataset.density = effectiveDensity;+ if (effectiveDensity !== 'compact') return;+ const classes =+ stylex.props(compactDensityTheme).className?.split(/\s+/).filter(Boolean) ?? [];+ if (classes.length === 0) return;document.documentElement.classList.add(...classes);return () => document.documentElement.classList.remove(...classes);}, [interfaceDensity]);diff --git a/src/routes/(main)/agent/channel/Header.tsx b/src/routes/(main)/agent/channel/Header.tsxindex f4bcf2ff403..693cbd7dec8 100644--- a/src/routes/(main)/agent/channel/Header.tsx+++ b/src/routes/(main)/agent/channel/Header.tsx@@ -32,6 +32,7 @@ import NavHeader from '@/features/NavHeader';import type { SerializedPlatformDefinition } from '@/server/services/bot/platforms/types';import { useAgentStore } from '@/store/agent';import type { BotProviderItem } from '@/store/agent/slices/bot/action';+import { useHeaderActionSize } from '@/styles/density';import { resolveChannelHeaderView } from './headerView';import { isImportableChannel, planChannelImport } from './importPlan';@@ -59,6 +60,7 @@ const Header = memo<HeaderProps>(providers,}) => {const { t } = useTranslation(['agent', 'chat', 'common']);+ const headerActionSize = useHeaderActionSize(true);const view = resolveChannelHeaderView(platformId, platformDef, platformsLoading);const fileInputRef = useRef<HTMLInputElement>(null);@@ -277,7 +279,7 @@ const Header = memo<HeaderProps>(disabled={writeDisabled}icon={RefreshCw}loading={refreshingStatus}- size={'small'}+ size={headerActionSize}title={t('channel.refreshStatus')}onClick={handleRefreshStatus}/>@@ -294,12 +296,17 @@ const Header = memo<HeaderProps>(<ActionIconaria-label={t('channel.documentation')}icon={BookOpen}+ size={headerActionSize}title={t('channel.documentation')}onClick={() => window.open(setupGuideUrl, '_blank', 'noopener,noreferrer')}/>)}<DropdownMenu items={menuItems} placement={'bottomRight'}>- <ActionIcon icon={MoreHorizontal} title={t('more', { ns: 'common' })} />+ <ActionIcon+ icon={MoreHorizontal}+ size={headerActionSize}+ title={t('more', { ns: 'common' })}+ /></DropdownMenu></Flexbox>}diff --git a/src/routes/(main)/eval/_layout/Sidebar/Body/BenchmarkList.tsx b/src/routes/(main)/eval/_layout/Sidebar/Body/BenchmarkList.tsxindex 123542df22b..f02827baa51 100644--- a/src/routes/(main)/eval/_layout/Sidebar/Body/BenchmarkList.tsx+++ b/src/routes/(main)/eval/_layout/Sidebar/Body/BenchmarkList.tsx@@ -65,8 +65,8 @@ const BenchmarkList = memo<BenchmarkListProps>(({ activeKey, itemKey }) => {return (<AccordionItem value={itemKey}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('sidebar.benchmarks')}</SectionTitle>{benchmarkList.length > 0 && (diff --git a/src/routes/(main)/eval/_layout/Sidebar/Body/DatasetList.tsx b/src/routes/(main)/eval/_layout/Sidebar/Body/DatasetList.tsxindex 96d6666be09..99ba92de61c 100644--- a/src/routes/(main)/eval/_layout/Sidebar/Body/DatasetList.tsx+++ b/src/routes/(main)/eval/_layout/Sidebar/Body/DatasetList.tsx@@ -42,8 +42,8 @@ const DatasetList = memo<DatasetListProps>(({ activeKey, itemKey }) => {return (<AccordionItem value={itemKey}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('sidebar.datasets')}</SectionTitle>{datasets.length > 0 && (diff --git a/src/routes/(main)/eval/_layout/Sidebar/Body/ExperimentList.tsx b/src/routes/(main)/eval/_layout/Sidebar/Body/ExperimentList.tsxindex 3b8d1dd92d1..d16903ce8fb 100644--- a/src/routes/(main)/eval/_layout/Sidebar/Body/ExperimentList.tsx+++ b/src/routes/(main)/eval/_layout/Sidebar/Body/ExperimentList.tsx@@ -84,8 +84,8 @@ const ExperimentList = memo<ExperimentListProps>(({ activeKey, itemKey }) => {return (<AccordionItem value={itemKey}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('sidebar.experiments')}</SectionTitle>{experimentList.length > 0 && (diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/DatasetList.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/DatasetList.tsxindex c78473fc157..752064abf7a 100644--- a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/DatasetList.tsx+++ b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/DatasetList.tsx@@ -37,8 +37,8 @@ const DatasetList = memo<DatasetListProps>(({ activeKey, benchmarkId, itemKey })return (<AccordionItem value={itemKey}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('sidebar.datasets')}</SectionTitle>{datasetList.length > 0 && (diff --git a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/RunList.tsx b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/RunList.tsxindex 931d17847a6..8d1d7aef965 100644--- a/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/RunList.tsx+++ b/src/routes/(main)/eval/bench/[benchmarkId]/_layout/Sidebar/Body/RunList.tsx@@ -65,8 +65,8 @@ const RunList = memo<RunListProps>(({ activeKey, benchmarkId, itemKey }) => {return (<AccordionItem value={itemKey}>- <AccordionHeader style={sectionTriggerStyle}>- <AccordionTrigger>+ <AccordionHeader>+ <AccordionTrigger style={sectionTriggerStyle}><Flexbox horizontal align="center" gap={4}><SectionTitle>{t('sidebar.runs')}</SectionTitle>{runList.length > 0 && (diff --git a/src/routes/(main)/group/profile/features/Header/ChromeTabs/index.tsx b/src/routes/(main)/group/profile/features/Header/ChromeTabs/index.tsxindex c08659c2b99..4f65b1d480a 100644--- a/src/routes/(main)/group/profile/features/Header/ChromeTabs/index.tsx+++ b/src/routes/(main)/group/profile/features/Header/ChromeTabs/index.tsx@@ -23,9 +23,9 @@ const styles = createStaticStyles(({ css, cssVar: cv }) => ({align-items: center;justify-content: center;- width: 28px;- height: 28px;- border-radius: 6px;+ width: var(--lobe-density-icon-box);+ height: var(--lobe-density-icon-box);+ border-radius: var(--lobe-density-radius);color: ${cv.colorTextTertiary};@@ -72,10 +72,12 @@ const styles = createStaticStyles(({ css, cssVar: cv }) => ({gap: 6px;align-items: center;- height: 32px;- padding-block: 6px;+ height: var(--lobe-density-control-height);+ padding-block: 4px;padding-inline: 12px;- border-radius: 8px;+ border-radius: var(--lobe-density-radius);++ font-size: var(--lobe-density-font-size);color: ${cv.colorTextTertiary};diff --git a/src/routes/(main)/group/profile/features/Header/index.tsx b/src/routes/(main)/group/profile/features/Header/index.tsxindex 5885d1120e2..4b01d3ac39b 100644--- a/src/routes/(main)/group/profile/features/Header/index.tsx+++ b/src/routes/(main)/group/profile/features/Header/index.tsx@@ -27,8 +27,8 @@ const styles = createStaticStyles(({ css, cssVar }) => ({flex: none;width: 100%;- height: 44px;- padding-block: 8px;+ height: var(--lobe-density-header-height);+ padding-block: 0;padding-inline: 12px;border-block-end: 1px solid ${cssVar.colorBorderSecondary};`,diff --git a/src/styles/density.ts b/src/styles/density.tsindex 82c5ba95153..0748d66aaae 100644--- a/src/styles/density.ts+++ b/src/styles/density.ts@@ -3,6 +3,7 @@ import { createContext, useContext } from 'react';import { useUserStore } from '@/store/user';import { userGeneralSettingsSelectors } from '@/store/user/selectors';+import { isMobileSurface } from '@/utils/mobileSurface';export interface ActionSize {blockSize: number;@@ -103,12 +104,14 @@ export const DENSITY_TOKENS: Record<InterfaceDensity, DensityTokens> = {}),};-export const useInterfaceDensity = () =>- useUserStore(userGeneralSettingsSelectors.interfaceDensity);+export const useInterfaceDensity = (): InterfaceDensity => {+ const density = useUserStore(userGeneralSettingsSelectors.interfaceDensity);+ return isMobileSurface() ? 'loose' : density;+};export const useDensityTokens = () => DENSITY_TOKENS[useInterfaceDensity()];-export const PanelDensityContext = createContext<InterfaceDensity | null>(null);+export const PanelDensityContext = createContext<InterfaceDensity | null | undefined>(undefined);export const usePanelDensityTokens = (): DensityTokens | null => {const density = useContext(PanelDensityContext);diff --git a/src/styles/global.css b/src/styles/global.cssindex 0fc0e0e8ad0..536a88512cb 100644--- a/src/styles/global.css+++ b/src/styles/global.css@@ -131,31 +131,140 @@ html.desktop[data-window-fullscreen] body {}}-/* lobe-ui ships its rules inside @layer lobe-ui, so these unlayered overrides win without !important */-html[data-density='compact'] .lobe-menu-popup,-html[data-density='compact'] .lobe-select__popup {- font-size: var(--lobe-density-font-size);-}+@layer lobe-base, lobe-popup, lobe-ui, lobe-density;-html[data-density='compact'] .lobe-dropdown-menu__item,-html[data-density='compact'] .lobe-context-menu__item,-html[data-density='compact'] .lobe-select__option {- min-height: var(--lobe-density-control-height);- padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);- padding-inline: 8px;+/* lobe-ui ships its rules inside @layer lobe-ui; placing density overrides in @layer lobe-density+ beats @layer lobe-ui defaults without !important while letting unlayered app StyleX / static styles win. */+@layer lobe-density {+ html[data-density='compact'] {+ --lobe-form-item-padding-block: 10px;+ }- font-size: var(--lobe-density-font-size);- line-height: 20px;-}+ html[data-density='compact'] .lobe-menu-popup,+ html[data-density='compact'] .lobe-select__popup {+ font-size: var(--lobe-density-font-size);+ }-html[data-density='compact'] .lobe-select[data-size='middle'],-html[data-density='compact'] .lobe-tabs__tab {- height: var(--lobe-density-control-height);- min-height: var(--lobe-density-control-height);- font-size: var(--lobe-density-font-size);-}+ html[data-density='compact'] .lobe-dropdown-menu__item,+ html[data-density='compact'] .lobe-context-menu__item,+ html[data-density='compact'] .lobe-select__option,+ html[data-density='compact'] .lobe-auto-complete__item {+ min-height: var(--lobe-density-control-height);+ padding-block: calc((var(--lobe-density-control-height) - 20px) / 2);+ padding-inline: 8px;++ font-size: var(--lobe-density-font-size);+ line-height: 20px;+ }++ html[data-density='compact'] .lobe-dropdown-menu__group-label,+ html[data-density='compact'] .lobe-context-menu__group-label,+ html[data-density='compact'] .lobe-select__group-label,+ html[data-density='compact'] .lobe-dropdown-menu__header,+ html[data-density='compact'] .lobe-dropdown-menu__footer,+ html[data-density='compact'] .lobe-context-menu__header,+ html[data-density='compact'] .lobe-context-menu__footer,+ html[data-density='compact'] .lobe-select__empty {+ padding-inline: 8px;+ }++ html[data-density='compact'] .lobe-dropdown-menu__header,+ html[data-density='compact'] .lobe-dropdown-menu__footer,+ html[data-density='compact'] .lobe-context-menu__header,+ html[data-density='compact'] .lobe-context-menu__footer {+ padding-block: 6px;+ }-html[data-density='compact'] .lobe-segmented[data-size='small'] .lobe-segmented__item {- height: calc(var(--lobe-density-control-height) - 8px);- min-height: 0;+ html[data-density='compact'] .lobe-select__search {+ min-height: var(--lobe-density-row-height);+ padding-block: 6px;+ padding-inline: 8px;+ }++ html[data-density='compact'] .lobe-select__search input,+ html[data-density='compact'] .lobe-select__empty {+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-menu-icon {+ margin-inline-end: 8px;+ }++ /* Keep min-height (not fixed height) so multiple / tags Select wraps cleanly without clipping. */+ html[data-density='compact'] .lobe-select[data-size='middle'] {+ min-height: var(--lobe-density-control-height);+ padding-block: 2px;+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact']+ .lobe-tabs[data-size='middle'][data-variant='rounded']+ .lobe-tabs__tab {+ height: var(--lobe-density-control-height);+ min-height: var(--lobe-density-control-height);+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact']+ .lobe-tabs[data-size='middle'][data-variant='square']+ .lobe-tabs__tab {+ padding-block: 6px;+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-segmented[data-size='small'] .lobe-segmented__item {+ height: calc(var(--lobe-density-control-height) - 8px);+ min-height: 0;+ }++ html[data-density='compact'] .lobe-segmented[data-size='middle'] .lobe-segmented__item {+ height: calc(var(--lobe-density-control-height) - 4px);+ min-height: 0;+ padding-inline: 10px;+ font-size: var(--lobe-density-font-size);+ }++ /* Unify middle controls on the 28px baseline in compact mode. ActionIcon also carries .lobe-button,+ so exclude it here and size it with its own rule below. */+ html[data-density='compact'] .lobe-button[data-size='middle']:not(.lobe-action-icon) {+ height: var(--lobe-density-control-height);+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-action-icon[data-size='middle'] {+ width: var(--lobe-density-control-height);+ height: var(--lobe-density-control-height);+ }++ html[data-density='compact'] .lobe-input[data-size='middle'],+ html[data-density='compact'] .lobe-input-number[data-size='middle'],+ html[data-density='compact'] .lobe-auto-complete[data-size='middle'] {+ min-height: var(--lobe-density-control-height);+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-list__item {+ min-height: var(--lobe-density-control-height);+ padding-block: 4px;+ padding-inline: 8px;+ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-table-medium {+ --lobe-table-padding-block: 8px;+ --lobe-table-padding-inline: 12px;++ font-size: var(--lobe-density-font-size);+ }++ html[data-density='compact'] .lobe-modal__header,+ html[data-density='compact'] .lobe-drawer__header {+ min-height: var(--lobe-density-header-height);+ padding-block: 6px;+ }++ html[data-density='compact'] .lobe-modal__title,+ html[data-density='compact'] .lobe-drawer__title {+ font-size: var(--lobe-density-page-title-font-size);+ }}