Skip to content

🤯 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.

♻️ refactor(styles): migrate Acceptance viewer to StyleX (#21450)

Innei613cfeb91e0a
diff --git a/scripts/stylexMigration/legacyFiles.json b/scripts/stylexMigration/legacyFiles.json
index 3349775c29e..e1183c86cae 100644
--- a/scripts/stylexMigration/legacyFiles.json
+++ b/scripts/stylexMigration/legacyFiles.json
@@ -68,65 +68,8 @@
"packages/builtin-tools/src/codex/ErrorInspector.tsx",
"packages/builtin-tools/src/github/RunCommandInspector.tsx",
"packages/shared-tool-ui/src/styles.ts",
- "src/features/Acceptance/Viewer/AcceptanceOverview.tsx",
- "src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx",
- "src/features/Acceptance/Viewer/Checks/styles.ts",
- "src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx",
- "src/features/Acceptance/Viewer/Comments/CommentComposer.tsx",
- "src/features/Acceptance/Viewer/Comments/CommentReactions.tsx",
- "src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx",
- "src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx",
- "src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx",
- "src/features/Acceptance/Viewer/Comments/ReviewerApprovalBar.tsx",
- "src/features/Acceptance/Viewer/Comments/RoundSection.tsx",
- "src/features/Acceptance/Viewer/Comments/ThreadEvidence.tsx",
- "src/features/Acceptance/Viewer/Comments/styles.ts",
- "src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx",
- "src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx",
- "src/features/Acceptance/Viewer/Evidence/Annotation.tsx",
- "src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx",
- "src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx",
- "src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx",
- "src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx",
- "src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx",
- "src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx",
- "src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx",
- "src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx",
- "src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx",
- "src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx",
- "src/features/Acceptance/Viewer/Evidence/Video/styles.ts",
- "src/features/Acceptance/Viewer/Evidence/attachments.tsx",
- "src/features/Acceptance/Viewer/Evidence/styles.ts",
- "src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx",
"src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowEdge.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowGroup.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowNode.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowOutline.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowResults.tsx",
- "src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsx",
- "src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx",
- "src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx",
- "src/features/Acceptance/Viewer/Gate/GateReview.tsx",
- "src/features/Acceptance/Viewer/Gate/SkillDirectory.tsx",
- "src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx",
- "src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx",
- "src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx",
- "src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx",
- "src/features/Acceptance/Viewer/Header/PreviewReviewLink.tsx",
- "src/features/Acceptance/Viewer/Header/PullRequestLinks.tsx",
- "src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx",
- "src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx",
- "src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx",
- "src/features/Acceptance/Viewer/History/LedgerPanel.tsx",
- "src/features/Acceptance/Viewer/ReadOnly/Checks.tsx",
- "src/features/Acceptance/Viewer/Review/DecisionBar.tsx",
- "src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx",
- "src/features/Acceptance/Viewer/Review/ProposalCard.tsx",
- "src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx",
- "src/features/Acceptance/Viewer/Review/modals.tsx",
"src/features/Acceptance/Viewer/Review/rejectModalShell.ts",
- "src/features/Acceptance/Viewer/index.tsx",
"src/features/AgentBreadcrumb/index.tsx",
"src/features/AgentBuilder/TopicSelector.tsx",
"src/features/AgentChannel/PlatformCard.tsx",
diff --git a/scripts/stylexMigration/verification/fixtures/AttachmentThumbsFixture.tsx b/scripts/stylexMigration/verification/fixtures/AttachmentThumbsFixture.tsx
new file mode 100644
index 00000000000..403ee4b4cfd
--- /dev/null
+++ b/scripts/stylexMigration/verification/fixtures/AttachmentThumbsFixture.tsx
@@ -0,0 +1,18 @@
+import { AttachmentThumbs } from 'verification:component';
+
+const picture = (width: number, height: number) =>
+ `data:image/svg+xml,${encodeURIComponent(
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"><rect width="100%" height="100%" fill="#4a7"/></svg>`,
+ )}`;
+
+const attachments = [
+ { id: 'wide', name: 'Wide screenshot', url: picture(800, 400) },
+ { id: 'tall', name: 'Tall screenshot', url: picture(300, 900) },
+];
+
+export const Fixture = ({ variant }: { variant: string }) => (
+ <AttachmentThumbs
+ attachments={attachments}
+ size={variant.endsWith('comment') ? 'comment' : 'chip'}
+ />
+);
diff --git a/scripts/stylexMigration/verification/fixtures/FixtureBusinessData.ts b/scripts/stylexMigration/verification/fixtures/FixtureBusinessData.ts
index d50177dadb6..3731b4fe62e 100644
--- a/scripts/stylexMigration/verification/fixtures/FixtureBusinessData.ts
+++ b/scripts/stylexMigration/verification/fixtures/FixtureBusinessData.ts
@@ -29,3 +29,7 @@ const chatActions = { openLocalFile: notExercised };
export const useChatStore = <T>(selector: (state: typeof chatActions) => T): T =>
selector(chatActions);
export const useProjectFiles = () => ({ data: { entries: [] } });
+
+const fileActions = { uploadWithProgress: notExercised };
+export const useFileStore = <T>(selector: (state: typeof fileActions) => T): T =>
+ selector(fileActions);
diff --git a/scripts/stylexMigration/verification/fixtures/VideoEvidencePlayerFixture.tsx b/scripts/stylexMigration/verification/fixtures/VideoEvidencePlayerFixture.tsx
new file mode 100644
index 00000000000..03da26e9f5c
--- /dev/null
+++ b/scripts/stylexMigration/verification/fixtures/VideoEvidencePlayerFixture.tsx
@@ -0,0 +1,8 @@
+import { VideoEvidencePlayer } from 'verification:component';
+
+export const Fixture = ({ variant }: { variant: string }) => (
+ <VideoEvidencePlayer
+ frameMaxHeight={variant === 'frame-height' ? '240px' : undefined}
+ src="data:video/mp4;base64,"
+ />
+);
diff --git a/scripts/stylexMigration/verification/fixtures/fixtureRegistry.test.ts b/scripts/stylexMigration/verification/fixtures/fixtureRegistry.test.ts
index da58e4d8428..b7902c9b85d 100644
--- a/scripts/stylexMigration/verification/fixtures/fixtureRegistry.test.ts
+++ b/scripts/stylexMigration/verification/fixtures/fixtureRegistry.test.ts
@@ -74,7 +74,7 @@ describe('explicit fixture contract', () => {
});
it('connects all entries with explicit mounting and probe contracts', () => {
- expect(fixtureIds).toHaveLength(25);
+ expect(fixtureIds).toHaveLength(27);
for (const id of fixtureIds) {
const fixture = getStyleFixture(id);
expect(fixture.component.id).toBe(id);
diff --git a/scripts/stylexMigration/verification/fixtures/migrationProfiles.ts b/scripts/stylexMigration/verification/fixtures/migrationProfiles.ts
index 1d343134a4b..86d99125e3a 100644
--- a/scripts/stylexMigration/verification/fixtures/migrationProfiles.ts
+++ b/scripts/stylexMigration/verification/fixtures/migrationProfiles.ts
@@ -2,6 +2,8 @@ import type { FixtureProfile } from './fixtureRegistry';
export const migrationFixtures = [
['AskUserQuestionView', 'packages/shared-tool-ui/src/AskUserQuestion/AskUserQuestionView.tsx'],
+ ['AttachmentThumbs', 'src/features/Acceptance/Viewer/Evidence/attachments.tsx'],
+ ['VideoEvidencePlayer', 'src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx'],
['SidebarGroupItem', 'src/features/HomeSidebar/Body/Agent/Modals/ConfigGroupModal/GroupItem.tsx'],
['ToolbarActionButton', 'src/features/Portal/LocalFile/PreviewToolbar.tsx'],
['PreviewToolbar', 'src/features/Portal/LocalFile/PreviewToolbar.tsx'],
@@ -51,6 +53,24 @@ export const migrationProfiles: Record<string, FixtureProfile> = {
'./useVoiceMessageRecorder',
].map((source) => ({ importer: voiceMessageImporter, source, replacement: voiceMessageData })),
},
+ AttachmentThumbs: {
+ dependencies: ['lucide-react', 'i18next', 'react-i18next'],
+ exportName: 'AttachmentThumbs',
+ variants: [{ id: 'chip' }, { id: 'comment' }, { id: 'dark-comment', appearance: 'dark' }],
+ boundaries: [
+ {
+ importer: 'src/features/Acceptance/Viewer/Evidence/attachments.tsx',
+ source: '@/store/file',
+ replacement: 'fixtures/FixtureBusinessData.ts',
+ },
+ ],
+ },
+ VideoEvidencePlayer: {
+ dependencies: ['lucide-react', 'i18next', 'react-i18next'],
+ exportName: 'VideoEvidencePlayer',
+ settleFrames: 2,
+ variants: [{ id: 'player' }, { id: 'frame-height' }, { id: 'dark-player', appearance: 'dark' }],
+ },
SidebarGroupItem: {
dependencies: ['lucide-react', 'i18next', 'react-i18next'],
i18n: true,
diff --git a/scripts/stylexMigration/verification/fixtures/modules.d.ts b/scripts/stylexMigration/verification/fixtures/modules.d.ts
index 575957f4983..e3669578291 100644
--- a/scripts/stylexMigration/verification/fixtures/modules.d.ts
+++ b/scripts/stylexMigration/verification/fixtures/modules.d.ts
@@ -116,6 +116,11 @@ declare module 'verification:component' {
tooltip?: string;
waveform: number[];
}>;
+ export const AttachmentThumbs: ComponentType<{
+ attachments: Array<{ id: string; name: string; url: string }>;
+ size: 'chip' | 'comment';
+ }>;
+ export const VideoEvidencePlayer: ComponentType<{ frameMaxHeight?: string; src: string }>;
export const OptionRow: ComponentType<{
active: boolean;
desc: string;
diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
index a7601b17454..aa73708fa8d 100644
--- a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
@@ -1,9 +1,13 @@
'use client';
-import { createStaticStyles, cssVar, Flexbox, useResponsive } from '@lobehub/ui';
+import { Flexbox, useResponsive } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { useState } from 'react';
import { useLocation } from 'react-router';
+import { sx } from '@/styles/sx';
+
import { useAcceptanceScope } from './AcceptanceScope';
import AcceptanceCheckInventory from './Checks/AcceptanceCheckInventory';
import AcceptanceCheckOwnerToolbar from './Checks/AcceptanceCheckOwnerToolbar';
@@ -26,11 +30,7 @@ import AcceptanceShare from './Header/AcceptanceShare';
import AcceptanceStatusControl from './Header/AcceptanceStatusControl';
import type { AcceptanceTabKey } from './Header/AcceptanceTabs';
import AcceptanceTabs from './Header/AcceptanceTabs';
-import {
- acceptanceContentLayout,
- acceptanceReadingColumnMaxWidth,
- getAcceptanceBodyMaxWidth,
-} from './layout';
+import { acceptanceReadingColumnMaxWidth, getAcceptanceBodyMaxWidth } from './layout';
import { flowPlanPhase } from './Plan/planReview';
import AcceptanceDecision from './Review/AcceptanceDecision';
import { AcceptanceRepair } from './Review/AcceptanceRepair';
@@ -38,23 +38,22 @@ import { checksForTurn } from './turnChecks';
import { useAcceptanceBundle } from './useAcceptanceBundle';
import { useAcceptanceTurn } from './useAcceptanceTurn';
-const styles = createStaticStyles(({ css }) => ({
- column: css`
- width: 100%;
- max-width: ${acceptanceContentLayout.maxWidth}px;
- margin-inline: auto;
- padding-inline: 24px;
+const styles = stylex.create({
+ column: {
+ width: '100%',
+ marginInline: 'auto',
+ paddingInline: { 'default': '24px', '@media (width <= 767px)': '16px' },
+ },
+ headerBand: {
+ flex: 'none',
+ paddingBlockStart: '20px',
+ paddingBlockEnd: 0,
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ },
+});
- @media (width <= 767px) {
- padding-inline: 16px;
- }
- `,
- headerBand: css`
- flex: none;
- padding-block: 20px 0;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
-}));
interface AcceptancePageProps {
onDraftToComposer?: (text: string) => boolean;
}
@@ -98,12 +97,8 @@ export const AcceptanceOverview = ({
return (
<>
- <Flexbox className={styles.headerBand}>
- <Flexbox
- className={styles.column}
- gap={12}
- style={{ maxWidth: acceptanceReadingColumnMaxWidth }}
- >
+ <Flexbox {...stylex.props(styles.headerBand)}>
+ <Flexbox gap={12} {...sx(styles.column, { maxWidth: acceptanceReadingColumnMaxWidth })}>
{/* Sharing sits beside the identity, as on the workbench page. The
control gates itself on the server's review capability, so a
reader without it sees nothing here. The inline padding clears the
@@ -152,10 +147,11 @@ export const AcceptanceOverview = ({
</Flexbox>
<Flexbox
- className={styles.column}
gap={16}
paddingBlock={20}
- style={{ maxWidth: tab === 'flow' ? 1500 : getAcceptanceBodyMaxWidth(tab) }}
+ {...sx(styles.column, {
+ maxWidth: tab === 'flow' ? 1500 : getAcceptanceBodyMaxWidth(tab),
+ })}
>
{/* Deciding belongs where the evidence is. The discussion is a
conversation; ending one there put the closing act under a thread
diff --git a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
index a8673e72472..51262aa9eb1 100644
--- a/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
+++ b/src/features/Acceptance/Viewer/Checks/AcceptanceCheckInventory.tsx
@@ -1,15 +1,8 @@
'use client';
import { isDraftVerifyRun } from '@lobechat/const/verify';
-import {
- ActionIcon,
- createStaticStyles,
- Flexbox,
- Select,
- Text,
- toast,
- useResponsive,
-} from '@lobehub/ui';
+import { ActionIcon, Flexbox, Select, Text, toast, useResponsive } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { ChevronsDownUp, ChevronsUpDown } from 'lucide-react';
import type { ReactNode } from 'react';
import { useCallback, useEffect, useState } from 'react';
@@ -42,27 +35,15 @@ import {
import { EMPTY_ID_SET, setAggregateEntry } from './expandState';
import { collectGroupFeedback } from './readPresentation';
-const styles = createStaticStyles(({ css }) => ({
- filters: css`
- @media (width <= 767px) {
- width: 100%;
- }
- `,
- filterSelect: css`
- width: 118px;
-
- @media (width <= 767px) {
- flex: 1;
- width: 0;
- min-width: 0;
- }
- `,
- toolbarHeading: css`
- @media (width <= 767px) {
- flex-basis: 100%;
- }
- `,
-}));
+const styles = stylex.create({
+ filters: { width: { 'default': null, '@media (width <= 767px)': '100%' } },
+ filterSelect: {
+ width: { 'default': '118px', '@media (width <= 767px)': '0' },
+ flex: { 'default': null, '@media (width <= 767px)': '1' },
+ minWidth: { 'default': null, '@media (width <= 767px)': '0' },
+ },
+ toolbarHeading: { flexBasis: { 'default': null, '@media (width <= 767px)': '100%' } },
+});
interface AcceptanceCheckInventoryProps {
children?: ReactNode;
@@ -240,7 +221,13 @@ const AcceptanceCheckInventory = ({
return (
<>
<Flexbox horizontal align={'center'} gap={8} wrap={'wrap'}>
- <Flexbox horizontal align={'center'} className={styles.toolbarHeading} flex={1} gap={8}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={stylex.props(styles.toolbarHeading).className}
+ flex={1}
+ gap={8}
+ >
<Text strong style={{ fontSize: 14, whiteSpace: 'nowrap' }}>
{t('acceptance.checks.title')}
</Text>
@@ -248,9 +235,14 @@ const AcceptanceCheckInventory = ({
<Flexbox flex={1} />
{toolbar}
</Flexbox>
- <Flexbox horizontal align={'center'} className={styles.filters} gap={8}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={stylex.props(styles.filters).className}
+ gap={8}
+ >
<Select
- className={styles.filterSelect}
+ className={stylex.props(styles.filterSelect).className}
value={filter}
variant={'filled'}
options={[
@@ -276,7 +268,7 @@ const AcceptanceCheckInventory = ({
/>
{data.rounds.length > 1 && (
<Select
- className={styles.filterSelect}
+ className={stylex.props(styles.filterSelect).className}
value={roundFilter === null ? 'all' : String(roundFilter)}
variant={'filled'}
options={[
diff --git a/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx
index ee641f6b360..84acf6fb75a 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckHistory.tsx
@@ -2,6 +2,7 @@
import type { AcceptanceReviewAnnotation } from '@lobechat/types';
import { cssVar, Flexbox, Icon, Image, Text, Tooltip } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import dayjs from 'dayjs';
import { BadgeCheck, Ban, MessageSquareX } from 'lucide-react';
import { memo } from 'react';
@@ -9,6 +10,7 @@ import { useTranslation } from 'react-i18next';
import AudioPlayer from '@/features/AudioPlayer';
import { useIsHydrated } from '@/hooks/useIsHydrated';
+import { sx } from '@/styles/sx';
import { TerminalEvidenceCard } from '../../Report/TerminalEvidence';
import { AnnotatedImage } from '../Evidence/Annotation';
@@ -182,17 +184,16 @@ export const IterationTimeline = memo<{
<Flexbox horizontal gap={12} key={entry.key}>
<Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>
<span
- className={styles.stepDot}
- style={{
+ {...sx(styles.stepDot, {
borderColor:
entry.review.action === 'accept'
? cssVar.colorSuccess
: entry.review.action === 'ignore'
? cssVar.colorTextQuaternary
: cssVar.colorError,
- }}
+ })}
/>
- {!isLast && <div className={styles.stepRail} />}
+ {!isLast && <div {...stylex.props(styles.stepRail)} />}
</Flexbox>
<Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>
<FeedbackCard evidenceById={evidenceById} review={entry.review} />
@@ -212,13 +213,12 @@ export const IterationTimeline = memo<{
<Flexbox horizontal gap={12} key={entry.key}>
<Flexbox align={'center'} style={{ flex: 'none', width: 9 }}>
<span
- className={styles.stepDot}
- style={{
+ {...sx(styles.stepDot, {
background: isCurrent ? stateColor : cssVar.colorBgContainer,
borderColor: isCurrent ? stateColor : cssVar.colorTextQuaternary,
- }}
+ })}
/>
- {!isLast && <div className={styles.stepRail} />}
+ {!isLast && <div {...stylex.props(styles.stepRail)} />}
</Flexbox>
<Flexbox flex={1} gap={6} style={{ minWidth: 0, paddingBlockEnd: isLast ? 0 : 20 }}>
{onRound ? (
@@ -241,7 +241,7 @@ export const IterationTimeline = memo<{
<Flexbox horizontal gap={8} wrap={'wrap'}>
{step.evidence.map((item) =>
item.fileUrl && IMAGE_EVIDENCE.has(item.type) ? (
- <Flexbox className={evidenceStyles.evidenceImage} key={item.id}>
+ <Flexbox key={item.id} {...stylex.props(evidenceStyles.evidenceImage)}>
<Image
alt={item.description ?? item.type}
loading={'lazy'}
@@ -276,9 +276,11 @@ export const IterationTimeline = memo<{
</div>
) : item.content ? (
<div
- className={evidenceStyles.evidenceText}
key={item.id}
- style={{ maxHeight: 120, maxWidth: 420 }}
+ {...sx(evidenceStyles.evidenceText, {
+ maxHeight: 120,
+ maxWidth: 420,
+ })}
>
{item.content}
</div>
diff --git a/src/features/Acceptance/Viewer/Checks/CheckList.tsx b/src/features/Acceptance/Viewer/Checks/CheckList.tsx
index 411a2efb0f4..b139b1087b8 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckList.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckList.tsx
@@ -2,6 +2,7 @@
import type { AcceptanceGroupFeedback } from '@lobechat/types';
import { ActionIcon, Button, cssVar, Empty, Flexbox, Icon, Text } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import {
BadgeCheck,
ChevronRight,
@@ -14,7 +15,10 @@ import {
import { Fragment, memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { sx } from '@/styles/sx';
+
import { hasVisualEvidence } from '../Evidence/evidence';
+import { groupHeaderMarker } from '../markers.stylex';
import { openGroupFeedbackModal } from '../Review/modals';
import { AcceptanceCheckRow } from './CheckRow';
import type { CheckFilter } from './checkState';
@@ -118,11 +122,11 @@ const CheckList = memo<CheckListProps>(
if (visibleRows.length === 0) {
const allAccepted = filter === 'pending' && isGroupFullyAccepted(checks);
return (
- <Flexbox align={'center'} className={styles.emptyCard} gap={12} justify={'center'}>
+ <Flexbox align={'center'} gap={12} justify={'center'} {...stylex.props(styles.emptyCard)}>
{allAccepted ? (
<>
<Icon
- className={styles.celebrateIcon}
+ {...stylex.props(styles.celebrateIcon)}
color={cssVar.colorSuccess}
icon={PartyPopper}
size={40}
@@ -152,7 +156,7 @@ const CheckList = memo<CheckListProps>(
if (!shouldGroupChecks(checks.length)) {
return (
- <Flexbox className={styles.groupCard}>
+ <Flexbox {...stylex.props(styles.groupCard)}>
{visibleRows.map((check) => (
<AcceptanceCheckRow
canReview={canReview}
@@ -173,7 +177,7 @@ const CheckList = memo<CheckListProps>(
}
return (
- <Flexbox className={styles.groupCard}>
+ <Flexbox {...stylex.props(styles.groupCard)}>
{groups.map(({ checks: groupChecks_, key, label, rows }, groupIndex) => {
const passed = groupChecks_.filter((check) => check.state === 'passed').length;
const collapsed = collapsedGroups.has(key);
@@ -208,12 +212,11 @@ const CheckList = memo<CheckListProps>(
<Flexbox
horizontal
align={'center'}
- className={styles.groupHeader}
gap={8}
- style={{
+ {...sx(styles.groupHeader, groupHeaderMarker, {
borderBlockStart:
groupIndex > 0 ? `1px solid ${cssVar.colorBorderSecondary}` : 'none',
- }}
+ })}
onClick={() => onToggleGroup(key)}
>
<Text strong style={{ fontSize: 13 }}>
@@ -260,13 +263,15 @@ const CheckList = memo<CheckListProps>(
reviewableChecks.length > 0 &&
(unaccepted.length > 0 ? (
<Button
- className={'acceptance-group-actions'}
disabled={reviewPending && acceptingGroup !== key}
icon={<Icon icon={BadgeCheck} />}
loading={acceptingGroup === key}
size={'small'}
// The spinner must stay visible after the pointer leaves.
- style={acceptingGroup === key ? { opacity: 1 } : undefined}
+ {...sx(
+ styles.groupActions,
+ acceptingGroup === key ? { opacity: 1 } : undefined,
+ )}
type={'text'}
onClick={async (event) => {
event.stopPropagation();
@@ -300,7 +305,7 @@ const CheckList = memo<CheckListProps>(
belong to no single check yet must reach the next round.
Lives with the other group-level controls by the chevron. */}
{canReview && (
- <span className={'acceptance-group-actions'}>
+ <span {...stylex.props(styles.groupActions)}>
<ActionIcon
icon={MessageSquareText}
size={'small'}
diff --git a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
index 52a89f48507..aecbc574336 100644
--- a/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
+++ b/src/features/Acceptance/Viewer/Checks/CheckRow.tsx
@@ -6,7 +6,6 @@ import {
Button,
copyToClipboard,
cssVar,
- cx,
Flexbox,
Icon,
Tag,
@@ -15,6 +14,7 @@ import {
Tooltip,
useResponsive,
} from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import dayjs from 'dayjs';
import {
AudioLines,
@@ -36,6 +36,8 @@ import {
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { sx } from '@/styles/sx';
+
import { hasRenderableEvidence, readVisualizationManifest } from '../../Report/visualization';
import { VisualizationDeltaBadge, VisualizationRenderer } from '../../Report/VisualizationRenderer';
import { checkDisplayTitle } from '../../utils';
@@ -49,6 +51,7 @@ import {
} from '../Evidence/evidence';
import { EvidenceList } from '../Evidence/EvidenceList';
import type { EvidenceOverlayMap } from '../Evidence/overlay';
+import { rowHeaderMarker } from '../markers.stylex';
import { openCheckRejectModal } from '../Review/CheckRejectModal';
import type { CheckProposal } from '../Review/proposal';
import { classifyProposalEdit } from '../Review/proposal';
@@ -327,17 +330,17 @@ export const AcceptanceCheckRow = memo<{
);
return (
- <Flexbox className={detailMode ? undefined : styles.row} data-check-row={check.id}>
+ <Flexbox data-check-row={check.id} {...stylex.props(detailMode ? undefined : styles.row)}>
{!detailMode && (
<Flexbox
horizontal
align={'flex-start'}
aria-expanded={ariaExpanded}
- className={styles.rowHeader}
data-expanded={open ? '' : undefined}
gap={10}
role={'button'}
tabIndex={0}
+ {...stylex.props(styles.rowHeader, !open && styles.rowHeaderCollapsed, rowHeaderMarker)}
onClick={activate}
onKeyDown={(event) => {
if (
@@ -358,7 +361,7 @@ export const AcceptanceCheckRow = memo<{
title={seqCopied ? t('acceptance.checks.copied') : t('acceptance.checks.copySeq')}
>
<span
- className={cx(styles.seqChip, styles.seqChipClickable)}
+ {...stylex.props(styles.seqChip, styles.seqChipClickable)}
onClick={(event) => {
event.stopPropagation();
void copyToClipboard(`C${check.seq}`);
@@ -372,15 +375,16 @@ export const AcceptanceCheckRow = memo<{
<Flexbox
horizontal
align={'center'}
- className={styles.rowTitle}
+ {...sx(styles.rowTitle, { minWidth: 0 })}
flex={1}
gap={8}
- style={{ minWidth: 0 }}
wrap={open ? 'wrap' : 'nowrap'}
>
<Text
- className={open || !desktop ? undefined : styles.titleEllipsis}
- style={{ fontSize: desktop ? 13 : 14, minWidth: 0 }}
+ {...sx(open || !desktop ? null : styles.titleEllipsis, {
+ fontSize: desktop ? 13 : 14,
+ minWidth: 0,
+ })}
>
{title}
</Text>
@@ -402,11 +406,12 @@ export const AcceptanceCheckRow = memo<{
<Flexbox
horizontal
align={'center'}
- className={cx(styles.rowActions, 'acceptance-row-actions')}
// A running accept/ignore spinner stays visible after the pointer leaves.
data-busy={accepting || ignoring ? '' : undefined}
gap={2}
- style={{ flex: 'none' }}
+ {...sx(styles.rowActions, !(accepting || ignoring) && styles.rowActionsIdle, {
+ flex: 'none',
+ })}
>
<ActionIcon
disabled={reviewPending && !accepting}
@@ -437,12 +442,7 @@ export const AcceptanceCheckRow = memo<{
</Flexbox>
)}
</Flexbox>
- <Flexbox
- horizontal
- align={'center'}
- className={cx(styles.rowMeta, 'acceptance-row-meta')}
- gap={6}
- >
+ <Flexbox horizontal align={'center'} gap={6} {...stylex.props(styles.rowMeta)}>
{/* An accept on a NON-passed verdict can't merge into the head icon
(the failed/uncertain mark must stay visible) — mark it here. */}
{reviewState === 'accepted' && check.state !== 'passed' && (
@@ -504,7 +504,7 @@ export const AcceptanceCheckRow = memo<{
.join(' · ')}
>
<span
- className={cx(styles.chip, styles.chipClickable)}
+ {...stylex.props(styles.chip, styles.chipClickable)}
onClick={(event) => {
event.stopPropagation();
onRound(check.introducedAtRound);
@@ -517,7 +517,7 @@ export const AcceptanceCheckRow = memo<{
{onRound && check.resultRound !== undefined && check.resultRound !== null && (
<Tooltip title={t('acceptance.checks.finalRoundHint')}>
<span
- className={cx(styles.chip, styles.chipClickable)}
+ {...stylex.props(styles.chip, styles.chipClickable)}
onClick={(event) => {
event.stopPropagation();
onRound(check.resultRound!);
@@ -528,7 +528,7 @@ export const AcceptanceCheckRow = memo<{
</Tooltip>
)}
</Flexbox>
- <Flexbox align={'center'} className={styles.rowChevron} height={22}>
+ <Flexbox align={'center'} height={22} {...stylex.props(styles.rowChevron)}>
<Icon
color={cssVar.colorTextQuaternary}
icon={ChevronRight}
@@ -602,7 +602,7 @@ export const AcceptanceCheckRow = memo<{
onReviewEvidence={canReview ? (id) => openReject(undefined, id) : undefined}
/>
{staleThreads.length > 0 && (
- <Flexbox className={styles.staleRegions} gap={10}>
+ <Flexbox gap={10} {...stylex.props(styles.staleRegions)}>
<Text fontSize={12} type={'secondary'}>
{t('acceptance.comments.historicalRegions', { count: staleThreads.length })}
</Text>
@@ -777,7 +777,7 @@ export const AcceptanceCheckRow = memo<{
)}
{hasHistory && (
<span
- className={styles.historyToggle}
+ {...stylex.props(styles.historyToggle)}
onClick={() => setHistoryOpen((open) => !open)}
>
<Icon
diff --git a/src/features/Acceptance/Viewer/Checks/styles.ts b/src/features/Acceptance/Viewer/Checks/styles.ts
index d2cd3c9b59a..300e9c44f35 100644
--- a/src/features/Acceptance/Viewer/Checks/styles.ts
+++ b/src/features/Acceptance/Viewer/Checks/styles.ts
@@ -1,234 +1,174 @@
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
-export const styles = createStaticStyles(({ css }) => ({
- /**
- * Regions whose evidence a later round replaced. Kept quiet on purpose: it is
- * a footnote to the check, not a second checklist — full-strength cards here
- * competed with the evidence the reader actually came for.
- */
- staleRegions: css`
- margin-block-start: 4px;
- padding-block: 10px;
- padding-inline-start: 12px;
- border-inline-start: 2px solid ${cssVar.colorBorderSecondary};
-
- opacity: 0.75;
-
- &:hover {
- opacity: 1;
- }
- `,
- chip: css`
- padding-inline: 6px;
- border-radius: 4px;
-
- font-size: 11px;
- line-height: 18px;
- color: ${cssVar.colorTextTertiary};
- white-space: nowrap;
-
- background: ${cssVar.colorFillTertiary};
- `,
- chipClickable: css`
- cursor: pointer;
-
- &:hover {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
- }
- `,
- emptyCard: css`
- padding-block: 48px;
- padding-inline: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
- `,
- celebrateIcon: css`
- @keyframes acceptance-celebrate-pop {
- 0% {
- transform: scale(0.6);
- opacity: 0;
- }
-
- 60% {
- transform: scale(1.15);
- }
-
- 100% {
- transform: scale(1);
- opacity: 1;
- }
- }
-
- animation: acceptance-celebrate-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
- `,
- groupCard: css`
- background: ${cssVar.colorBgContainer};
- `,
- groupHeader: css`
- cursor: pointer;
- padding-block: 10px;
- padding-inline: 16px;
- background: ${cssVar.colorFillQuaternary};
-
- .acceptance-group-actions {
- opacity: 0;
- transition: opacity 0.2s;
- }
-
- &:hover {
- .acceptance-group-actions {
- opacity: 1;
- }
- }
- `,
- historyToggle: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 4px;
- align-items: center;
+import { groupHeaderMarker, rowHeaderMarker } from '../markers.stylex';
- width: fit-content;
+const celebratePop = stylex.keyframes({
+ '0%': { opacity: 0, transform: 'scale(0.6)' },
+ '60%': { transform: 'scale(1.15)' },
+ '100%': { opacity: 1, transform: 'scale(1)' },
+});
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
+const compact = '@media (width <= 767px)';
+const hoverable = '@media (hover: hover) and (pointer: fine)';
+const rowReveal = stylex.keyframes({ from: { opacity: 0 }, to: { opacity: 1 } });
- &:hover {
- color: ${cssVar.colorText};
- }
- `,
- row: css`
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
-
- /* The list opens flush with the content above it. Grouped lists are
- unaffected: their first child is the group header, so rows are never
- first. */
- &:first-child {
- border-block-start: none;
- }
- `,
- seqChip: css`
- flex: none;
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 11px;
- line-height: 22px;
- color: ${cssVar.colorTextSecondary};
- letter-spacing: 0.02em;
- `,
- seqChipClickable: css`
- cursor: copy;
-
- &:hover {
- color: ${cssVar.colorText};
- }
- `,
+export const styles = stylex.create({
/**
- * Hover-only controls fade in when they appear. They stay out of the layout
- * (display: none, see rowHeader) until then — an invisible `opacity: 0` strip
- * still kept its width and cut every title short for nothing.
+ * Regions whose evidence a later round replaced. Kept quiet on purpose: it is
+ * a footnote to the check, not a second checklist — full-strength cards here
+ * competed with the evidence the reader actually came for.
*/
- rowActions: css`
- @keyframes acceptance-row-reveal {
- from {
- opacity: 0;
- }
-
- to {
- opacity: 1;
- }
- }
-
- /* The 24px icons sit inside the 22px title line, so revealing them
- doesn't grow the row and nudge every row below it. */
- height: 22px;
- animation: acceptance-row-reveal 0.2s both;
- `,
- rowChevron: css`
- @media (width <= 767px) {
- grid-area: 1 / 4;
- }
- `,
- rowMeta: css`
- animation: acceptance-row-reveal 0.2s both;
-
- @media (width <= 767px) {
- grid-area: 1 / 3;
- flex-wrap: wrap;
- justify-content: flex-end;
- min-width: 0;
-
- &:empty {
- display: none;
- }
- }
- `,
- rowTitle: css`
- @media (width <= 767px) {
- grid-area: 2 / 1 / auto / -1;
- }
- `,
- rowHeader: css`
- cursor: pointer;
- padding-block: 12px;
- padding-inline: 16px;
-
- /* At rest a collapsed row is all title. A pending accept/ignore keeps its
- spinner on screen after the pointer leaves (data-busy). Touch screens
- have no hover, so their meta stays put. An OPEN row keeps its controls:
- its title wraps, so revealing them on hover reflowed the title, grew the
- header and bounced the evidence below on every pointer pass. */
- &:not([data-expanded], :hover, :focus-within) {
- .acceptance-row-actions:not([data-busy]) {
- display: none;
- }
-
- @media (hover: hover) and (pointer: fine) {
- .acceptance-row-meta {
- display: none;
- }
- }
- }
-
- /* The hover wash marks the collapsed row as a click target. An OPEN row is
- in reading mode — a gray band flashing between the white body and the
- white page just severs the title from its content, so no wash there. */
- &:not([data-expanded]):hover {
- background: ${cssVar.colorFillQuaternary};
- }
-
- @media (width <= 767px) {
- display: grid;
- grid-template-columns: 16px max-content minmax(0, 1fr) 14px;
- row-gap: 4px;
-
- padding-block: 8px;
- padding-inline: 0;
- }
- `,
- stepDot: css`
- flex: none;
-
- width: 9px;
- height: 9px;
- margin-block-start: 5px;
- border: 2px solid;
- border-radius: 50%;
-
- background: ${cssVar.colorBgContainer};
- `,
- stepRail: css`
- flex: 1;
- width: 1px;
- margin-block-start: 6px;
- background: ${cssVar.colorBorderSecondary};
- `,
- titleEllipsis: css`
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
-}));
+ staleRegions: {
+ marginBlockStart: '4px',
+ paddingBlock: '10px',
+ paddingInlineStart: '12px',
+ borderInlineStartWidth: '2px',
+ borderInlineStartStyle: 'solid',
+ borderInlineStartColor: cssVar.colorBorderSecondary,
+ opacity: { 'default': 0.75, ':hover': 1 },
+ },
+ chip: {
+ paddingInline: '6px',
+ borderRadius: '4px',
+ fontSize: '11px',
+ lineHeight: '18px',
+ color: cssVar.colorTextTertiary,
+ whiteSpace: 'nowrap',
+ backgroundColor: cssVar.colorFillTertiary,
+ },
+ chipClickable: {
+ cursor: 'pointer',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ backgroundColor: { 'default': cssVar.colorFillTertiary, ':hover': cssVar.colorFillSecondary },
+ },
+ emptyCard: {
+ paddingBlock: '48px',
+ paddingInline: '16px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ celebrateIcon: {
+ animationName: celebratePop,
+ animationDuration: '0.45s',
+ animationTimingFunction: 'cubic-bezier(0.34, 1.56, 0.64, 1)',
+ animationFillMode: 'both',
+ },
+ groupCard: {
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ groupHeader: {
+ cursor: 'pointer',
+ paddingBlock: '10px',
+ paddingInline: '16px',
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+ groupActions: {
+ opacity: { default: 0, [stylex.when.ancestor(':hover', groupHeaderMarker)]: 1 },
+ transition: 'opacity 0.2s',
+ },
+ historyToggle: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '4px',
+ alignItems: 'center',
+ width: 'fit-content',
+ fontSize: '12px',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ },
+ row: {
+ borderBlockStartWidth: '1px',
+ // The list opens flush with the content above it. Grouped lists are
+ // unaffected: their first child is the group header, so rows are never
+ // first.
+ borderBlockStartStyle: { 'default': 'solid', ':first-child': 'none' },
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+ seqChip: {
+ flex: 'none',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '11px',
+ lineHeight: '22px',
+ color: cssVar.colorTextSecondary,
+ letterSpacing: '0.02em',
+ },
+ seqChipClickable: {
+ cursor: 'copy',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ },
+ rowActions: {
+ height: '22px',
+ animationName: rowReveal,
+ animationDuration: '0.2s',
+ animationFillMode: 'both',
+ },
+ rowActionsIdle: {
+ display: {
+ default: null,
+ [stylex.when.ancestor(':not([data-expanded], :hover, :focus-within)', rowHeaderMarker)]:
+ 'none',
+ },
+ },
+ rowChevron: {
+ gridArea: { default: null, [compact]: '1 / 4' },
+ },
+ rowMeta: {
+ animationName: rowReveal,
+ animationDuration: '0.2s',
+ animationFillMode: 'both',
+ gridArea: { default: null, [compact]: '1 / 3' },
+ flexWrap: { default: null, [compact]: 'wrap' },
+ justifyContent: { default: null, [compact]: 'flex-end' },
+ minWidth: { default: null, [compact]: 0 },
+ display: {
+ default: null,
+ [compact]: { 'default': null, ':empty': 'none' },
+ [hoverable]: {
+ default: null,
+ [stylex.when.ancestor(':not([data-expanded], :hover, :focus-within)', rowHeaderMarker)]:
+ 'none',
+ },
+ },
+ },
+ rowTitle: {
+ gridArea: { default: null, [compact]: '2 / 1 / auto / -1' },
+ },
+ rowHeader: {
+ cursor: 'pointer',
+ paddingBlock: { default: '12px', [compact]: '8px' },
+ paddingInline: { default: '16px', [compact]: 0 },
+ display: { default: null, [compact]: 'grid' },
+ gridTemplateColumns: { default: null, [compact]: '16px max-content minmax(0, 1fr) 14px' },
+ rowGap: { default: null, [compact]: '4px' },
+ },
+ // The hover wash marks the collapsed row as a click target. An OPEN row is
+ // in reading mode — a gray band flashing between the white body and the
+ // white page just severs the title from its content, so no wash there.
+ rowHeaderCollapsed: {
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },
+ },
+ stepDot: {
+ flex: 'none',
+ width: '9px',
+ height: '9px',
+ marginBlockStart: '5px',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderRadius: '50%',
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ stepRail: {
+ flex: '1',
+ width: '1px',
+ marginBlockStart: '6px',
+ backgroundColor: cssVar.colorBorderSecondary,
+ },
+ titleEllipsis: {
+ overflow: 'hidden',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+});
diff --git a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
index f9a70425391..293aae577fa 100644
--- a/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
+++ b/src/features/Acceptance/Viewer/Comments/AcceptanceDiscussion.tsx
@@ -1,7 +1,9 @@
'use client';
import type { AcceptanceCommentThread } from '@lobechat/types';
-import { Button, createStaticStyles, cssVar, cx, Flexbox, Text } from '@lobehub/ui';
+import { Button, Flexbox, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { BadgeCheck, Undo2 } from 'lucide-react';
import { nanoid } from 'nanoid';
import { memo, useCallback, useMemo, useState } from 'react';
@@ -45,7 +47,7 @@ const COMPOSER_MIN_HEIGHT = 80;
const SignInPrompt = memo(() => {
const { t } = useTranslation('verify');
return (
- <Flexbox className={local.signInPrompt} gap={10}>
+ <Flexbox gap={10} {...stylex.props(local.signInPrompt)}>
<Text weight={600}>{t('acceptance.comments.signInTitle')}</Text>
<Text fontSize={13} type={'secondary'}>
{t('acceptance.comments.signInDescription')}
@@ -64,49 +66,41 @@ const SignInPrompt = memo(() => {
SignInPrompt.displayName = 'AcceptanceDiscussionSignInPrompt';
-const local = createStaticStyles(({ css }) => ({
- composer: css`
- margin-block: 12px 4px;
- `,
- empty: css`
- padding-block: 16px;
- font-size: 13px;
- color: ${cssVar.colorTextTertiary};
- `,
- feed: css`
- flex: 1;
- min-width: 0;
- `,
- round: css`
- & + & {
- margin-block-start: 28px;
- }
- `,
- // Measured against its own width, not the window's: the viewer also renders
- // inside narrower hosts (portal, task detail), where the aside has to drop
- // below the feed even on a wide screen.
- container: css`
- container-type: inline-size;
- `,
- layout: css`
- display: flex;
- gap: 32px;
- align-items: flex-start;
-
- @container (width < 720px) {
- flex-direction: column;
- align-items: stretch;
- }
- `,
- signInPrompt: css`
- padding-block: 16px;
- padding-inline: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+const local = stylex.create({
+ composer: {
+ marginBlockStart: '12px',
+ marginBlockEnd: '4px',
+ },
+ empty: {
+ paddingBlock: '16px',
+ fontSize: '13px',
+ color: cssVar.colorTextTertiary,
+ },
+ feed: {
+ flex: '1',
+ minWidth: 0,
+ },
+ // Every round after the first (the old `& + &`).
+ roundSpaced: {
+ marginBlockStart: '28px',
+ },
+ container: { containerType: 'inline-size' },
+ layout: {
+ display: 'flex',
+ flexDirection: { 'default': null, '@container (width < 720px)': 'column' },
+ gap: '32px',
+ alignItems: { 'default': 'flex-start', '@container (width < 720px)': 'stretch' },
+ },
+ signInPrompt: {
+ paddingBlock: '16px',
+ paddingInline: '16px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+});
const entryCommentIds = (entry: DiscussionEntry): string[] => {
if (entry.kind === 'message') return [entry.comment.id];
@@ -246,7 +240,7 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
</>
}
>
- {entry.comment && <div className={entryStyles.quote}>{entry.comment}</div>}
+ {entry.comment && <div {...stylex.props(entryStyles.quote)}>{entry.comment}</div>}
</TimelineEvent>
);
}
@@ -258,13 +252,13 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
key={`round-reject-${entry.roundIndex}`}
text={t('acceptance.comments.roundRejected', { round: entry.roundIndex })}
>
- {entry.comment && <div className={entryStyles.quote}>{entry.comment}</div>}
+ {entry.comment && <div {...stylex.props(entryStyles.quote)}>{entry.comment}</div>}
</TimelineEvent>
);
if (entry.kind === 'accessRequest')
return (
<div
- className={cx(entry.request.id === anchoredId && styles.entryAnchored)}
+ {...stylex.props(entry.request.id === anchoredId && styles.entryAnchored)}
id={commentAnchorId(entry.request.id)}
key={entry.request.id}
>
@@ -311,8 +305,8 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
};
const reply = canComment ? (
- <Flexbox className={local.composer}>
- <Flexbox className={styles.composerBlock}>
+ <Flexbox {...stylex.props(local.composer)}>
+ <Flexbox {...stylex.props(styles.composerBlock)}>
<CommentComposer
borderless
minHeight={COMPOSER_MIN_HEIGHT}
@@ -344,11 +338,11 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
const ungrouped = sections.length <= 1 && (sections[0]?.roundIndex ?? null) === null;
return (
- <div className={local.container}>
- <div className={local.layout}>
- <Flexbox className={local.feed}>
+ <div {...stylex.props(local.container)}>
+ <div {...stylex.props(local.layout)}>
+ <Flexbox {...stylex.props(local.feed)}>
{timeline.length === 0 && (
- <span className={local.empty}>{t('acceptance.comments.empty')}</span>
+ <span {...stylex.props(local.empty)}>{t('acceptance.comments.empty')}</span>
)}
{ungrouped ? (
<>
@@ -360,7 +354,7 @@ const AcceptanceDiscussion = memo<{ onOpenChecks?: () => void }>(({ onOpenChecks
const key = sectionKey(section);
const open = toggled[key] ?? (index === 0 || section === anchoredSection);
return (
- <div className={local.round} key={key}>
+ <div {...stylex.props(index > 0 && local.roundSpaced)} key={key}>
<RoundSection
open={open}
section={section}
diff --git a/src/features/Acceptance/Viewer/Comments/CommentCard.tsx b/src/features/Acceptance/Viewer/Comments/CommentCard.tsx
index b285389a566..1d5c881837c 100644
--- a/src/features/Acceptance/Viewer/Comments/CommentCard.tsx
+++ b/src/features/Acceptance/Viewer/Comments/CommentCard.tsx
@@ -6,7 +6,6 @@ import {
ActionIcon,
Avatar,
confirmModal,
- cx,
DropdownMenu,
Flexbox,
Icon,
@@ -14,6 +13,7 @@ import {
Text,
toast,
} from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { Link2, MoreHorizontal, Trash2 } from 'lucide-react';
import { memo, type ReactNode, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -154,16 +154,16 @@ const CommentCard = memo<CommentCardProps>(
<Flexbox
horizontal
align={'center'}
- className={variant === 'boxed' ? styles.boxHeader : undefined}
gap={8}
wrap={'wrap'}
+ {...stylex.props(variant === 'boxed' && styles.boxHeader)}
>
{variant === 'plain' && <CommentAvatar comment={comment} size={18} />}
{variant === 'feed' && <CommentAvatar comment={comment} size={TIMELINE_NODE} />}
<Text
- className={nameOverride ? styles.headline : styles.authorName}
fontSize={13}
weight={600}
+ {...stylex.props(nameOverride ? styles.headline : styles.authorName)}
>
{name}
</Text>
@@ -182,7 +182,7 @@ const CommentCard = memo<CommentCardProps>(
* want is the link to paste somewhere else.
*/
<button
- className={cx(styles.meta, styles.timeLink)}
+ {...stylex.props(styles.meta, styles.timeLink)}
title={t('acceptance.comments.copyLinkHint', { time: time.title })}
type={'button'}
onClick={(event) => {
@@ -193,13 +193,13 @@ const CommentCard = memo<CommentCardProps>(
{nameOverride ? time.text : t('acceptance.comments.commented', { time: time.text })}
</button>
) : (
- <span className={styles.meta} title={time.title}>
+ <span {...stylex.props(styles.meta)} title={time.title}>
{nameOverride ? time.text : t('acceptance.comments.commented', { time: time.text })}
</span>
)}
{badges}
{menuItems.length > 0 && (
- <div data-comment-actions className={styles.rowActions}>
+ <div {...stylex.props(styles.rowActions)}>
<DropdownMenu
items={menuItems}
placement={'bottomRight'}
@@ -216,13 +216,13 @@ const CommentCard = memo<CommentCardProps>(
)}
</Flexbox>
<div
- className={
+ {...stylex.props(
variant === 'boxed'
? styles.body
: variant === 'feed'
? styles.feedBody
- : styles.panelBody
- }
+ : styles.panelBody,
+ )}
>
<CommentContent comment={comment} />
{onReact && (
diff --git a/src/features/Acceptance/Viewer/Comments/CommentComposer.tsx b/src/features/Acceptance/Viewer/Comments/CommentComposer.tsx
index bab9243e970..926e30c2ffd 100644
--- a/src/features/Acceptance/Viewer/Comments/CommentComposer.tsx
+++ b/src/features/Acceptance/Viewer/Comments/CommentComposer.tsx
@@ -1,7 +1,6 @@
'use client';
-import { Button, createStaticStyles, Flexbox, TextArea, toast } from '@lobehub/ui';
-import type { CSSProperties } from 'react';
+import { Button, Flexbox, TextArea, toast } from '@lobehub/ui';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -11,19 +10,6 @@ import {
useFeedbackAttachments,
} from '../Evidence/attachments';
-/**
- * `autoSize` writes its own inline height onto the textarea, so a floor has to
- * reach the element itself — a `style` on the component lands on the wrapper.
- */
-const styles = createStaticStyles(({ css }) => ({
- tall: css`
- & textarea {
- /* The control ships its own min-height; this floor has to outrank it. */
- min-height: var(--acceptance-composer-min-height) !important;
- }
- `,
-}));
-
/** Room for a couple of screenshots without turning a remark into an album. */
const MAX_COMMENT_ATTACHMENTS = 4;
@@ -83,20 +69,15 @@ const CommentComposer = memo<CommentComposerProps>(
};
return (
- <Flexbox
- className={minHeight ? styles.tall : undefined}
- gap={8}
- style={
- minHeight
- ? ({ '--acceptance-composer-min-height': `${minHeight}px` } as CSSProperties)
- : undefined
- }
- >
+ <Flexbox gap={8}>
<TextArea
autoFocus={autoFocus}
autoSize={{ maxRows: 20, minRows: compact ? 1 : 2 }}
placeholder={placeholder}
+ // The control ships its own min-height; the floor goes on the textarea
+ // itself, where an inline style outranks it.
style={borderless ? { paddingInline: 0 } : undefined}
+ styles={minHeight ? { input: { minHeight } } : undefined}
value={value}
variant={borderless ? 'borderless' : undefined}
onChange={(event) => setValue(event.target.value)}
diff --git a/src/features/Acceptance/Viewer/Comments/CommentContent.tsx b/src/features/Acceptance/Viewer/Comments/CommentContent.tsx
index ca5dd6c992e..792a9b6e4e7 100644
--- a/src/features/Acceptance/Viewer/Comments/CommentContent.tsx
+++ b/src/features/Acceptance/Viewer/Comments/CommentContent.tsx
@@ -1,4 +1,5 @@
import type { AcceptanceCommentItem } from '@lobechat/types';
+import * as stylex from '@stylexjs/stylex';
import { useTranslation } from 'react-i18next';
import { AttachmentThumbs } from '../Evidence/attachments';
@@ -11,12 +12,12 @@ const CommentContent = ({ comment }: { comment: AcceptanceCommentItem }) => {
return (
<>
{comment.deletedAt ? (
- <span className={styles.deleted}>{t('acceptance.comments.deleted')}</span>
+ <span {...stylex.props(styles.deleted)}>{t('acceptance.comments.deleted')}</span>
) : (
comment.content
)}
{comment.attachments.length > 0 && (
- <div className={styles.attachments}>
+ <div {...stylex.props(styles.attachments)}>
<AttachmentThumbs attachments={comment.attachments} size={'comment'} />
</div>
)}
diff --git a/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx b/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx
index f863675c90d..9f5dd8c2f8a 100644
--- a/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx
+++ b/src/features/Acceptance/Viewer/Comments/CommentReactions.tsx
@@ -3,128 +3,100 @@
import data from '@emoji-mart/data';
import Picker from '@emoji-mart/react';
import type { AcceptanceCommentReaction } from '@lobechat/types';
-import {
- createStaticStyles,
- cssVar,
- cx,
- Flexbox,
- Icon,
- Popover,
- toast,
- Tooltip,
- useTheme,
-} from '@lobehub/ui';
+import { Flexbox, Icon, Popover, toast, Tooltip, useTheme } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { PlusIcon, SmilePlus } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useGlobalStore } from '@/store/global';
import { globalGeneralSelectors } from '@/store/global/selectors';
+import { sx } from '@/styles/sx';
/** The ten GitHub offers, in GitHub's order — the shortcut covers nearly every click. */
const QUICK_REACTIONS = ['👍', '👎', '😄', '🎉', '😕', '❤️', '🚀', '👀', '🙏', '🔥'];
-const styles = createStaticStyles(({ css }) => ({
+const styles = stylex.create({
/** The reaction row closes the comment, so it hugs the body's bottom edge. */
- bar: css`
- padding-block-start: 10px;
- `,
- chip: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 5px;
- align-items: center;
-
- height: 24px;
- padding-block: 0;
- padding-inline: 8px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 999px;
-
- font-size: 13px;
- line-height: 1;
-
- background: ${cssVar.colorFillQuaternary};
-
- &:hover {
- border-color: ${cssVar.colorBorder};
- }
- `,
+ bar: {
+ paddingBlockStart: '10px',
+ },
+ chip: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '5px',
+ alignItems: 'center',
+ height: '24px',
+ paddingBlock: 0,
+ paddingInline: '8px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },
+ borderRadius: '999px',
+ fontSize: '13px',
+ lineHeight: 1,
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
/** Yours reads as pressed: same shape, the accent border and count. */
- chipMine: css`
- border-color: ${cssVar.colorInfoBorder};
- color: ${cssVar.colorInfoText};
- background: color-mix(in srgb, ${cssVar.colorInfo} 10%, transparent);
- `,
- count: css`
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
- `,
- emojiButton: css`
- cursor: pointer;
-
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 30px;
- height: 30px;
- border-radius: ${cssVar.borderRadius};
-
- font-size: 17px;
-
- &:hover {
- background: ${cssVar.colorFillSecondary};
- }
- `,
- moreButton: css`
- cursor: pointer;
-
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 30px;
- height: 30px;
- border-radius: ${cssVar.borderRadius};
-
- color: ${cssVar.colorTextTertiary};
-
- &:hover {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillSecondary};
- }
- `,
+ chipMine: {
+ // Hover keeps the neutral border, as it did when `.chip:hover` outranked this rule.
+ borderColor: { 'default': cssVar.colorInfoBorder, ':hover': cssVar.colorBorder },
+ color: cssVar.colorInfoText,
+ backgroundColor: `color-mix(in srgb, ${cssVar.colorInfo} 10%, transparent)`,
+ },
+ count: {
+ fontSize: '12px',
+ color: cssVar.colorTextSecondary,
+ },
+ emojiButton: {
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '30px',
+ height: '30px',
+ borderRadius: cssVar.borderRadius,
+ fontSize: '17px',
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillSecondary },
+ },
+ moreButton: {
+ cursor: 'pointer',
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '30px',
+ height: '30px',
+ borderRadius: cssVar.borderRadius,
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillSecondary },
+ },
/**
* The add button stands on its own rather than waiting for a hover: reacting
* is the cheapest way to answer a delivery, and an affordance you have to
* find by sweeping the mouse is one most readers never find at all. Quiet by
* default, it darkens under the cursor.
*/
- trigger: css`
- cursor: pointer;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 24px;
- height: 24px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 999px;
-
- color: ${cssVar.colorTextTertiary};
-
- transition: color ${cssVar.motionDurationFast};
-
- &:hover,
- &[data-open] {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillQuaternary};
- }
- `,
-}));
+ trigger: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '24px',
+ height: '24px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: '999px',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },
+ transition: `color ${cssVar.motionDurationFast}`,
+ },
+ triggerOpen: {
+ color: cssVar.colorText,
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+});
interface CommentReactionsProps {
/** Absent for a reader who may not write — the chips stay, the button goes. */
@@ -174,11 +146,11 @@ const CommentReactions = memo<CommentReactionsProps>(({ onReact, reactions }) =>
) : (
<Flexbox horizontal gap={2} style={{ padding: 4 }} wrap={'wrap'}>
{QUICK_REACTIONS.map((emoji) => (
- <div className={styles.emojiButton} key={emoji} onClick={() => pick(emoji)}>
+ <div key={emoji} {...stylex.props(styles.emojiButton)} onClick={() => pick(emoji)}>
{emoji}
</div>
))}
- <div className={styles.moreButton} onClick={() => setFull(true)}>
+ <div {...stylex.props(styles.moreButton)} onClick={() => setFull(true)}>
<Icon icon={PlusIcon} size={15} />
</div>
</Flexbox>
@@ -188,7 +160,7 @@ const CommentReactions = memo<CommentReactionsProps>(({ onReact, reactions }) =>
// row, so it stays where the reader last clicked it instead of sliding right
// by one chip every time somebody reacts.
return (
- <Flexbox horizontal align={'center'} className={styles.bar} gap={6} wrap={'wrap'}>
+ <Flexbox horizontal align={'center'} gap={6} wrap={'wrap'} {...stylex.props(styles.bar)}>
{onReact && (
<Popover
content={picker}
@@ -203,7 +175,7 @@ const CommentReactions = memo<CommentReactionsProps>(({ onReact, reactions }) =>
>
<span
data-comment-reaction-add
- className={styles.trigger}
+ {...stylex.props(styles.trigger, open && styles.triggerOpen)}
title={t('acceptance.comments.addReaction')}
{...(open ? { 'data-open': '' } : {})}
>
@@ -217,12 +189,15 @@ const CommentReactions = memo<CommentReactionsProps>(({ onReact, reactions }) =>
title={reaction.authorNames.length > 0 ? reaction.authorNames.join('、') : reaction.emoji}
>
<span
- className={cx(styles.chip, reaction.mine && styles.chipMine)}
- style={onReact ? undefined : { cursor: 'default' }}
+ {...sx(
+ styles.chip,
+ reaction.mine && styles.chipMine,
+ onReact ? undefined : { cursor: 'default' },
+ )}
onClick={onReact ? () => void fire(reaction.emoji, !reaction.mine) : undefined}
>
<span>{reaction.emoji}</span>
- <span className={styles.count}>{reaction.count}</span>
+ <span {...stylex.props(styles.count)}>{reaction.count}</span>
</span>
</Tooltip>
))}
diff --git a/src/features/Acceptance/Viewer/Comments/CommentThread.tsx b/src/features/Acceptance/Viewer/Comments/CommentThread.tsx
index d32e2c066b1..8d00b23dca6 100644
--- a/src/features/Acceptance/Viewer/Comments/CommentThread.tsx
+++ b/src/features/Acceptance/Viewer/Comments/CommentThread.tsx
@@ -1,7 +1,8 @@
'use client';
import type { AcceptanceCommentThread } from '@lobechat/types';
-import { Button, cx, Flexbox, Icon, Tag, toast } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Tag, toast } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { CheckCircle2 } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -66,7 +67,7 @@ const CommentThread = memo<CommentThreadProps>(
if (!open)
return (
<button
- className={styles.resolvedSummary}
+ {...stylex.props(styles.resolvedSummary)}
type={'button'}
onClick={() => setOpenOverride(true)}
>
@@ -89,7 +90,7 @@ const CommentThread = memo<CommentThreadProps>(
);
return (
- <Flexbox className={cx(resolved && styles.resolvedThread)}>
+ <Flexbox {...stylex.props(resolved && styles.resolvedThread)}>
<CommentCard
anchored
badges={badges}
@@ -99,13 +100,13 @@ const CommentThread = memo<CommentThreadProps>(
/>
{replies.map((reply) => (
// A reply link lands on the reply itself, not just its thread.
- <div className={styles.panelReply} id={commentAnchorId(reply.id)} key={reply.id}>
+ <div id={commentAnchorId(reply.id)} key={reply.id} {...stylex.props(styles.panelReply)}>
<CommentCard anchored comment={reply} variant={'plain'} onDelete={onDelete} />
</div>
))}
{canComment &&
(replying ? (
- <Flexbox className={styles.panelActions}>
+ <Flexbox {...stylex.props(styles.panelActions)}>
<CommentComposer
autoFocus
compact
@@ -119,7 +120,7 @@ const CommentThread = memo<CommentThreadProps>(
/>
</Flexbox>
) : (
- <Flexbox horizontal className={styles.panelActions} gap={2}>
+ <Flexbox horizontal gap={2} {...stylex.props(styles.panelActions)}>
<Button outdent size={'small'} type={'text'} onClick={() => setReplying(true)}>
{t('acceptance.comments.reply')}
</Button>
diff --git a/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx b/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
index 84384d4fa1b..ac29d826cec 100644
--- a/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
+++ b/src/features/Acceptance/Viewer/Comments/DiscussionAside.tsx
@@ -1,7 +1,9 @@
'use client';
import type { AcceptanceCommentItem } from '@lobechat/types';
-import { Button, createStaticStyles, cssVar, Flexbox, Tooltip } from '@lobehub/ui';
+import { Button, Flexbox, Tooltip } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -10,52 +12,40 @@ import { commentAuthorName, CommentAvatar } from './CommentCard';
const MAX_FACES = 8;
-const styles = createStaticStyles(({ css }) => ({
- aside: css`
- position: sticky;
- inset-block-start: 20px;
-
- display: flex;
- flex: none;
- flex-direction: column;
- gap: 16px;
-
- width: 296px;
-
- font-size: 13px;
-
- @container (width < 720px) {
- position: static;
- width: auto;
- }
-
- @media (width <= 767px) {
- position: static;
- order: -1;
- }
- `,
- list: css`
- display: grid;
- grid-template-columns: max-content minmax(0, 1fr);
- gap: 12px 16px;
- align-items: center;
-
- margin: 0;
- `,
- term: css`
- color: ${cssVar.colorTextTertiary};
- `,
- value: css`
- overflow: hidden;
-
- min-width: 0;
- margin: 0;
-
- color: ${cssVar.colorText};
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
-}));
+const styles = stylex.create({
+ aside: {
+ position: {
+ 'default': 'sticky',
+ '@container (width < 720px)': 'static',
+ '@media (width <= 767px)': 'static',
+ },
+ insetBlockStart: '20px',
+ display: 'flex',
+ flex: 'none',
+ flexDirection: 'column',
+ gap: '16px',
+ width: { 'default': '296px', '@container (width < 720px)': 'auto' },
+ fontSize: '13px',
+ order: { 'default': null, '@media (width <= 767px)': -1 },
+ },
+ list: {
+ display: 'grid',
+ gridTemplateColumns: 'max-content minmax(0, 1fr)',
+ rowGap: '12px',
+ columnGap: '16px',
+ alignItems: 'center',
+ margin: '0',
+ },
+ term: { color: cssVar.colorTextTertiary },
+ value: {
+ overflow: 'hidden',
+ minWidth: '0',
+ margin: '0',
+ color: cssVar.colorText,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+});
interface DiscussionAsideProps {
items: AcceptanceCommentItem[];
@@ -84,23 +74,23 @@ const DiscussionAside = memo<DiscussionAsideProps>(
}, [items]);
return (
- <aside aria-label={t('acceptance.comments.aside.label')} className={styles.aside}>
+ <aside aria-label={t('acceptance.comments.aside.label')} {...stylex.props(styles.aside)}>
{status && (
<div aria-label={t('acceptance.comments.aside.status')}>
<AcceptanceStatusPill status={status} />
</div>
)}
- <dl className={styles.list}>
+ <dl {...stylex.props(styles.list)}>
{latestRound !== undefined && (
<>
- <dt className={styles.term}>{t('acceptance.comments.aside.round')}</dt>
- <dd className={styles.value}>{latestRound}</dd>
+ <dt {...stylex.props(styles.term)}>{t('acceptance.comments.aside.round')}</dt>
+ <dd {...stylex.props(styles.value)}>{latestRound}</dd>
</>
)}
{faces.length > 0 && (
<>
- <dt className={styles.term}>{t('acceptance.comments.participants')}</dt>
- <dd className={styles.value}>
+ <dt {...stylex.props(styles.term)}>{t('acceptance.comments.participants')}</dt>
+ <dd {...stylex.props(styles.value)}>
<Flexbox horizontal gap={4} wrap={'wrap'}>
{faces.slice(0, MAX_FACES).map((comment) => (
<Tooltip key={comment.id} title={commentAuthorName(comment.author)}>
@@ -115,8 +105,8 @@ const DiscussionAside = memo<DiscussionAsideProps>(
)}
{approvers.length > 0 && (
<>
- <dt className={styles.term}>{t('acceptance.comments.aside.approvals')}</dt>
- <dd className={styles.value}>{approvers.join(', ')}</dd>
+ <dt {...stylex.props(styles.term)}>{t('acceptance.comments.aside.approvals')}</dt>
+ <dd {...stylex.props(styles.value)}>{approvers.join(', ')}</dd>
</>
)}
</dl>
diff --git a/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx b/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx
index 50a24e590ba..19aa9d07c67 100644
--- a/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx
+++ b/src/features/Acceptance/Viewer/Comments/DiscussionEntries.tsx
@@ -1,7 +1,9 @@
'use client';
import type { AcceptanceCommentItem, AcceptanceCommentThread } from '@lobechat/types';
-import { createStaticStyles, cssVar, cx, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { GitCommitHorizontal, MessageSquare } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -14,6 +16,7 @@ import { checkDisplayTitle } from '../../utils';
import { useAcceptanceScope } from '../AcceptanceScope';
import { collectEvidenceById } from '../Checks/CheckHistory';
import type { AcceptanceCheck } from '../Checks/types';
+import { timelineEntryMarker } from '../markers.stylex';
import { acceptanceCheckPath, useAcceptanceRouteBase } from '../routes';
import { commentAnchorId } from './anchor';
import CommentCard, { commentAuthorName, CommentAvatar } from './CommentCard';
@@ -22,36 +25,34 @@ import { NODE_GUTTER, styles, TIMELINE_NODE } from './styles';
import ThreadEvidence from './ThreadEvidence';
import TimelineEvent from './TimelineEvent';
-export const entryStyles = createStaticStyles(({ css }) => ({
- checkLink: css`
- font-weight: 500;
- color: ${cssVar.colorText};
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
- quote: css`
- padding-block: 6px;
- padding-inline: 12px;
- border-inline-start: 2px solid ${cssVar.colorBorder};
-
- font-size: 13px;
- line-height: 1.65;
- color: ${cssVar.colorText};
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
- regionBody: css`
- padding-block-start: 8px;
- padding-inline-start: ${TIMELINE_NODE + NODE_GUTTER}px;
- `,
- regionHeader: css`
- font-size: 13px;
- color: ${cssVar.colorTextSecondary};
- `,
-}));
+export const entryStyles = stylex.create({
+ checkLink: {
+ fontWeight: 500,
+ color: cssVar.colorText,
+ textDecoration: { 'default': null, ':hover': 'underline' },
+ },
+ quote: {
+ paddingBlock: '6px',
+ paddingInline: '12px',
+ borderInlineStartWidth: '2px',
+ borderInlineStartStyle: 'solid',
+ borderInlineStartColor: cssVar.colorBorder,
+ fontSize: '13px',
+ lineHeight: 1.65,
+ color: cssVar.colorText,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
+ regionBody: {
+ paddingBlockStart: '8px',
+ // TIMELINE_NODE + NODE_GUTTER: StyleX cannot read constants across files.
+ paddingInlineStart: '28px',
+ },
+ regionHeader: {
+ fontSize: '13px',
+ color: cssVar.colorTextSecondary,
+ },
+});
/**
* A round. With a note it IS the agent's turn: one entry whose header says
@@ -77,8 +78,8 @@ export const TimelineRound = memo<{
);
return (
<div
- className={cx(styles.timelineEntry, anchored && styles.entryAnchored)}
id={commentAnchorId(proposal.id)}
+ {...stylex.props(styles.timelineEntry, anchored && styles.entryAnchored, timelineEntryMarker)}
>
<CommentCard
anchored
@@ -105,8 +106,8 @@ export const TimelineMessage = memo<{
reactable: boolean;
}>(({ anchored, comment, onDelete, onReact, reactable }) => (
<div
- className={cx(styles.timelineEntry, anchored && styles.entryAnchored)}
id={commentAnchorId(comment.id)}
+ {...stylex.props(styles.timelineEntry, anchored && styles.entryAnchored, timelineEntryMarker)}
>
<CommentCard
anchored
@@ -133,10 +134,10 @@ export const CheckReference = memo<{ check?: AcceptanceCheck }>(({ check }) => {
const workspaceSlug = useActiveWorkspaceSlug();
if (!check) return null;
const label = `C${check.seq} · ${checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'))}`;
- if (embedded) return <span className={entryStyles.checkLink}>{label}</span>;
+ if (embedded) return <span {...stylex.props(entryStyles.checkLink)}>{label}</span>;
return (
<Link
- className={entryStyles.checkLink}
+ {...stylex.props(entryStyles.checkLink)}
to={buildWorkspaceAwarePath(
acceptanceCheckPath(acceptanceId, check.id, routeBase),
workspaceSlug,
@@ -174,15 +175,15 @@ export const TimelineRegion = memo<{
return (
<div
- className={cx(styles.timelineEntry, anchored && styles.entryAnchored)}
id={commentAnchorId(root.id)}
+ {...stylex.props(styles.timelineEntry, anchored && styles.entryAnchored, timelineEntryMarker)}
>
<Flexbox
horizontal
align={'center'}
- className={entryStyles.regionHeader}
gap={NODE_GUTTER}
wrap={'wrap'}
+ {...stylex.props(entryStyles.regionHeader)}
>
<CommentAvatar comment={root} size={TIMELINE_NODE} />
<Icon icon={MessageSquare} size={13} />
@@ -196,9 +197,9 @@ export const TimelineRegion = memo<{
<Flexbox
horizontal
align={'flex-start'}
- className={entryStyles.regionBody}
gap={16}
wrap={'wrap'}
+ {...stylex.props(entryStyles.regionBody)}
>
{evidence && (
<ThreadEvidence
diff --git a/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx b/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx
index 0987ecc8353..6cce5be061d 100644
--- a/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx
+++ b/src/features/Acceptance/Viewer/Comments/EvidenceCommentModal.tsx
@@ -3,8 +3,8 @@
import type { AcceptanceCommentTime, AcceptanceReviewAnnotation } from '@lobechat/types';
import {
createModal,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- needs lobe-ui slot: createModal panel
createStaticStyles,
- cssVar,
cx,
Flexbox,
Icon,
@@ -12,6 +12,8 @@ import {
toast,
useModalContext,
} from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { t } from 'i18next';
import { Film } from 'lucide-react';
import type { ReactNode } from 'react';
@@ -42,8 +44,92 @@ import { VideoCommentEditor } from './VideoCommentEditor';
const MODAL_WIDTH = 'min(1180px, calc(100vw - 48px))';
-const styles = createStaticStyles(({ css }) => ({
- /** A review surface, not a dialog: the evidence needs the room to be circled precisely. */
+const phone = '@media (width <= 767px)';
+
+const styles = stylex.create({
+ popup: {
+ alignItems: { default: null, [phone]: 'stretch' },
+ justifyContent: { default: null, [phone]: 'stretch' },
+ width: { default: null, [phone]: '100vw' },
+ maxWidth: { default: null, [phone]: '100vw' },
+ height: { default: null, [phone]: '100dvh' },
+ },
+ header: {
+ minHeight: { default: null, [phone]: '56px' },
+ paddingBlockStart: { default: null, [phone]: 'max(12px, env(safe-area-inset-top))' },
+ paddingBlockEnd: { default: null, [phone]: '12px' },
+ paddingInlineStart: { default: null, [phone]: '12px' },
+ paddingInlineEnd: { default: null, [phone]: '52px' },
+ },
+ close: {
+ insetBlockStart: { default: null, [phone]: 'max(4px, env(safe-area-inset-top))' },
+ insetInlineEnd: { default: null, [phone]: '4px' },
+ width: { default: null, [phone]: '44px' },
+ height: { default: null, [phone]: '44px' },
+ },
+ strip: {
+ overflowX: 'auto',
+ flex: 'none',
+ gap: '8px',
+ },
+ thumb: {
+ cursor: { 'default': 'pointer', ':disabled': 'not-allowed' },
+ position: 'relative',
+ overflow: 'hidden',
+ flex: 'none',
+ width: '72px',
+ height: '44px',
+ padding: 0,
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: 'transparent',
+ borderRadius: cssVar.borderRadius,
+ backgroundColor: cssVar.colorFillTertiary,
+ backgroundImage: 'none',
+ opacity: { 'default': null, ':disabled': 0.5 },
+ outlineWidth: { 'default': null, ':focus-visible': '2px' },
+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },
+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimaryBorder },
+ outlineOffset: { 'default': null, ':focus-visible': '1px' },
+ },
+ thumbImage: {
+ display: 'block',
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover',
+ },
+ thumbActive: {
+ borderColor: cssVar.colorPrimary,
+ },
+ // A video has no poster to thumbnail without decoding it — an icon tile says what it is.
+ videoThumb: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '100%',
+ height: '100%',
+ color: '#fff',
+ backgroundColor: '#000',
+ backgroundImage: 'none',
+ },
+ // Unsent drafts on another piece of evidence: sending here leaves them where they are.
+ draftCount: {
+ position: 'absolute',
+ insetBlockStart: '2px',
+ insetInlineEnd: '2px',
+ minWidth: '16px',
+ height: '16px',
+ paddingInline: '4px',
+ borderRadius: '8px',
+ fontSize: '11px',
+ fontWeight: 600,
+ lineHeight: '16px',
+ color: cssVar.colorBgContainer,
+ backgroundColor: cssVar.colorText,
+ },
+});
+
+const fallback = createStaticStyles(({ css }) => ({
popup: css`
> div {
display: flex;
@@ -55,13 +141,6 @@ const styles = createStaticStyles(({ css }) => ({
}
@media (width <= 767px) {
- align-items: stretch;
- justify-content: stretch;
-
- width: 100vw !important;
- max-width: 100vw !important;
- height: 100dvh;
-
> div {
width: 100vw !important;
max-width: 100vw !important;
@@ -72,93 +151,6 @@ const styles = createStaticStyles(({ css }) => ({
}
}
`,
- header: css`
- @media (width <= 767px) {
- min-height: 56px;
- padding-block: max(12px, env(safe-area-inset-top)) 12px;
- padding-inline: 12px 52px;
- }
- `,
- close: css`
- @media (width <= 767px) {
- inset-block-start: max(4px, env(safe-area-inset-top));
- inset-inline-end: 4px;
- width: 44px;
- height: 44px;
- }
- `,
- strip: css`
- overflow-x: auto;
- flex: none;
- gap: 8px;
- `,
- thumb: css`
- cursor: pointer;
-
- position: relative;
-
- overflow: hidden;
- flex: none;
-
- width: 72px;
- height: 44px;
- padding: 0;
- border: 2px solid transparent;
- border-radius: ${cssVar.borderRadius};
-
- background: ${cssVar.colorFillTertiary};
-
- &:disabled {
- cursor: not-allowed;
- opacity: 0.5;
- }
-
- &:focus-visible {
- outline: 2px solid ${cssVar.colorPrimaryBorder};
- outline-offset: 1px;
- }
-
- img {
- display: block;
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- `,
- thumbActive: css`
- border-color: ${cssVar.colorPrimary};
- `,
- /** A video has no poster to thumbnail without decoding it — an icon tile says what it is. */
- videoThumb: css`
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 100%;
- height: 100%;
-
- color: #fff;
-
- background: #000;
- `,
- /** Unsent drafts on another piece of evidence: sending here leaves them where they are. */
- draftCount: css`
- position: absolute;
- inset-block-start: 2px;
- inset-inline-end: 2px;
-
- min-width: 16px;
- height: 16px;
- padding-inline: 4px;
- border-radius: 8px;
-
- font-size: 11px;
- font-weight: 600;
- line-height: 16px;
- color: ${cssVar.colorBgContainer};
-
- background: ${cssVar.colorText};
- `,
}));
export interface EvidenceCommentValue {
@@ -323,7 +315,7 @@ const EvidenceCommentContent = (options: EvidenceCommentModalProps) => {
if (!active || !userId) return null;
const strip = media.length > 1 && (
- <Flexbox horizontal className={styles.strip}>
+ <Flexbox horizontal {...stylex.props(styles.strip)}>
{media.map((item, index) => {
const count = draftCount(userId, options.acceptanceId, item);
const label = t('acceptance.comments.evidenceNumber', { index: index + 1 });
@@ -331,23 +323,23 @@ const EvidenceCommentContent = (options: EvidenceCommentModalProps) => {
<button
aria-label={label}
aria-pressed={item.id === active.id}
- className={cx(styles.thumb, item.id === active.id && styles.thumbActive)}
disabled={pending}
key={item.id}
type={'button'}
+ {...stylex.props(styles.thumb, item.id === active.id && styles.thumbActive)}
title={
count > 0 ? `${label} · ${t('acceptance.comments.evidenceDrafts', { count })}` : label
}
onClick={() => setActiveId(item.id)}
>
{item.type === 'video' ? (
- <span className={styles.videoThumb}>
+ <span {...stylex.props(styles.videoThumb)}>
<Icon icon={Film} size={18} />
</span>
) : (
- <img alt={''} src={item.fileUrl!} />
+ <img alt={''} src={item.fileUrl!} {...stylex.props(styles.thumbImage)} />
)}
- {count > 0 && <span className={styles.draftCount}>{count}</span>}
+ {count > 0 && <span {...stylex.props(styles.draftCount)}>{count}</span>}
</button>
);
})}
@@ -374,7 +366,11 @@ const EvidenceCommentContent = (options: EvidenceCommentModalProps) => {
export const openEvidenceCommentModal = (options: EvidenceCommentModalProps) =>
createModal({
content: <EvidenceCommentContent {...options} />,
- classNames: { close: styles.close, header: styles.header, popup: styles.popup },
+ classNames: {
+ close: stylex.props(styles.close).className,
+ header: stylex.props(styles.header).className,
+ popup: cx(stylex.props(styles.popup).className, fallback.popup),
+ },
footer: null,
maskClosable: true,
styles: {
diff --git a/src/features/Acceptance/Viewer/Comments/ReviewerApprovalBar.tsx b/src/features/Acceptance/Viewer/Comments/ReviewerApprovalBar.tsx
index 77126e6dd16..cc0459eda4b 100644
--- a/src/features/Acceptance/Viewer/Comments/ReviewerApprovalBar.tsx
+++ b/src/features/Acceptance/Viewer/Comments/ReviewerApprovalBar.tsx
@@ -1,15 +1,8 @@
'use client';
-import {
- Button,
- createStaticStyles,
- cssVar,
- Flexbox,
- Icon,
- Text,
- TextArea,
- toast,
-} from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text, TextArea, toast } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { BadgeCheck } from 'lucide-react';
import { nanoid } from 'nanoid';
import { memo, useState } from 'react';
@@ -23,20 +16,19 @@ import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { canReviewAcceptance } from '../visibility';
import { useAcceptanceComments } from './hooks';
-const styles = createStaticStyles(({ css }) => ({
- card: css`
- padding-block: 14px;
- padding-inline: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 12px;
-
- background: ${cssVar.colorBgContainer};
- `,
- description: css`
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
-}));
+const styles = stylex.create({
+ card: {
+ paddingBlock: '14px',
+ paddingInline: '16px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: '12px',
+ backgroundColor: cssVar.colorBgContainer,
+ backgroundImage: 'none',
+ },
+ description: { fontSize: '12px', color: cssVar.colorTextTertiary },
+});
/**
* The reviewer's counterpart of the decision bar. A teammate who can review
@@ -107,7 +99,7 @@ const ReviewerApprovalBar = memo(() => {
);
return (
- <Flexbox className={styles.card} gap={10}>
+ <Flexbox className={stylex.props(styles.card).className} gap={10}>
<Flexbox horizontal align={'center'} gap={8}>
<Icon
color={approvedCurrentRound ? cssVar.colorSuccess : undefined}
@@ -122,7 +114,7 @@ const ReviewerApprovalBar = memo(() => {
: t('acceptance.comments.approve')}
</Text>
</Flexbox>
- <span className={styles.description}>
+ <span {...stylex.props(styles.description)}>
{approvedCurrentRound
? t('acceptance.comments.withdrawDescription')
: t('acceptance.comments.approveDescription')}
diff --git a/src/features/Acceptance/Viewer/Comments/RoundSection.tsx b/src/features/Acceptance/Viewer/Comments/RoundSection.tsx
index a4a08bc6c9a..1f997973895 100644
--- a/src/features/Acceptance/Viewer/Comments/RoundSection.tsx
+++ b/src/features/Acceptance/Viewer/Comments/RoundSection.tsx
@@ -1,67 +1,66 @@
'use client';
-import { createStaticStyles, cssVar, cx, Icon } from '@lobehub/ui';
+import { Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronRight } from 'lucide-react';
import { memo, type ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { useActivityTime } from '@/hooks/useActivityTime';
+import { roundHeaderMarker } from '../markers.stylex';
import type { DiscussionSection } from './discussionRounds';
-const styles = createStaticStyles(({ css }) => ({
- chevron: css`
- flex: none;
- color: ${cssVar.colorTextQuaternary};
- transition: transform ${cssVar.motionDurationFast};
- `,
- chevronOpen: css`
- transform: rotate(90deg);
- `,
- header: css`
- cursor: pointer;
-
- display: flex;
- gap: 10px;
- align-items: center;
-
- width: 100%;
- min-height: 32px;
- padding: 0;
- border: none;
-
- font: inherit;
- color: ${cssVar.colorText};
- text-align: start;
-
- background: none;
-
- &:hover .round-section-rule {
- background: ${cssVar.colorBorder};
- }
- `,
- label: css`
- flex: none;
- font-size: 12px;
- font-weight: 600;
- `,
- meta: css`
- flex: none;
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
- rule: css`
- flex: 1;
- height: 1px;
- background: ${cssVar.colorBorderSecondary};
- transition: background ${cssVar.motionDurationFast};
- `,
- sentBack: css`
- flex: none;
- font-size: 12px;
- color: ${cssVar.colorWarningText};
- `,
-}));
+const styles = stylex.create({
+ chevron: {
+ flex: 'none',
+ color: cssVar.colorTextQuaternary,
+ transition: `transform ${cssVar.motionDurationFast}`,
+ },
+ chevronOpen: {
+ transform: 'rotate(90deg)',
+ },
+ header: {
+ cursor: 'pointer',
+ display: 'flex',
+ gap: '10px',
+ alignItems: 'center',
+ width: '100%',
+ minHeight: '32px',
+ padding: 0,
+ borderStyle: 'none',
+ font: 'inherit',
+ color: cssVar.colorText,
+ textAlign: 'start',
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ },
+ label: {
+ flex: 'none',
+ fontSize: '12px',
+ fontWeight: 600,
+ },
+ meta: {
+ flex: 'none',
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
+ rule: {
+ flex: '1',
+ height: '1px',
+ backgroundColor: {
+ default: cssVar.colorBorderSecondary,
+ [stylex.when.ancestor(':hover', roundHeaderMarker)]: cssVar.colorBorder,
+ },
+ transition: `background ${cssVar.motionDurationFast}`,
+ },
+ sentBack: {
+ flex: 'none',
+ fontSize: '12px',
+ color: cssVar.colorWarningText,
+ },
+});
const SectionTime = ({ at }: { at: Date }) => {
const time = useActivityTime(at);
@@ -84,20 +83,25 @@ const RoundSection = memo<RoundSectionProps>(({ children, onToggle, open, sectio
return (
<section aria-label={label}>
- <button aria-expanded={open} className={styles.header} type={'button'} onClick={onToggle}>
+ <button
+ aria-expanded={open}
+ type={'button'}
+ {...stylex.props(styles.header, roundHeaderMarker)}
+ onClick={onToggle}
+ >
<Icon
- className={cx(styles.chevron, open && styles.chevronOpen)}
icon={ChevronRight}
size={14}
+ {...stylex.props(styles.chevron, open && styles.chevronOpen)}
/>
- <span className={styles.label}>{label}</span>
+ <span {...stylex.props(styles.label)}>{label}</span>
{section.sentBack && (
- <span className={styles.sentBack}>
+ <span {...stylex.props(styles.sentBack)}>
{t('acceptance.workspace.groups.status.rejected')}
</span>
)}
- <span className={cx(styles.rule, 'round-section-rule')} />
- <span className={styles.meta}>
+ <span {...stylex.props(styles.rule)} />
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.comments.sectionMessages', { count: section.messageCount })}
{section.landedAt && (
<>
diff --git a/src/features/Acceptance/Viewer/Comments/ThreadEvidence.tsx b/src/features/Acceptance/Viewer/Comments/ThreadEvidence.tsx
index d90cbab313b..2ac9cbfd759 100644
--- a/src/features/Acceptance/Viewer/Comments/ThreadEvidence.tsx
+++ b/src/features/Acceptance/Viewer/Comments/ThreadEvidence.tsx
@@ -1,7 +1,9 @@
'use client';
import type { AcceptanceCommentItem } from '@lobechat/types';
-import { Button, createModal, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Button, createModal, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Play } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -33,20 +35,15 @@ export const thumbnailCropOffset = (
return Math.min(Math.max(center - THUMBNAIL_MAX_HEIGHT / 2, 0), height - THUMBNAIL_MAX_HEIGHT);
};
-const styles = createStaticStyles(({ css }) => ({
- crop: css`
- overflow: hidden;
- max-height: ${THUMBNAIL_MAX_HEIGHT}px;
- border-radius: ${cssVar.borderRadius};
- `,
- caption: css`
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
- wrapper: css`
- align-self: flex-start;
- `,
-}));
+const styles = stylex.create({
+ crop: {
+ overflow: 'hidden',
+ maxHeight: `${THUMBNAIL_MAX_HEIGHT}px`,
+ borderRadius: cssVar.borderRadius,
+ },
+ caption: { fontSize: '12px', color: cssVar.colorTextTertiary },
+ wrapper: { alignSelf: 'flex-start' },
+});
interface ThreadEvidenceProps {
comment: AcceptanceCommentItem;
@@ -121,7 +118,7 @@ const ThreadEvidence = memo<ThreadEvidenceProps>(({ comment, evidence, roundInde
: loaded;
return (
- <Flexbox className={styles.wrapper} gap={4}>
+ <Flexbox className={stylex.props(styles.wrapper).className} gap={4}>
{evidence.type === 'video' && comment.time ? (
<Button
icon={<Icon icon={Play} />}
@@ -153,7 +150,7 @@ const ThreadEvidence = memo<ThreadEvidenceProps>(({ comment, evidence, roundInde
{t('acceptance.comments.video.showFrame', { time: formatVideoTime(comment.time.start) })}
</Button>
) : (
- <div className={styles.crop}>
+ <div {...stylex.props(styles.crop)}>
<div
style={{
marginBlockStart: -thumbnailCropOffset(size ?? {}, comment.rect),
@@ -173,7 +170,7 @@ const ThreadEvidence = memo<ThreadEvidenceProps>(({ comment, evidence, roundInde
</div>
</div>
)}
- <span className={styles.caption}>
+ <span {...stylex.props(styles.caption)}>
{stale && roundIndex !== undefined
? t('acceptance.comments.evidenceFromRound', { round: roundIndex })
: t('acceptance.comments.evidenceThisRound')}
diff --git a/src/features/Acceptance/Viewer/Comments/TimelineEvent.tsx b/src/features/Acceptance/Viewer/Comments/TimelineEvent.tsx
index 0e111463502..8dc33cc6bc2 100644
--- a/src/features/Acceptance/Viewer/Comments/TimelineEvent.tsx
+++ b/src/features/Acceptance/Viewer/Comments/TimelineEvent.tsx
@@ -1,9 +1,11 @@
import { Flexbox, Icon } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import type { LucideIcon } from 'lucide-react';
import type { ReactNode } from 'react';
import { useActivityTime } from '@/hooks/useActivityTime';
+import { timelineEntryMarker } from '../markers.stylex';
import { NODE_GUTTER, styles } from './styles';
/** A persisted event, shared by the interactive discussion and read-only report. */
@@ -21,16 +23,21 @@ const TimelineEvent = ({
}) => {
const time = useActivityTime(at);
return (
- <Flexbox horizontal align={'flex-start'} className={styles.timelineEntry} gap={NODE_GUTTER}>
- <span className={styles.timelineNode}>
- <span className={styles.eventDot}>
+ <Flexbox
+ horizontal
+ align={'flex-start'}
+ gap={NODE_GUTTER}
+ {...stylex.props(styles.timelineEntry, timelineEntryMarker)}
+ >
+ <span {...stylex.props(styles.timelineNode)}>
+ <span {...stylex.props(styles.eventDot)}>
<Icon icon={icon} size={14} />
</span>
</span>
<Flexbox flex={1} gap={6} style={{ minWidth: 0 }}>
- <Flexbox horizontal align={'center'} className={styles.event} gap={8} wrap={'wrap'}>
+ <Flexbox horizontal align={'center'} gap={8} wrap={'wrap'} {...stylex.props(styles.event)}>
<span>{text}</span>
- <span className={styles.meta} title={time.title}>
+ <span {...stylex.props(styles.meta)} title={time.title}>
{time.text}
</span>
</Flexbox>
diff --git a/src/features/Acceptance/Viewer/Comments/styles.ts b/src/features/Acceptance/Viewer/Comments/styles.ts
index 33d1526808b..f4f37e36e7c 100644
--- a/src/features/Acceptance/Viewer/Comments/styles.ts
+++ b/src/features/Acceptance/Viewer/Comments/styles.ts
@@ -1,4 +1,7 @@
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+import { timelineEntryMarker } from '../markers.stylex';
/**
* Two comment surfaces, deliberately different.
@@ -23,31 +26,29 @@ const ENTRY_GAP = 10;
*/
const SELF_BORDER = `color-mix(in srgb, ${cssVar.colorInfoBorder} 45%, transparent)`;
-export const styles = createStaticStyles(({ css }) => ({
- body: css`
- /* A one-line remark in a header-topped box read as a sliver; GitHub's
- comment bodies always have room to breathe under the author line. */
- min-height: 80px;
- padding-block: 12px;
- padding-inline: 14px;
-
- font-size: 14px;
- line-height: 1.7;
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
+export const styles = stylex.create({
+ body: {
+ // A one-line remark in a header-topped box read as a sliver; GitHub's
+ // comment bodies always have room to breathe under the author line.
+ minHeight: '80px',
+ paddingBlock: '12px',
+ paddingInline: '14px',
+ fontSize: '14px',
+ lineHeight: 1.7,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
/** A discussion message: header strip, then the words. */
- box: css`
- position: relative;
-
- flex: 1;
-
- min-width: 0;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- background: ${cssVar.colorBgContainer};
- `,
+ box: {
+ position: 'relative',
+ flex: '1',
+ minWidth: 0,
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ backgroundColor: cssVar.colorBgContainer,
+ },
/**
* Your own turn, the way GitHub marks it: the box line picks up the accent
* blue and the header strip takes a matching tint. In a two-person review you
@@ -58,199 +59,174 @@ export const styles = createStaticStyles(({ css }) => ({
* then the accent tint on top of it — read as decoration once the rest of the
* discussion had none.
*/
- boxSelf: css`
- border-color: ${SELF_BORDER};
- `,
+ boxSelf: {
+ borderColor: SELF_BORDER,
+ },
/**
* The author line, over the words. No fill and no divider: a strip of tinted
* surface with a rule under it framed every remark like a table row. The
* padding stays, so the line still reads as its own band.
*/
- boxHeader: css`
- padding-block: 8px;
- padding-inline: 14px;
- border-start-start-radius: ${cssVar.borderRadius};
- border-start-end-radius: ${cssVar.borderRadius};
- `,
+ boxHeader: {
+ paddingBlock: '8px',
+ paddingInline: '14px',
+ borderStartStartRadius: cssVar.borderRadius,
+ borderStartEndRadius: cssVar.borderRadius,
+ },
/**
* The comment the URL points at. An outline rather than a fill: the box's own
* line already carries meaning (yours vs theirs), and the discussion has no
* fills left to compete with.
*/
- boxAnchored: css`
- outline: 2px solid ${cssVar.colorInfoBorder};
- outline-offset: 2px;
- `,
+ boxAnchored: {
+ outlineWidth: '2px',
+ outlineStyle: 'solid',
+ outlineColor: cssVar.colorInfoBorder,
+ outlineOffset: '2px',
+ },
/** Attachments sit under the words with a gap, never woven into them. */
- attachments: css`
- padding-block-start: 10px;
- `,
+ attachments: {
+ paddingBlockStart: '10px',
+ },
/** The composer, wrapped so it reads as one block rather than a loose field. */
- composerBlock: css`
- padding-block: 8px;
- padding-inline: 12px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
-
- transition: border-color ${cssVar.motionDurationFast};
-
- &:focus-within {
- border-color: ${cssVar.colorBorder};
- }
- `,
- deleted: css`
- font-style: italic;
- color: ${cssVar.colorTextTertiary};
- `,
- event: css`
- padding-block: 2px;
- font-size: 13px;
- color: ${cssVar.colorTextSecondary};
- `,
- eventDot: css`
- display: inline-flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: ${EVENT_DOT}px;
- height: ${EVENT_DOT}px;
-
- color: ${cssVar.colorTextTertiary};
- `,
- entryAnchored: css`
- border-radius: ${cssVar.borderRadius};
- background: ${cssVar.colorInfoBg};
- box-shadow: 0 0 0 6px ${cssVar.colorInfoBg};
- `,
- feedBody: css`
- padding-block-start: 4px;
- padding-inline-start: ${TIMELINE_NODE + NODE_GUTTER}px;
-
- font-size: 14px;
- line-height: 1.65;
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
- meta: css`
- flex: none;
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
+ composerBlock: {
+ paddingBlock: '8px',
+ paddingInline: '12px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':focus-within': cssVar.colorBorder },
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgContainer,
+ transition: `border-color ${cssVar.motionDurationFast}`,
+ },
+ deleted: {
+ fontStyle: 'italic',
+ color: cssVar.colorTextTertiary,
+ },
+ event: {
+ paddingBlock: '2px',
+ fontSize: '13px',
+ color: cssVar.colorTextSecondary,
+ },
+ eventDot: {
+ display: 'inline-flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: `${EVENT_DOT}px`,
+ height: `${EVENT_DOT}px`,
+ color: cssVar.colorTextTertiary,
+ },
+ entryAnchored: {
+ borderRadius: cssVar.borderRadius,
+ backgroundColor: cssVar.colorInfoBg,
+ boxShadow: `0 0 0 6px ${cssVar.colorInfoBg}`,
+ },
+ feedBody: {
+ paddingBlockStart: '4px',
+ paddingInlineStart: `${TIMELINE_NODE + NODE_GUTTER}px`,
+ fontSize: '14px',
+ lineHeight: 1.65,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
+ meta: {
+ flex: 'none',
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
/** The timestamp doubles as the permalink: quiet until you reach for it. */
- timeLink: css`
- cursor: pointer;
-
- padding: 0;
- border: none;
-
- background: none;
-
- transition: color ${cssVar.motionDurationFast};
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
- panelBody: css`
- padding-block-start: 6px;
-
- font-size: 13px;
- line-height: 1.65;
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
+ timeLink: {
+ cursor: 'pointer',
+ padding: 0,
+ borderStyle: 'none',
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ textDecoration: { 'default': null, ':hover': 'underline' },
+ transition: `color ${cssVar.motionDurationFast}`,
+ },
+ panelBody: {
+ paddingBlockStart: '6px',
+ fontSize: '13px',
+ lineHeight: 1.65,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
/**
* The actions close the note, so they hug its bottom edge. Sitting a full
* panel padding above it left a band of empty surface under them that read
* as a rendering mistake.
*/
- panelActions: css`
- margin-block-end: -4px;
- padding-block-start: 10px;
- `,
- panelReply: css`
- padding-block-start: 10px;
- `,
+ panelActions: {
+ marginBlockEnd: '-4px',
+ paddingBlockStart: '10px',
+ },
+ panelReply: {
+ paddingBlockStart: '10px',
+ },
/**
* A settled note is closed business. It folds down to one quiet line and,
* opened again, stays muted — a handled concern should never draw the eye
* harder than an open one, which a green badge did.
*/
- resolvedSummary: css`
- cursor: pointer;
-
- width: 100%;
- padding: 0;
- border: none;
-
- font-size: 13px;
- color: ${cssVar.colorTextTertiary};
- text-align: start;
-
- background: none;
-
- &:hover {
- color: ${cssVar.colorTextSecondary};
- }
- `,
- resolvedThread: css`
- color: ${cssVar.colorTextTertiary};
- `,
+ resolvedSummary: {
+ cursor: 'pointer',
+ width: '100%',
+ padding: 0,
+ borderStyle: 'none',
+ fontSize: '13px',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorTextSecondary },
+ textAlign: 'start',
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ },
+ resolvedThread: {
+ color: cssVar.colorTextTertiary,
+ },
/**
* A name is never a wrap point. In the narrow floating note the header ran
* out of room and broke a two-character name down the middle of the circle.
*/
- authorName: css`
- overflow: hidden;
- flex: none;
-
- max-width: 180px;
-
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
+ authorName: {
+ overflow: 'hidden',
+ flex: 'none',
+ maxWidth: '180px',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
/**
* A headline is a sentence, not a name: it may wrap, and it must never be
* cut at the name cap — "Acceptance Builder 提交了…" says nothing.
*/
- headline: css`
- min-width: 0;
- `,
+ headline: {
+ minWidth: 0,
+ },
/** Pushed to the end of its line, so the header above may wrap freely. */
- rowActions: css`
- flex: none;
- margin-inline-start: auto;
- opacity: 0;
- transition: opacity ${cssVar.motionDurationFast};
-
- @media (hover: none) {
- opacity: 1;
- }
- `,
- nodelessEntry: css`
- padding-inline-start: ${TIMELINE_NODE + NODE_GUTTER}px;
- `,
- timelineEntry: css`
- position: relative;
- padding-block: ${ENTRY_GAP}px;
-
- &:hover [data-comment-actions] {
- opacity: 1;
- }
- `,
- timelineNode: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: ${TIMELINE_NODE}px;
- height: ${TIMELINE_NODE}px;
-
- line-height: 0;
- `,
-}));
+ rowActions: {
+ flex: 'none',
+ marginInlineStart: 'auto',
+ opacity: {
+ 'default': 0,
+ '@media (hover: none)': 1,
+ [stylex.when.ancestor(':hover', timelineEntryMarker)]: 1,
+ },
+ transition: `opacity ${cssVar.motionDurationFast}`,
+ },
+ nodelessEntry: {
+ paddingInlineStart: `${TIMELINE_NODE + NODE_GUTTER}px`,
+ },
+ timelineEntry: {
+ position: 'relative',
+ paddingBlock: `${ENTRY_GAP}px`,
+ },
+ timelineNode: {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: `${TIMELINE_NODE}px`,
+ height: `${TIMELINE_NODE}px`,
+ lineHeight: 0,
+ },
+});
diff --git a/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx b/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx
index aa70f184ce6..857e3dee767 100644
--- a/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx
+++ b/src/features/Acceptance/Viewer/Conversation/AcceptanceOriginTopic.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createStaticStyles, cssVar, cx, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { MessagesSquare } from 'lucide-react';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,24 +11,18 @@ import { useAcceptanceScope } from '../AcceptanceScope';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { useOriginConversation } from './originConversation';
-const styles = createStaticStyles(({ css }) => ({
- chip: css`
- cursor: pointer;
-
- padding: 0;
- border: 0;
-
- font: inherit;
- color: ${cssVar.colorTextSecondary};
-
- background: none;
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
-}));
+const styles = stylex.create({
+ chip: {
+ cursor: 'pointer',
+ padding: '0',
+ borderStyle: 'none',
+ font: 'inherit',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ textDecoration: { 'default': null, ':hover': 'underline' },
+ },
+});
const AcceptanceOriginTopic = () => {
const { t } = useTranslation('verify');
@@ -59,7 +55,7 @@ const AcceptanceOriginTopic = () => {
return (
<button
- className={cx(styles.chip)}
+ {...stylex.props(styles.chip)}
title={t('acceptance.origin.openTopic')}
type={'button'}
onClick={openTopic}
diff --git a/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx
index ad65f31a1be..145a5611b02 100644
--- a/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/AcceptanceResources.tsx
@@ -1,15 +1,8 @@
'use client';
-import {
- createStaticStyles,
- cssVar,
- Empty,
- Flexbox,
- Icon,
- Image,
- Text,
- useResponsive,
-} from '@lobehub/ui';
+import { Empty, Flexbox, Icon, Image, Text, useResponsive } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import dayjs from 'dayjs';
import { FileText, Film, Paperclip, SquareTerminal } from 'lucide-react';
import { useTranslation } from 'react-i18next';
@@ -21,59 +14,31 @@ import { checksForTurn } from '../turnChecks';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { useAcceptanceTurn } from '../useAcceptanceTurn';
-const styles = createStaticStyles(({ css }) => ({
- /**
- * Masonry by explicit column assignment, not CSS `column-count`.
- *
- * The native version balances columns ONCE, during layout — and evidence
- * images arrive after it, so every tile had already piled into the first
- * column and stayed there. Reserving each tile's aspect ratio did not help:
- * the balancing pass happens before the ratios matter. Dealing the tiles out
- * ourselves is deterministic and independent of when the bytes land.
- */
- column: css`
- display: flex;
- flex: 1;
- flex-direction: column;
- gap: 12px;
-
- min-inline-size: 0;
- `,
- grid: css`
- display: flex;
- gap: 12px;
- align-items: flex-start;
- `,
- item: css`
- cursor: pointer;
-
- overflow: hidden;
-
- inline-size: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
-
- &:hover {
- border-color: ${cssVar.colorBorder};
- }
- `,
- meta: css`
- padding-block: 8px;
- padding-inline: 10px;
- `,
- nonVisual: css`
- display: flex;
- gap: 8px;
- align-items: center;
-
- padding-block: 18px;
- padding-inline: 12px;
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+const styles = stylex.create({
+ column: { display: 'flex', flex: '1', flexDirection: 'column', gap: '12px', minInlineSize: '0' },
+ grid: { display: 'flex', gap: '12px', alignItems: 'flex-start' },
+ item: {
+ cursor: 'pointer',
+ overflow: 'hidden',
+ inlineSize: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgContainer,
+ backgroundImage: 'none',
+ },
+ meta: { paddingBlock: '8px', paddingInline: '10px' },
+ nonVisual: {
+ display: 'flex',
+ gap: '8px',
+ alignItems: 'center',
+ paddingBlock: '18px',
+ paddingInline: '12px',
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+});
const isVisual = (type: string) => type === 'screenshot' || type === 'gif';
@@ -123,9 +88,9 @@ const AcceptanceResources = () => {
items.forEach((entry, index) => columns[index % columnCount]!.push(entry));
return (
- <div className={styles.grid}>
+ <div {...stylex.props(styles.grid)}>
{columns.map((column, columnIndex) => (
- <div className={styles.column} key={columnIndex}>
+ <div {...stylex.props(styles.column)} key={columnIndex}>
{column.map(({ check, evidence }) => {
const href = evidence.fileUrl ?? undefined;
const name = evidence.fileName ?? evidence.description ?? check;
@@ -137,7 +102,7 @@ const AcceptanceResources = () => {
return (
<div
- className={styles.item}
+ {...stylex.props(styles.item)}
key={evidence.id}
onClick={href ? () => window.open(href, '_blank', 'noreferrer') : undefined}
>
@@ -164,7 +129,7 @@ const AcceptanceResources = () => {
/>
</div>
) : (
- <div className={styles.nonVisual}>
+ <div {...stylex.props(styles.nonVisual)}>
<Icon
size={16}
style={{ color: cssVar.colorTextTertiary }}
@@ -181,7 +146,7 @@ const AcceptanceResources = () => {
</Text>
</div>
)}
- <Flexbox className={styles.meta} gap={2}>
+ <Flexbox className={stylex.props(styles.meta).className} gap={2}>
<Text ellipsis fontSize={12}>
{name}
</Text>
diff --git a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx b/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
index 0866c6fd760..46d16655e83 100644
--- a/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Annotation.tsx
@@ -1,10 +1,14 @@
'use client';
import type { AcceptanceReviewAnnotation } from '@lobechat/types';
-import { createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Trash2 } from 'lucide-react';
import { memo } from 'react';
+import { sx } from '@/styles/sx';
+
import type { EvidenceOverlay } from './overlay';
import { useAnnotationGesture } from './useAnnotationGesture';
@@ -18,125 +22,105 @@ import { useAnnotationGesture } from './useAnnotationGesture';
type Rect = AcceptanceReviewAnnotation['rect'];
-const styles = createStaticStyles(({ css }) => ({
- badge: css`
- position: absolute;
- inset-block-start: -9px;
- inset-inline-start: -9px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 18px;
- height: 18px;
- border-radius: 50%;
-
- font-size: 11px;
- font-weight: 600;
- line-height: 1;
- color: ${cssVar.colorTextLightSolid};
-
- background: ${cssVar.colorError};
- `,
- /* Delete mirrors the index badge on the opposite corner — the same pink
- disc, so which region the action removes reads at a glance. Touch keeps
- it: a phone reviewer who mis-drags a box has no keyboard escape, and the
- only other way out used to be leaving the image entirely. */
- badgeDelete: css`
- cursor: pointer;
-
- position: absolute;
- inset-block-start: -9px;
- inset-inline-end: -9px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 18px;
- height: 18px;
- border: none;
- border-radius: 50%;
-
- color: ${cssVar.colorTextLightSolid};
-
- background: ${cssVar.colorError};
-
- &:hover {
- filter: brightness(1.15);
- }
-
- @media (pointer: coarse) {
- inset-block-start: -12px;
- inset-inline-end: -12px;
- width: 24px;
- height: 24px;
- }
- `,
- canvas: css`
- cursor: crosshair;
- user-select: none;
- `,
- /* Drawn regions are draggable as a whole; the corner handle resizes. */
- editableRect: css`
- pointer-events: auto;
- cursor: move;
- `,
- frame: css`
- position: relative;
-
- overflow: hidden;
- display: inline-block;
-
- /* Shrink-wrap the image exactly — a stretched frame skews every rect. */
- align-self: flex-start;
-
- width: fit-content;
- max-width: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- image: css`
- display: block;
- max-width: 100%;
- `,
- rect: css`
- position: absolute;
- border: 2px solid ${cssVar.colorError};
- border-radius: 4px;
-
- /*
- * Two rings instead of one: the dark outside separates the box from a white
- * screenshot, the light inside separates it from a dark one. The evidence
- * image can be either, and neither the hue nor the reader's theme can tell
- * us which — so the box carries its own contrast.
- */
- box-shadow:
- 0 0 0 1px rgb(0 0 0 / 45%),
- inset 0 0 0 1px rgb(255 255 255 / 45%);
- `,
- resizeHandle: css`
- cursor: nwse-resize;
-
- position: absolute;
- inset-block-end: -6px;
- inset-inline-end: -6px;
-
- width: 12px;
- height: 12px;
- border: 2px solid ${cssVar.colorError};
- border-radius: 50%;
-
- background: ${cssVar.colorBgContainer};
-
- &::after {
- content: '';
- position: absolute;
- inset: -16px;
- }
- `,
-}));
+const coarse = '@media (pointer: coarse)';
+
+const styles = stylex.create({
+ badge: {
+ position: 'absolute',
+ insetBlockStart: '-9px',
+ insetInlineStart: '-9px',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '18px',
+ height: '18px',
+ borderRadius: '50%',
+ fontSize: '11px',
+ fontWeight: 600,
+ lineHeight: 1,
+ color: cssVar.colorTextLightSolid,
+ backgroundColor: cssVar.colorError,
+ },
+ // Delete mirrors the index badge on the opposite corner — the same pink
+ // disc, so which region the action removes reads at a glance. Touch keeps
+ // it: a phone reviewer who mis-drags a box has no keyboard escape, and the
+ // only other way out used to be leaving the image entirely.
+ badgeDelete: {
+ cursor: 'pointer',
+ position: 'absolute',
+ insetBlockStart: { default: '-9px', [coarse]: '-12px' },
+ insetInlineEnd: { default: '-9px', [coarse]: '-12px' },
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: { default: '18px', [coarse]: '24px' },
+ height: { default: '18px', [coarse]: '24px' },
+ borderStyle: 'none',
+ borderRadius: '50%',
+ color: cssVar.colorTextLightSolid,
+ backgroundColor: cssVar.colorError,
+ filter: { 'default': null, ':hover': 'brightness(1.15)' },
+ },
+ canvas: {
+ cursor: 'crosshair',
+ userSelect: 'none',
+ },
+ // Drawn regions are draggable as a whole; the corner handle resizes.
+ editableRect: {
+ pointerEvents: 'auto',
+ cursor: 'move',
+ },
+ frame: {
+ position: 'relative',
+ overflow: 'hidden',
+ display: 'inline-block',
+ // Shrink-wrap the image exactly — a stretched frame skews every rect.
+ alignSelf: 'flex-start',
+ width: 'fit-content',
+ maxWidth: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ image: {
+ display: 'block',
+ maxWidth: '100%',
+ },
+ rect: {
+ position: 'absolute',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorError,
+ borderRadius: '4px',
+ // Two rings instead of one: the dark outside separates the box from a white
+ // screenshot, the light inside separates it from a dark one. The evidence
+ // image can be either, and neither the hue nor the reader's theme can tell
+ // us which — so the box carries its own contrast.
+ boxShadow: '0 0 0 1px rgb(0 0 0 / 45%), inset 0 0 0 1px rgb(255 255 255 / 45%)',
+ },
+ resizeHandle: {
+ 'cursor': 'nwse-resize',
+ 'position': 'absolute',
+ 'insetBlockEnd': '-6px',
+ 'insetInlineEnd': '-6px',
+ 'width': '12px',
+ 'height': '12px',
+ 'borderWidth': '2px',
+ 'borderStyle': 'solid',
+ 'borderColor': cssVar.colorError,
+ 'borderRadius': '50%',
+ 'backgroundColor': cssVar.colorBgContainer,
+ '::after': {
+ content: '""',
+ position: 'absolute',
+ insetBlockStart: '-16px',
+ insetBlockEnd: '-16px',
+ insetInlineStart: '-16px',
+ insetInlineEnd: '-16px',
+ },
+ },
+});
const rectStyle = (rect: Rect) => ({
height: `${rect.height * 100}%`,
@@ -169,21 +153,21 @@ export const AnnotatedImage = memo<AnnotatedImageProps>(
return (
<Flexbox gap={6} style={{ maxWidth: '100%', width: 'fit-content' }}>
- <div className={styles.frame}>
- <img alt={''} className={styles.image} src={src} style={imageStyle} onLoad={onLoad} />
+ <div {...stylex.props(styles.frame)}>
+ <img alt={''} src={src} onLoad={onLoad} {...sx(styles.image, imageStyle)} />
{annotations.map((annotation, index) => (
<div
- className={styles.rect}
key={index}
- style={{
+ {...sx(styles.rect, {
...rectStyle(annotation.rect),
borderColor: annotation.color ?? cssVar.colorError,
- }}
+ })}
>
{numbered && (
<span
- className={styles.badge}
- style={{ background: annotation.color ?? cssVar.colorError }}
+ {...sx(styles.badge, {
+ background: annotation.color ?? cssVar.colorError,
+ })}
>
{annotation.label ?? index + 1}
</span>
@@ -247,37 +231,37 @@ export const AnnotationCanvas = memo<AnnotationCanvasProps>(
return (
<div
- className={`${styles.frame} ${styles.canvas}`}
- // With an explicit zoomed width the frame must OUTGROW its host —
- // capping at 100% would clip the image instead of letting the host
- // viewport scroll/pan over it.
- style={{
+ {...handlers}
+ {...sx(styles.frame, styles.canvas, {
+ // With an explicit zoomed width the frame must OUTGROW its host —
+ // capping at 100% would clip the image instead of letting the host
+ // viewport scroll/pan over it.
maxWidth: imageWidth ? 'none' : undefined,
touchAction: drawing ? 'none' : 'pan-x pan-y',
cursor: drawing ? 'crosshair' : 'auto',
- }}
- {...handlers}
+ })}
>
<img
alt={''}
- className={styles.image}
draggable={false}
ref={imageRef}
src={src}
// Zoomed width comes from the host (viewport × zoom); the frame
// shrink-wraps the image, so overlays track exactly.
- style={imageWidth ? { maxWidth: 'none', width: imageWidth } : undefined}
+ {...sx(styles.image, imageWidth ? { maxWidth: 'none', width: imageWidth } : undefined)}
/>
{annotations.map((annotation, index) => (
<div
- className={`${styles.rect} ${styles.editableRect}`}
key={index}
- style={{ ...rectStyle(annotation.rect), pointerEvents: drawing ? 'auto' : 'none' }}
+ {...sx(styles.rect, styles.editableRect, {
+ ...rectStyle(annotation.rect),
+ pointerEvents: drawing ? 'auto' : 'none',
+ })}
onPointerDown={(event) => startEdit(event, index, annotation.rect, 'move')}
>
- <span className={styles.badge}>{index + 1}</span>
+ <span {...stylex.props(styles.badge)}>{index + 1}</span>
<button
- className={styles.badgeDelete}
+ {...stylex.props(styles.badgeDelete)}
type={'button'}
onPointerDown={(event) => event.stopPropagation()}
onClick={(event) => {
@@ -288,12 +272,12 @@ export const AnnotationCanvas = memo<AnnotationCanvasProps>(
<Icon icon={Trash2} size={11} />
</button>
<span
- className={styles.resizeHandle}
+ {...stylex.props(styles.resizeHandle)}
onPointerDown={(event) => startEdit(event, index, annotation.rect, 'resize')}
/>
</div>
))}
- {draft && <div className={styles.rect} style={rectStyle(draft)} />}
+ {draft && <div {...sx(styles.rect, rectStyle(draft))} />}
</div>
);
},
diff --git a/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx
index 00f5dec448b..8723b69a2d0 100644
--- a/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/DesktopEvidenceReview.tsx
@@ -1,20 +1,14 @@
'use client';
-import {
- ActionIcon,
- Button,
- createStaticStyles,
- cssVar,
- cx,
- Flexbox,
- Icon,
- Text,
- TextArea,
-} from '@lobehub/ui';
+import { ActionIcon, Button, Flexbox, Icon, Text, TextArea } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Film, ZoomIn, ZoomOut } from 'lucide-react';
import { memo, useRef } from 'react';
import { useTranslation } from 'react-i18next';
+import { sx } from '@/styles/sx';
+
import { ZOOM_STEPS } from '../Review/rejectDraft';
import type { RejectReviewModel } from '../Review/useRejectReview';
import { AttachmentStrip, AttachmentUploadButton } from './attachments';
@@ -24,98 +18,95 @@ import { VideoNotes } from './Video/VideoNotes';
import type { VideoReviewStageHandle } from './Video/VideoReviewStage';
import { VideoReviewStage } from './Video/VideoReviewStage';
-const styles = createStaticStyles(({ css }) => ({
- body: css`
- overflow: hidden;
- display: flex;
- flex: 1;
- flex-direction: column;
-
- min-height: 0;
- `,
- footer: css`
- flex: none;
- padding-block-start: 12px;
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
- `,
- /** Stage and notes side by side — the pointer that circles a region is the
- same one that types about it, so neither should scroll the other away. */
- stageRow: css`
- display: flex;
- flex: 1;
- gap: 16px;
- min-height: 0;
- `,
- notes: css`
- overflow-y: auto;
- display: flex;
- flex: none;
- flex-direction: column;
- gap: 12px;
-
- width: 320px;
- min-width: 0;
- `,
- thumb: css`
- cursor: pointer;
-
- overflow: hidden;
-
- width: 72px;
- height: 48px;
- border: 2px solid transparent;
- border-radius: ${cssVar.borderRadius};
-
- img {
- display: block;
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- `,
- /** A video has no poster to thumbnail without decoding it — an icon tile says what it is. */
- videoThumb: css`
- display: flex;
- align-items: center;
- justify-content: center;
-
- color: #fff;
-
- background: #000;
- `,
- thumbActive: css`
- border-color: ${cssVar.colorPrimary};
- `,
- /** The zoom pill floats bottom-center over the stage — controls live with
- the thing they control, not in a detached toolbar row. */
- zoomBar: css`
- position: absolute;
- z-index: 5;
- inset-block-end: 16px;
- inset-inline-start: 50%;
- transform: translateX(-50%);
-
- display: flex;
- gap: 4px;
- align-items: center;
-
- padding-block: 4px;
- padding-inline: 8px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 99px;
-
- background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowSecondary};
- `,
- zoomLabel: css`
- min-width: 44px;
-
- font-size: 12px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextSecondary};
- text-align: center;
- `,
-}));
+const styles = stylex.create({
+ body: {
+ overflow: 'hidden',
+ display: 'flex',
+ flex: '1',
+ flexDirection: 'column',
+ minHeight: 0,
+ },
+ footer: {
+ flex: 'none',
+ paddingBlockStart: '12px',
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+ // Stage and notes side by side — the pointer that circles a region is the
+ // same one that types about it, so neither should scroll the other away.
+ stageRow: {
+ display: 'flex',
+ flex: '1',
+ gap: '16px',
+ minHeight: 0,
+ },
+ notes: {
+ overflowY: 'auto',
+ display: 'flex',
+ flex: 'none',
+ flexDirection: 'column',
+ gap: '12px',
+ width: '320px',
+ minWidth: 0,
+ },
+ thumb: {
+ cursor: 'pointer',
+ overflow: 'hidden',
+ width: '72px',
+ height: '48px',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: 'transparent',
+ borderRadius: cssVar.borderRadius,
+ },
+ thumbImage: {
+ display: 'block',
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover',
+ },
+ // A video has no poster to thumbnail without decoding it — an icon tile says what it is.
+ videoThumb: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ color: '#fff',
+ backgroundColor: '#000',
+ backgroundImage: 'none',
+ },
+ thumbActive: {
+ borderColor: cssVar.colorPrimary,
+ },
+ // The zoom pill floats bottom-center over the stage — controls live with
+ // the thing they control, not in a detached toolbar row.
+ zoomBar: {
+ position: 'absolute',
+ zIndex: 5,
+ insetBlockEnd: '16px',
+ insetInlineStart: '50%',
+ transform: 'translateX(-50%)',
+ display: 'flex',
+ gap: '4px',
+ alignItems: 'center',
+ paddingBlock: '4px',
+ paddingInline: '8px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: '99px',
+ backgroundColor: cssVar.colorBgElevated,
+ backgroundImage: 'none',
+ boxShadow: cssVar.boxShadowSecondary,
+ },
+ zoomLabel: {
+ minWidth: '44px',
+ fontSize: '12px',
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorTextSecondary,
+ textAlign: 'center',
+ },
+});
interface DesktopEvidenceReviewProps {
model: RejectReviewModel;
@@ -147,7 +138,7 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
const isVideo = activeEvidence?.type === 'video';
return (
- <div className={styles.body}>
+ <div {...stylex.props(styles.body)}>
{activeEvidence && (
<Flexbox flex={1} gap={12} style={{ minHeight: 0 }}>
<Flexbox gap={12} height={'100%'} style={{ minHeight: 0 }}>
@@ -157,30 +148,28 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
<button
aria-pressed={item.id === activeEvidence.id}
key={item.id}
- style={{ flexShrink: 0 }}
type={'button'}
aria-label={t('acceptance.review.imageNumber', {
current: index + 1,
total: evidence.length,
})}
- className={cx(
- styles.thumb,
- item.id === activeEvidence.id && styles.thumbActive,
- )}
+ {...sx(styles.thumb, item.id === activeEvidence.id && styles.thumbActive, {
+ flexShrink: 0,
+ })}
onClick={() => model.selectEvidence(index)}
>
{item.type === 'video' ? (
- <span className={styles.videoThumb} style={{ height: '100%' }}>
+ <span {...sx(styles.videoThumb, { height: '100%' })}>
<Icon icon={Film} size={18} />
</span>
) : (
- <img alt={''} src={item.fileUrl} />
+ <img alt={''} src={item.fileUrl} {...stylex.props(styles.thumbImage)} />
)}
</button>
))}
</Flexbox>
)}
- <div className={styles.stageRow} style={{ position: 'relative' }}>
+ <div {...sx(styles.stageRow, { position: 'relative' })}>
{isVideo ? (
<VideoReviewStage
chapters={activeEvidence.chapters ?? []}
@@ -208,7 +197,7 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
/>
)}
{!isVideo && (
- <div className={styles.zoomBar}>
+ <div {...stylex.props(styles.zoomBar)}>
<ActionIcon
disabled={zoom <= ZOOM_STEPS[0]}
icon={ZoomOut}
@@ -216,7 +205,7 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
title={t('acceptance.review.zoomOut')}
onClick={() => model.stepZoom(-1)}
/>
- <span className={styles.zoomLabel}>{Math.round(zoom * 100)}%</span>
+ <span {...stylex.props(styles.zoomLabel)}>{Math.round(zoom * 100)}%</span>
<ActionIcon
disabled={zoom >= ZOOM_STEPS.at(-1)!}
icon={ZoomIn}
@@ -226,7 +215,7 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
/>
</div>
)}
- <div className={styles.notes}>
+ <div {...stylex.props(styles.notes)}>
<Flexbox gap={2}>
<Text strong fontSize={13}>
{t('acceptance.review.regionComments')}
@@ -264,7 +253,7 @@ export const DesktopEvidenceReview = memo<DesktopEvidenceReviewProps>(({ model }
</Flexbox>
</Flexbox>
)}
- <div className={styles.footer}>
+ <div {...stylex.props(styles.footer)}>
{failed && (
<Text role={'alert'} type={'danger'}>
{t('acceptance.review.submitFailed')}
diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx
index ab3d3a587ef..d951be0733e 100644
--- a/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceList.tsx
@@ -3,9 +3,11 @@
import { readEvidenceChapters } from '@lobechat/const/verify';
import type { AcceptanceReviewAnnotation } from '@lobechat/types';
import { Flexbox, Image, useResponsive } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { memo, type ReactNode } from 'react';
import AudioPlayer from '@/features/AudioPlayer';
+import { sx } from '@/styles/sx';
import {
comparisonMedia,
@@ -23,8 +25,9 @@ import { TerminalEvidenceCard } from '../../Report/TerminalEvidence';
import type { AcceptanceEvidence } from '../Checks/types';
import { AnnotatedImage } from '../Evidence/Annotation';
import { ScreenshotTiles } from '../Evidence/ScreenshotTiles';
+import { floatingActionHostMarker } from '../markers.stylex';
import { IMAGE_EVIDENCE, imageRatio, isAnnotatable, isVisual } from './evidence';
-import FloatingCommentAction, { FLOATING_ACTION_HOST } from './FloatingCommentAction';
+import FloatingCommentAction from './FloatingCommentAction';
import type { EvidenceOverlayMap } from './overlay';
import { styles } from './styles';
import { VideoEvidenceDiscussion } from './Video/VideoEvidenceDiscussion';
@@ -65,7 +68,7 @@ const comparisonContent = (item: AcceptanceEvidence, action?: ReactNode, video?:
);
if (!action) return image;
return (
- <div style={{ position: 'relative' }} {...{ [FLOATING_ACTION_HOST]: '' }}>
+ <div {...sx(floatingActionHostMarker, { position: 'relative' })}>
{image}
{action}
</div>
@@ -166,7 +169,7 @@ export const EvidenceList = memo<{
}
const description = meaningfulEvidenceCaption(item.description);
- const caption = description && <span className={styles.caption}>{description}</span>;
+ const caption = description && <span {...stylex.props(styles.caption)}>{description}</span>;
if (item.fileUrl && item.type === 'video')
return <div key={item.id}>{videoContent(item, caption)}</div>;
if (item.fileUrl && item.type === 'audio')
@@ -200,8 +203,10 @@ export const EvidenceList = memo<{
return (
<div
key={item.id}
- style={{ position: 'relative', width: '100%' }}
- {...(action ? { [FLOATING_ACTION_HOST]: '' } : {})}
+ {...sx(action && floatingActionHostMarker, {
+ position: 'relative',
+ width: '100%',
+ })}
>
<button
type={'button'}
@@ -268,7 +273,7 @@ export const EvidenceList = memo<{
src={shot.fileUrl!}
caption={
shotCaption ? (
- <span className={styles.caption}>{shotCaption}</span>
+ <span {...stylex.props(styles.caption)}>{shotCaption}</span>
) : undefined
}
/>
@@ -283,8 +288,11 @@ export const EvidenceList = memo<{
<Flexbox
gap={4}
key={item.id}
- style={{ maxWidth: '100%', position: 'relative', width: 'fit-content' }}
- {...(action ? { [FLOATING_ACTION_HOST]: '' } : {})}
+ {...sx(action && floatingActionHostMarker, {
+ maxWidth: '100%',
+ position: 'relative',
+ width: 'fit-content',
+ })}
>
{action}
{overlay?.length ? (
@@ -300,12 +308,12 @@ export const EvidenceList = memo<{
/>
) : (
<Flexbox
- className={styles.evidenceImage}
- style={
+ {...sx(
+ styles.evidenceImage,
item.fileWidth && item.fileHeight
? { aspectRatio: imageRatio(item), maxWidth: '100%', width: item.fileWidth }
- : undefined
- }
+ : undefined,
+ )}
>
<Image
alt={item.description ?? item.fileName ?? item.type}
@@ -343,7 +351,7 @@ export const EvidenceList = memo<{
if (item.content)
return (
<Flexbox gap={4} key={item.id}>
- <div className={styles.evidenceText}>{item.content}</div>
+ <div {...stylex.props(styles.evidenceText)}>{item.content}</div>
{caption}
</Flexbox>
);
diff --git a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
index 3310671fc47..c7ee55f37d2 100644
--- a/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/EvidenceStage.tsx
@@ -1,7 +1,8 @@
'use client';
import type { AcceptanceReviewAnnotation } from '@lobechat/types';
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { memo, useEffect, useRef } from 'react';
import type { DraftAnnotation } from './Annotation';
@@ -11,29 +12,23 @@ import { usePinchZoom } from './usePinchZoom';
type Rect = AcceptanceReviewAnnotation['rect'];
-const styles = createStaticStyles(({ css }) => ({
- /** The zoom stage — its native scrolling doubles as panning. Flex plus the
- inner frame's `margin: auto` keeps the image centered when it fits, and
- scrolls from the edges once it grows past it. */
- viewport: css`
- overflow: auto;
- overscroll-behavior: contain;
- display: flex;
- flex: 1;
-
- min-width: 0;
- min-height: 120px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorFillQuaternary};
- `,
- /** `margin: auto` absorbs the free space on both axes (centering) and
- collapses to 0 on overflow. */
- viewportInner: css`
- margin: auto;
- `,
-}));
+const styles = stylex.create({
+ viewport: {
+ overflow: 'auto',
+ overscrollBehavior: 'contain',
+ display: 'flex',
+ flex: '1',
+ minWidth: '0',
+ minHeight: '120px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+ viewportInner: { margin: 'auto' },
+});
const SWIPE_MIN_PX = 60;
/** A swipe has to be decisively horizontal, or vertical reading steals images. */
@@ -79,7 +74,7 @@ export const EvidenceStage = memo<EvidenceStageProps>(
return (
<div
- className={styles.viewport}
+ className={stylex.props(styles.viewport).className}
ref={ref}
// With our own pinch the browser must not zoom the page on two
// fingers; without it, leave the native gesture alone.
@@ -112,7 +107,7 @@ export const EvidenceStage = memo<EvidenceStageProps>(
canSwipe && event.touches.length === 1 ? { x: point.clientX, y: point.clientY } : null;
}}
>
- <div className={styles.viewportInner}>
+ <div {...stylex.props(styles.viewportInner)}>
<AnnotationCanvas
annotations={annotations}
drawing={drawing}
diff --git a/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx b/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx
index 1de97a77115..f8007b48348 100644
--- a/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/FloatingCommentAction.tsx
@@ -1,61 +1,53 @@
'use client';
-import { ActionIcon, createStaticStyles, cssVar } from '@lobehub/ui';
+import { ActionIcon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { MessageSquarePlus } from 'lucide-react';
import { memo } from 'react';
-/** Marks the box the action floats over; hovering it reveals the action. */
-export const FLOATING_ACTION_HOST = 'data-floating-action-host';
+import { floatingActionHostMarker } from '../markers.stylex';
-const styles = createStaticStyles(({ css }) => ({
- button: css`
- pointer-events: auto;
+const compact = '@media (width <= 767px)';
- position: sticky;
- inset-block-start: 12px;
-
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 50%;
-
- opacity: 0;
- background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowTertiary};
-
- transition: opacity ${cssVar.motionDurationMid};
-
- [${FLOATING_ACTION_HOST}]:hover &,
- &:focus-visible {
- opacity: 1;
- }
-
- /* No hover to reveal it with: a touch reader has to see it to use it. */
- @media (hover: none) {
- opacity: 1;
- }
- `,
- /**
- * Spans the whole picture so the button can stick to the top of the viewport
- * while a long screenshot scrolls past, and never leave the picture it
- * belongs to. It sits in the margin to the right of the picture, so it never
- * covers what is being commented on, and outside the comment pins that
- * straddle the right edge. Still a child of the host, so moving the pointer
- * onto it keeps it revealed.
- */
- rail: css`
- pointer-events: none;
-
- position: absolute;
- z-index: 5;
- inset-block: 0;
- inset-inline-end: -40px;
-
- /* A phone column has no margin to spare: tuck it inside the picture. */
- @media (width <= 767px) {
- inset-block: 8px;
- inset-inline-end: 8px;
- }
- `,
-}));
+const styles = stylex.create({
+ button: {
+ pointerEvents: 'auto',
+ position: 'sticky',
+ insetBlockStart: '12px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: '50%',
+ // Revealed by hovering the host box (a marker, see markers.stylex.ts), or
+ // on focus. With no hover to reveal it, a touch reader has to see it to use it.
+ opacity: {
+ 'default': 0,
+ ':focus-visible': 1,
+ '@media (hover: none)': 1,
+ [stylex.when.ancestor(':hover', floatingActionHostMarker)]: 1,
+ },
+ backgroundColor: cssVar.colorBgElevated,
+ backgroundImage: 'none',
+ boxShadow: cssVar.boxShadowTertiary,
+ transition: `opacity ${cssVar.motionDurationMid}`,
+ },
+ // Spans the whole picture so the button can stick to the top of the viewport
+ // while a long screenshot scrolls past, and never leave the picture it
+ // belongs to. It sits in the margin to the right of the picture, so it never
+ // covers what is being commented on, and outside the comment pins that
+ // straddle the right edge. Still a child of the host, so moving the pointer
+ // onto it keeps it revealed.
+ rail: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ zIndex: 5,
+ // A phone column has no margin to spare: tuck it inside the picture.
+ insetBlockStart: { default: 0, [compact]: '8px' },
+ insetBlockEnd: { default: 0, [compact]: '8px' },
+ insetInlineEnd: { default: '-40px', [compact]: '8px' },
+ },
+});
/**
* Comment on this picture without leaving it. The check's own comment and
@@ -63,17 +55,17 @@ const styles = createStaticStyles(({ css }) => ({
* screenshots the reviewer scrolled past everything they were looking at to
* reach them — and then had to pick the picture again in the modal.
*
- * Render inside a positioned box carrying {@link FLOATING_ACTION_HOST}.
+ * Render inside a positioned box carrying {@link floatingActionHostMarker}.
*/
const FloatingCommentAction = memo<{ onClick: () => void; title: string }>(({ onClick, title }) => {
return (
- <div className={styles.rail}>
+ <div {...stylex.props(styles.rail)}>
<ActionIcon
aria-label={title}
- className={styles.button}
icon={MessageSquarePlus}
size={'small'}
title={title}
+ {...stylex.props(styles.button)}
onClick={(event) => {
event.stopPropagation();
onClick();
diff --git a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
index ae5e4716480..545ea121a1c 100644
--- a/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/MobileEvidenceReview.tsx
@@ -1,6 +1,8 @@
'use client';
-import { ActionIcon, Button, createStaticStyles, cssVar, Text, TextArea } from '@lobehub/ui';
+import { ActionIcon, Button, Text, TextArea } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronLeft, ChevronRight, NotebookPen, PencilLine, ZoomIn, ZoomOut } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -11,93 +13,88 @@ import { AttachmentStrip, AttachmentUploadButton } from './attachments';
import { EvidenceStage } from './EvidenceStage';
import { MobileRegionNotes } from './RegionNotes';
-const styles = createStaticStyles(({ css }) => ({
- body: css`
- display: flex;
- flex: 1;
- flex-direction: column;
-
- min-width: 0;
- min-height: 0;
- `,
- /** The one scroll on the page — image on top, the notes it earns below it. */
- scroll: css`
- overflow-y: auto;
- overscroll-behavior: contain;
- display: flex;
- flex: 1;
- flex-direction: column;
- gap: 8px;
-
- min-height: 0;
- padding-block-end: 12px;
- `,
- /** The image is what the reviewer came to look at, so it takes every pixel
- the rows below it do not need. When the notes open underneath, it yields
- down to a floor that still leaves room to circle on, then the page scrolls. */
- stage: css`
- display: flex;
- flex: 1 1 auto;
- min-height: 40dvh;
- `,
- /** One full-width control under the image: the image arrows at the two
- edges where a thumb lands, the zoom (minus, percentage, plus) between
- them. Two fingers set the zoom too; the buttons show where it landed. */
- switcher: css`
- display: flex;
- flex: none;
- align-items: center;
-
- width: 100%;
- min-height: 44px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
- `,
- zoom: css`
- display: flex;
- flex: 1;
- gap: 4px;
- align-items: center;
- justify-content: center;
- `,
- /** Two equal thumb-sized buttons: what to do next with the image, and where
- the written note goes. */
- actions: css`
- display: flex;
- flex: none;
- gap: 8px;
-
- > button {
- flex: 1;
- min-height: 44px;
- }
- `,
- editor: css`
- display: flex;
- flex: none;
- flex-direction: column;
- gap: 16px;
-
- padding-block-start: 4px;
-
- textarea {
- font-size: 16px;
- }
- `,
- footer: css`
- display: flex;
- flex: none;
- flex-direction: column;
- gap: 8px;
-
- padding-block-start: 8px;
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
-
- > button {
- min-height: 44px;
- }
- `,
-}));
+const styles = stylex.create({
+ body: {
+ display: 'flex',
+ flex: '1',
+ flexDirection: 'column',
+ minWidth: 0,
+ minHeight: 0,
+ },
+ // The one scroll on the page — image on top, the notes it earns below it.
+ scroll: {
+ overflowY: 'auto',
+ overscrollBehavior: 'contain',
+ display: 'flex',
+ flex: '1',
+ flexDirection: 'column',
+ gap: '8px',
+ minHeight: 0,
+ paddingBlockEnd: '12px',
+ },
+ // The image is what the reviewer came to look at, so it takes every pixel
+ // the rows below it do not need. When the notes open underneath, it yields
+ // down to a floor that still leaves room to circle on, then the page scrolls.
+ stage: {
+ display: 'flex',
+ flexGrow: '1',
+ flexShrink: '1',
+ flexBasis: 'auto',
+ minHeight: '40dvh',
+ },
+ // One full-width control under the image: the image arrows at the two
+ // edges where a thumb lands, the zoom (minus, percentage, plus) between
+ // them. Two fingers set the zoom too; the buttons show where it landed.
+ switcher: {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ width: '100%',
+ minHeight: '44px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ },
+ zoom: {
+ display: 'flex',
+ flex: '1',
+ gap: '4px',
+ alignItems: 'center',
+ justifyContent: 'center',
+ },
+ // Two equal thumb-sized buttons: what to do next with the image, and where
+ // the written note goes.
+ actions: {
+ display: 'flex',
+ flex: 'none',
+ gap: '8px',
+ },
+ actionButton: {
+ flex: '1',
+ minHeight: '44px',
+ },
+ editor: {
+ display: 'flex',
+ flex: 'none',
+ flexDirection: 'column',
+ gap: '16px',
+ paddingBlockStart: '4px',
+ },
+ footer: {
+ display: 'flex',
+ flex: 'none',
+ flexDirection: 'column',
+ gap: '8px',
+ paddingBlockStart: '8px',
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+ footerButton: {
+ minHeight: '44px',
+ },
+});
/**
* Phone review on one page: look at the image, circle what is wrong, and write
@@ -162,11 +159,11 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
);
return (
- <div className={styles.body}>
- <div className={styles.scroll}>
+ <div {...stylex.props(styles.body)}>
+ <div {...stylex.props(styles.scroll)}>
{activeEvidence && (
<>
- <div className={styles.stage}>
+ <div {...stylex.props(styles.stage)}>
<EvidenceStage
touch
annotations={activeAnnotations}
@@ -184,7 +181,7 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
edges, the zoom in the middle. No hint text — the phone shows,
it does not explain. The percentage is what a pinch landed on;
the buttons step from there to the next notch. */}
- <div className={styles.switcher}>
+ <div {...stylex.props(styles.switcher)}>
<ActionIcon
aria-label={t('acceptance.review.previousImage')}
disabled={activeIndex <= 0}
@@ -192,7 +189,7 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
size={{ blockSize: 44, size: 20 }}
onClick={() => model.selectEvidence(activeIndex - 1)}
/>
- <div className={styles.zoom}>
+ <div {...stylex.props(styles.zoom)}>
<ActionIcon
aria-label={t('acceptance.review.zoomOut')}
disabled={zoom <= ZOOM_STEPS[0]}
@@ -228,22 +225,27 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
{drawing ? (
// Marking mode: the circled comments are the whole story below the
// image — each new box lands here, ready for its note.
- <div className={styles.editor}>{regionNotes}</div>
+ <div {...stylex.props(styles.editor)}>{regionNotes}</div>
) : (
<>
{/* Two buttons side by side: one enters marking mode, the other
discloses the written note below. The open state is a light
fill, not the primary slab — it marks which panel is open, it
is not the page's action. */}
- <div className={styles.actions}>
+ <div {...stylex.props(styles.actions)}>
{activeEvidence && (
- <Button icon={PencilLine} onClick={() => model.advance('toggle-draw')}>
+ <Button
+ icon={PencilLine}
+ {...stylex.props(styles.actionButton)}
+ onClick={() => model.advance('toggle-draw')}
+ >
{t('acceptance.review.drawRegion')}
</Button>
)}
<Button
aria-expanded={supplementExpanded}
icon={NotebookPen}
+ {...stylex.props(styles.actionButton)}
type={supplementExpanded ? 'fill' : 'default'}
onClick={() => setSupplementExpanded((open) => !open)}
>
@@ -253,7 +255,7 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
</Button>
</div>
{(hasRegionContent || supplementExpanded) && (
- <div className={styles.editor}>
+ <div {...stylex.props(styles.editor)}>
{hasRegionContent && regionNotes}
{supplementExpanded && (
<>
@@ -284,11 +286,15 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
</>
)}
</div>
- <div className={styles.footer}>
+ <div {...stylex.props(styles.footer)}>
{drawing ? (
// Done closes marking mode; the boxes and their notes stay. The
// submit only comes back once the reviewer is out of the mode.
- <Button type={'primary'} onClick={() => model.advance('toggle-draw')}>
+ <Button
+ type={'primary'}
+ {...stylex.props(styles.footerButton)}
+ onClick={() => model.advance('toggle-draw')}
+ >
{t('acceptance.review.confirmRegions')}
</Button>
) : (
@@ -302,6 +308,7 @@ export const MobileEvidenceReview = memo<{ model: RejectReviewModel }>(({ model
disabled={!canSubmit}
loading={loading}
type={'primary'}
+ {...stylex.props(styles.footerButton)}
onClick={model.submitReject}
>
{t('acceptance.review.confirmReject')}
diff --git a/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx b/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx
index 0163b964b15..da226f3c672 100644
--- a/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/RegionNotes.tsx
@@ -1,6 +1,8 @@
'use client';
-import { ActionIcon, createStaticStyles, cssVar, Flexbox, Icon, TextArea } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon, TextArea } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Crosshair, Trash2 } from 'lucide-react';
import type { ReactNode } from 'react';
import { memo } from 'react';
@@ -8,48 +10,36 @@ import { useTranslation } from 'react-i18next';
import type { DraftAnnotationEntry, RejectableEvidence } from '../Review/rejectDraft';
-const styles = createStaticStyles(({ css }) => ({
- /** The badge that ties a note back to the numbered box on the image. */
- index: css`
- flex: none;
-
- width: 18px;
- height: 18px;
- border-radius: 50%;
-
- font-size: 11px;
- font-weight: 600;
- line-height: 18px;
- color: #fff;
- text-align: center;
-
- background: ${cssVar.colorError};
- `,
- /** The phone caption: a link back to the box on the image, not a
- button-shaped box. The tap target comes from padding around a compact
- line, so a list of regions does not become a column of 44px slabs. */
- jump: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 5px;
- align-items: center;
- align-self: flex-start;
-
- padding-block: 7px;
- padding-inline: 2px;
- border: none;
-
- font-size: 13px;
- color: ${cssVar.colorLink};
-
- background: none;
-
- &:active {
- opacity: 0.6;
- }
- `,
-}));
+const styles = stylex.create({
+ index: {
+ flex: 'none',
+ width: '18px',
+ height: '18px',
+ borderRadius: '50%',
+ fontSize: '11px',
+ fontWeight: 600,
+ lineHeight: '18px',
+ color: '#fff',
+ textAlign: 'center',
+ backgroundColor: cssVar.colorError,
+ backgroundImage: 'none',
+ },
+ jump: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '5px',
+ alignItems: 'center',
+ alignSelf: 'flex-start',
+ paddingBlock: '7px',
+ paddingInline: '2px',
+ borderStyle: 'none',
+ fontSize: '13px',
+ color: cssVar.colorLink,
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ opacity: { 'default': null, ':active': 0.6 },
+ },
+});
interface RegionNoteRowProps {
/** Focus the field on mount — a note just made is a note about to be written. */
@@ -83,6 +73,7 @@ export const RegionNoteRow = memo<RegionNoteRowProps>(
autoSize={{ maxRows: 5, minRows: 1 }}
placeholder={placeholder}
style={{ flex: 1, fontSize }}
+ styles={fontSize ? { input: { fontSize } } : undefined}
value={value}
onChange={(event) => onChange(event.target.value)}
/>
@@ -117,7 +108,7 @@ export const RegionNotes = memo<RegionNotesProps>(({ annotations, onChange, onRe
placeholder={t('acceptance.review.annotationPlaceholder', { index: index + 1 })}
value={annotation.comment}
badge={
- <span className={styles.index} style={{ marginBlockStart: 6 }}>
+ <span className={stylex.props(styles.index).className} style={{ marginBlockStart: 6 }}>
{index + 1}
</span>
}
@@ -160,7 +151,7 @@ export const MobileRegionNotes = memo<MobileRegionNotesProps>(
value={annotation.comment}
caption={
<button
- className={styles.jump}
+ {...stylex.props(styles.jump)}
type={'button'}
onClick={() => onJump(annotation.evidenceId)}
>
diff --git a/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx b/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx
index de9ba98eeaa..4272ed1b579 100644
--- a/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/ScreenshotTiles.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createStaticStyles, cssVar, cx, Flexbox, Icon, Image, Text } from '@lobehub/ui';
+import { Flexbox, Icon, Image, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Check, MessageSquare, X } from 'lucide-react';
import { memo, type ReactNode, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -8,7 +10,7 @@ import { useTranslation } from 'react-i18next';
import { comparisonMedia } from '../../Report/EvidenceComparisonCard';
import { useOptionalAcceptanceScope } from '../AcceptanceScope';
import { commentAnchorId } from '../Comments/anchor';
-import { FLOATING_ACTION_HOST } from './FloatingCommentAction';
+import { floatingActionHostMarker } from '../markers.stylex';
import { type EvidenceOverlay, overlayColor } from './overlay';
import {
annotationInSlice,
@@ -19,227 +21,125 @@ import {
} from './screenshotSlices';
import { useImageThreads } from './useImageThreads';
-const styles = createStaticStyles(({ css }) => ({
- badge: css`
- position: absolute;
- inset-block-start: -9px;
- inset-inline-start: -9px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 18px;
- height: 18px;
- border-radius: 50%;
-
- font-size: 11px;
- font-weight: 600;
- line-height: 1;
- color: ${cssVar.colorTextLightSolid};
- `,
- frame: css`
- position: relative;
-
- overflow: hidden;
- flex: none;
-
- max-width: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- frameFlat: css`
- border: none;
- border-radius: 0;
- `,
- /**
- * The clickable note slot, pinned to the region's OUTER right edge: the box
- * marks where the concern is, this marker is how you read it. Kept on the
- * right so it never covers the numbered badge on the opposite corner.
- */
- marker: css`
- pointer-events: auto;
- cursor: pointer;
-
- position: absolute;
- inset-block-start: -10px;
- inset-inline-end: -10px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- /* A circle, not a pill: the face inside is round, and a rounded rectangle
- hugging it reads as a squashed oval. Same 18px as the numbered badge on
- the opposite corner, so the two corners of one box match. */
- width: 18px;
- height: 18px;
- border: none;
- border-radius: 50%;
-
- font-size: 10px;
- font-weight: 600;
- line-height: 1;
- color: ${cssVar.colorTextLightSolid};
-
- box-shadow: ${cssVar.boxShadowTertiary};
-
- &:hover {
- filter: brightness(1.12);
- }
- `,
- markerActive: css`
- outline: 2px solid ${cssVar.colorTextLightSolid};
- `,
- /**
- * The opened note FLOATS rather than taking a column of its own: reserving
- * layout for it shoved the evidence narrower the moment anyone opened a note,
- * and closing it snapped the image back.
- *
- * Where it floats depends on the room beside the reading column. Given a wide
- * enough window it sits in the margin, clear of the screenshot — the note is
- * about the picture, so covering the picture with it is the one thing it must
- * not do. Below that it falls back to hugging the image's right edge, which
- * still beats pushing the evidence around.
- */
- note: css`
- position: absolute;
- z-index: 5;
- inset-inline-end: 12px;
-
- width: min(280px, 76%);
- padding: 12px;
-
- /* Room for the close control, so it never lands on the author's name. */
- padding-inline-end: 32px;
-
- /* No frame: an elevated surface is the whole affordance, the way Figma's
- comments read. A 1px box around content that already sits in a box is
- what made the earlier rounds look like wireframes. */
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowSecondary};
-
- /* 920px reading column + 240px note + gaps — the point where the margin
- can hold the note without the page growing a horizontal scrollbar. */
- @media (width >= 1440px) {
- inset-inline: calc(100% + 12px) auto;
- width: 240px;
- }
- `,
- /** Sits in the gutter the note reserves for it, clear of the panel's text. */
- noteClose: css`
- cursor: pointer;
-
- position: absolute;
- inset-block-start: 8px;
- inset-inline-end: 8px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 20px;
- height: 20px;
- padding: 0;
- border: none;
- border-radius: ${cssVar.borderRadius};
-
- color: ${cssVar.colorTextTertiary};
-
- background: none;
-
- transition: all ${cssVar.motionDurationFast};
-
- &:hover {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillTertiary};
- }
- `,
- noteFallbackHead: css`
- padding-block-end: 4px;
- `,
- /**
- * The collapsed pin: while a note is shut there has to be something in the
- * margin saying it exists, or the only way to find a remark is to hunt for
- * the marker on the box it points at.
- */
- pin: css`
- cursor: pointer;
-
- position: absolute;
- z-index: 4;
- inset-inline-end: -14px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 24px;
- height: 24px;
- border: none;
- border-radius: 50% 50% 50% 2px;
-
- color: ${cssVar.colorTextLightSolid};
-
- box-shadow: ${cssVar.boxShadowTertiary};
-
- &:hover {
- filter: brightness(1.12);
- }
-
- @media (width >= 1440px) {
- inset-inline: calc(100% + 12px) auto;
- }
- `,
- /** The avatar fills the pin; the pin's own colour stays visible as its rim. */
- pinFace: css`
- width: 18px;
- height: 18px;
- border-radius: 50%;
- object-fit: cover;
- `,
- pinInitial: css`
- font-size: 11px;
- font-weight: 600;
- line-height: 1;
- `,
- /** Positioning context for the floating note; the frame itself clips. */
- stage: css`
- position: relative;
- `,
- noteBody: css`
- font-size: 13px;
- line-height: 1.6;
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
- rect: css`
- pointer-events: none;
-
- position: absolute;
-
- border: 2px solid ${cssVar.colorError};
- border-radius: ${cssVar.borderRadiusXS};
-
- /*
- * Two rings instead of one: the dark outside separates the box from a white
- * screenshot, the light inside separates it from a dark one. The evidence
- * image can be either, and neither the hue nor the reader's theme can tell
- * us which — so the box carries its own contrast.
- */
- box-shadow:
- 0 0 0 1px rgb(0 0 0 / 45%),
- inset 0 0 0 1px rgb(255 255 255 / 45%);
- `,
- swatch: css`
- flex: none;
- width: 8px;
- height: 8px;
- border-radius: 50%;
- `,
-}));
+const styles = stylex.create({
+ badge: {
+ position: 'absolute',
+ insetBlockStart: '-9px',
+ insetInlineStart: '-9px',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '18px',
+ height: '18px',
+ borderRadius: '50%',
+ fontSize: '11px',
+ fontWeight: 600,
+ lineHeight: 1,
+ color: cssVar.colorTextLightSolid,
+ },
+ frame: {
+ position: 'relative',
+ overflow: 'hidden',
+ flex: 'none',
+ maxWidth: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ frameFlat: { borderStyle: 'none', borderRadius: '0' },
+ marker: {
+ pointerEvents: 'auto',
+ cursor: 'pointer',
+ position: 'absolute',
+ insetBlockStart: '-10px',
+ insetInlineEnd: '-10px',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '18px',
+ height: '18px',
+ borderStyle: 'none',
+ borderRadius: '50%',
+ fontSize: '10px',
+ fontWeight: 600,
+ lineHeight: 1,
+ color: cssVar.colorTextLightSolid,
+ boxShadow: cssVar.boxShadowTertiary,
+ filter: { 'default': null, ':hover': 'brightness(1.12)' },
+ },
+ markerActive: {
+ outlineWidth: '2px',
+ outlineStyle: 'solid',
+ outlineColor: cssVar.colorTextLightSolid,
+ },
+ note: {
+ position: 'absolute',
+ zIndex: 5,
+ insetInlineEnd: { 'default': '12px', '@media (width >= 1440px)': 'auto' },
+ width: { 'default': 'min(280px, 76%)', '@media (width >= 1440px)': '240px' },
+ padding: '12px',
+ paddingInlineEnd: '32px',
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgElevated,
+ backgroundImage: 'none',
+ boxShadow: cssVar.boxShadowSecondary,
+ insetInlineStart: { 'default': null, '@media (width >= 1440px)': 'calc(100% + 12px)' },
+ },
+ noteClose: {
+ cursor: 'pointer',
+ position: 'absolute',
+ insetBlockStart: '8px',
+ insetInlineEnd: '8px',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '20px',
+ height: '20px',
+ padding: '0',
+ borderStyle: 'none',
+ borderRadius: cssVar.borderRadius,
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorText },
+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },
+ backgroundImage: { 'default': 'none', ':hover': 'none' },
+ transition: `all ${cssVar.motionDurationFast}`,
+ },
+ noteFallbackHead: { paddingBlockEnd: '4px' },
+ pin: {
+ cursor: 'pointer',
+ position: 'absolute',
+ zIndex: 4,
+ insetInlineEnd: { 'default': '-14px', '@media (width >= 1440px)': 'auto' },
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '24px',
+ height: '24px',
+ borderStyle: 'none',
+ borderTopLeftRadius: '50%',
+ borderTopRightRadius: '50%',
+ borderBottomRightRadius: '50%',
+ borderBottomLeftRadius: '2px',
+ color: cssVar.colorTextLightSolid,
+ boxShadow: cssVar.boxShadowTertiary,
+ filter: { 'default': null, ':hover': 'brightness(1.12)' },
+ insetInlineStart: { 'default': null, '@media (width >= 1440px)': 'calc(100% + 12px)' },
+ },
+ pinFace: { width: '18px', height: '18px', borderRadius: '50%', objectFit: 'cover' },
+ pinInitial: { fontSize: '11px', fontWeight: 600, lineHeight: 1 },
+ stage: { position: 'relative' },
+ noteBody: { fontSize: '13px', lineHeight: 1.6, overflowWrap: 'anywhere', whiteSpace: 'pre-wrap' },
+ rect: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorError,
+ borderRadius: cssVar.borderRadiusXS,
+ boxShadow: '0 0 0 1px rgb(0 0 0 / 45%),\n inset 0 0 0 1px rgb(255 255 255 / 45%)',
+ },
+ swatch: { flex: 'none', width: '8px', height: '8px', borderRadius: '50%' },
+});
interface OverlayRectProps {
annotation: EvidenceOverlay;
@@ -260,7 +160,7 @@ const OverlayRect = memo<OverlayRectProps>(
const label = annotation.label ?? index + 1;
return (
<div
- className={styles.rect}
+ className={stylex.props(styles.rect).className}
style={{
borderColor: color,
height: `${rect.height * 100}%`,
@@ -270,13 +170,13 @@ const OverlayRect = memo<OverlayRectProps>(
}}
>
{numbered && (
- <span className={styles.badge} style={{ background: color }}>
+ <span className={stylex.props(styles.badge).className} style={{ background: color }}>
{label}
</span>
)}
{annotation.comment && (
<button
- className={cx(styles.marker, opened && styles.markerActive)}
+ className={stylex.props(styles.marker, opened && styles.markerActive).className}
style={{ background: color }}
title={annotation.authorName}
type={'button'}
@@ -311,7 +211,7 @@ const AnnotationFace = memo<{ name?: string; size?: number; src?: string | null
return (
<img
alt={name ?? ''}
- className={styles.pinFace}
+ className={stylex.props(styles.pinFace).className}
src={src}
style={{ height: size, width: size }}
/>
@@ -319,7 +219,10 @@ const AnnotationFace = memo<{ name?: string; size?: number; src?: string | null
const initial = name?.trim().slice(0, 1);
if (initial)
return (
- <span className={styles.pinInitial} style={{ fontSize: size < 16 ? 9 : 11 }}>
+ <span
+ className={stylex.props(styles.pinInitial).className}
+ style={{ fontSize: size < 16 ? 9 : 11 }}
+ >
{initial.toUpperCase()}
</span>
);
@@ -368,7 +271,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
// hangs off the bottom of the image.
const note = opened && (
<div
- className={styles.note}
+ className={stylex.props(styles.note).className}
id={opened.threadId ? commentAnchorId(opened.threadId) : undefined}
style={{ insetBlockStart: `${Math.min(Math.max(opened.rect.y, 0), 0.62) * 100}%` }}
>
@@ -379,7 +282,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
* is looking.
*/}
<button
- className={styles.noteClose}
+ {...stylex.props(styles.noteClose)}
title={t('acceptance.comments.collapseThread')}
type={'button'}
onClick={close}
@@ -388,9 +291,14 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
</button>
{opened.panel ?? (
<Flexbox gap={4}>
- <Flexbox horizontal align={'center'} className={styles.noteFallbackHead} gap={6}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={stylex.props(styles.noteFallbackHead).className}
+ gap={6}
+ >
<span
- className={styles.swatch}
+ className={stylex.props(styles.swatch).className}
style={{ background: opened.color ?? cssVar.colorError }}
/>
<Text fontSize={12} type={'secondary'}>
@@ -398,7 +306,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
{opened.authorName}
</Text>
</Flexbox>
- <div className={styles.noteBody}>{opened.comment}</div>
+ <div {...stylex.props(styles.noteBody)}>{opened.comment}</div>
</Flexbox>
)}
</div>
@@ -409,7 +317,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
annotations?.map((annotation, index) =>
annotation.comment ? (
<button
- className={styles.pin}
+ className={stylex.props(styles.pin).className}
key={index}
title={annotation.authorName}
type={'button'}
@@ -430,7 +338,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
const shell = (width: string | number, body: ReactNode) => (
<Flexbox gap={4} style={{ maxWidth: '100%', width }}>
- <div className={styles.stage} {...(action ? { [FLOATING_ACTION_HOST]: '' } : {})}>
+ <div {...stylex.props(styles.stage, action ? floatingActionHostMarker : null)}>
{body}
{pins}
{note}
@@ -444,7 +352,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
return shell(
'100%',
<div
- className={cx(styles.frame, flat && styles.frameFlat)}
+ className={stylex.props(styles.frame, flat && styles.frameFlat).className}
style={{ maxWidth: '100%', width: '100%' }}
>
<Image
@@ -476,7 +384,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
return (
<div
- className={cx(styles.frame, flat && styles.frameFlat)}
+ className={stylex.props(styles.frame, flat && styles.frameFlat).className}
key={slice.index}
style={{
aspectRatio: `${natural.width} / ${slice.height}`,
@@ -527,7 +435,7 @@ export const ScreenshotTiles = memo<ScreenshotTilesProps>(
return shell(
portrait ? screenshotTileWidth(natural.width) : '100%',
<div
- className={cx(styles.frame, flat && styles.frameFlat)}
+ className={stylex.props(styles.frame, flat && styles.frameFlat).className}
style={{
aspectRatio: `${natural.width} / ${natural.height}`,
maxWidth: '100%',
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx b/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx
index fd73c483927..bfd58dd68c6 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/RangeLane.tsx
@@ -1,9 +1,12 @@
'use client';
import { useVideo } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import type { PointerEvent as ReactPointerEvent } from 'react';
import { useTranslation } from 'react-i18next';
+import { sx } from '@/styles/sx';
+
import type { TimedNote } from './chapters';
import { styles } from './styles';
@@ -53,21 +56,26 @@ export const RangeLane = ({ notes, onRange, onSeek, range }: RangeLaneProps) =>
};
return (
- <div className={styles.lane} onPointerDown={onPointerDown}>
- {!range && <span className={styles.laneLabel}>{t('acceptance.video.rangeLane')}</span>}
+ <div {...stylex.props(styles.lane)} onPointerDown={onPointerDown}>
+ {!range && <span {...stylex.props(styles.laneLabel)}>{t('acceptance.video.rangeLane')}</span>}
{notes
.filter((note) => note.end !== undefined)
.map((note) => (
<div
- className={styles.noteSpan}
key={`span-${note.key}`}
- style={{ left: pct(note.start), top: 4, width: pct(note.end! - note.start) }}
+ {...sx(styles.noteSpan, {
+ left: pct(note.start),
+ top: 4,
+ width: pct(note.end! - note.start),
+ })}
/>
))}
{range && (
<div
- className={styles.rangeBand}
- style={{ left: pct(range.start), width: pct(range.end - range.start) }}
+ {...sx(styles.rangeBand, {
+ left: pct(range.start),
+ width: pct(range.end - range.start),
+ })}
/>
)}
</div>
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx b/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx
index dab6fc1dec3..e7e0afe43cf 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/ReviewTools.tsx
@@ -1,45 +1,42 @@
'use client';
-import { ActionIcon, Button, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { ActionIcon, Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Flag, MessageSquareText, Repeat, X } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import type { VideoLoop } from './RangeLane';
import { formatVideoTime } from './videoTime';
-const local = createStaticStyles(({ css }) => ({
- kbd: css`
- display: inline-block;
-
- min-width: 16px;
- margin-inline: 1px;
- padding-inline: 4px;
- border: 1px solid ${cssVar.colorBorder};
- border-radius: 4px;
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 10px;
- line-height: 16px;
- color: ${cssVar.colorTextSecondary};
- text-align: center;
- `,
- mono: css`
- font-family: ${cssVar.fontFamilyCode};
- font-variant-numeric: tabular-nums;
- `,
- tools: css`
- flex: none;
-
- min-height: 40px;
- padding-block: 6px;
- padding-inline: 12px;
- border-radius: ${cssVar.borderRadiusLG};
-
- font-size: 12px;
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+const local = stylex.create({
+ kbd: {
+ display: 'inline-block',
+ minWidth: '16px',
+ marginInline: '1px',
+ paddingInline: '4px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorder,
+ borderRadius: '4px',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '10px',
+ lineHeight: '16px',
+ color: cssVar.colorTextSecondary,
+ textAlign: 'center',
+ },
+ mono: { fontFamily: cssVar.fontFamilyCode, fontVariantNumeric: 'tabular-nums' },
+ tools: {
+ flex: 'none',
+ minHeight: '40px',
+ paddingBlock: '6px',
+ paddingInline: '12px',
+ borderRadius: cssVar.borderRadiusLG,
+ fontSize: '12px',
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+});
interface ReviewToolsProps {
loop: boolean;
@@ -64,11 +61,11 @@ export const ReviewTools = ({
const { t } = useTranslation('verify');
return (
- <Flexbox horizontal align={'center'} className={local.tools} gap={8}>
+ <Flexbox horizontal align={'center'} className={stylex.props(local.tools).className} gap={8}>
{range ? (
<>
<Icon icon={Repeat} size={14} />
- <span className={local.mono}>
+ <span {...stylex.props(local.mono)}>
{formatVideoTime(range.start)} – {formatVideoTime(range.end)}
</span>
<Text fontSize={12} type={'secondary'}>
@@ -91,14 +88,14 @@ export const ReviewTools = ({
) : (
<>
<Text fontSize={12} type={'secondary'}>
- <span className={local.kbd}>Space</span> {t('acceptance.video.play')} ·{' '}
- <span className={local.kbd}>,</span>
- <span className={local.kbd}>.</span> {t('acceptance.video.keysFrame')} ·{' '}
- <span className={local.kbd}>J</span>
- <span className={local.kbd}>L</span> {t('acceptance.video.speed')} ·{' '}
- <span className={local.kbd}>M</span> {t('acceptance.video.markFrame')} ·{' '}
- <span className={local.kbd}>I</span>
- <span className={local.kbd}>O</span> {t('acceptance.video.keysRange')}
+ <span {...stylex.props(local.kbd)}>Space</span> {t('acceptance.video.play')} ·{' '}
+ <span {...stylex.props(local.kbd)}>,</span>
+ <span {...stylex.props(local.kbd)}>.</span> {t('acceptance.video.keysFrame')} ·{' '}
+ <span {...stylex.props(local.kbd)}>J</span>
+ <span {...stylex.props(local.kbd)}>L</span> {t('acceptance.video.speed')} ·{' '}
+ <span {...stylex.props(local.kbd)}>M</span> {t('acceptance.video.markFrame')} ·{' '}
+ <span {...stylex.props(local.kbd)}>I</span>
+ <span {...stylex.props(local.kbd)}>O</span> {t('acceptance.video.keysRange')}
</Text>
<div style={{ flex: 1 }} />
<Button disabled={!ready} icon={Flag} size={'small'} onClick={onMarkFrame}>
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
index f9fcce05f19..428b7976a72 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoChrome.tsx
@@ -1,6 +1,9 @@
'use client';
-import { cx, useVideo } from '@lobehub/ui';
+import { useVideo } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+
+import { sx } from '@/styles/sx';
import { styles } from './styles';
import { isOnFrame } from './videoTime';
@@ -32,20 +35,21 @@ const Regions = ({ active, regions }: { active?: string; regions: FrameRegion[]
.map((region) => (
<div
key={region.key}
- style={{ ...percent(region.rect), borderColor: region.color }}
- className={
- region.label === undefined && region.color === undefined ? styles.region : styles.mark
- }
+ {...sx(
+ region.label === undefined && region.color === undefined ? styles.region : styles.mark,
+ { ...percent(region.rect), borderColor: region.color },
+ )}
>
{region.label !== undefined ? (
<span
- className={cx(styles.markBadge, region.key === active && styles.markBadgeActive)}
- style={{ background: region.color }}
+ {...sx(styles.markBadge, region.key === active && styles.markBadgeActive, {
+ background: region.color,
+ })}
>
{region.label}
</span>
) : region.comment ? (
- <span className={styles.regionLabel}>{region.comment}</span>
+ <span {...stylex.props(styles.regionLabel)}>{region.comment}</span>
) : null}
</div>
));
@@ -56,5 +60,5 @@ export const FrameRegions = ({ active, regions }: { active?: string; regions: Fr
regions.length > 0 ? <Regions active={active} regions={regions} /> : null;
export const DraftRegion = ({ rect }: { rect: Rect }) => (
- <div className={styles.draft} style={percent(rect)} />
+ <div {...sx(styles.draft, percent(rect))} />
);
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx
index 67b4f191367..d332ac72f74 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoClaimList.tsx
@@ -1,7 +1,9 @@
'use client';
import type { VerifyEvidenceChapter } from '@lobechat/types';
-import { createStaticStyles, cssVar, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronDown, ChevronRight } from 'lucide-react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,80 +11,59 @@ import { useTranslation } from 'react-i18next';
import { ClaimDot } from './ClaimLabel';
import { claimsOf, formatVideoClock, formatVideoTime, stepsOf } from './videoTime';
-const styles = createStaticStyles(({ css }) => ({
- step: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 6px;
- align-items: center;
-
- height: 24px;
- padding-inline: 8px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
-
- background: transparent;
-
- &:hover {
- color: ${cssVar.colorText};
- background: ${cssVar.colorFillTertiary};
- }
- `,
- toggle: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 4px;
- align-items: center;
- align-self: flex-start;
-
- padding: 0;
- border: none;
-
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
-
- background: none;
-
- &:hover {
- color: ${cssVar.colorTextSecondary};
- }
- `,
- claim: css`
- cursor: pointer;
-
- display: flex;
- gap: 8px;
- align-items: baseline;
-
- padding-block: 3px;
- padding-inline: 6px;
- border: none;
- border-radius: ${cssVar.borderRadiusSM};
-
- font-size: 13px;
- color: ${cssVar.colorText};
- text-align: start;
-
- background: transparent;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- time: css`
- flex: none;
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 11px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextTertiary};
- `,
-}));
+const styles = stylex.create({
+ step: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '6px',
+ alignItems: 'center',
+ height: '24px',
+ paddingInline: '8px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ fontSize: '12px',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },
+ backgroundImage: { 'default': 'none', ':hover': 'none' },
+ },
+ toggle: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '4px',
+ alignItems: 'center',
+ alignSelf: 'flex-start',
+ padding: '0',
+ borderStyle: 'none',
+ fontSize: '12px',
+ color: { 'default': cssVar.colorTextTertiary, ':hover': cssVar.colorTextSecondary },
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ },
+ claim: {
+ cursor: 'pointer',
+ display: 'flex',
+ gap: '8px',
+ alignItems: 'baseline',
+ paddingBlock: '3px',
+ paddingInline: '6px',
+ borderStyle: 'none',
+ borderRadius: cssVar.borderRadiusSM,
+ fontSize: '13px',
+ color: cssVar.colorText,
+ textAlign: 'start',
+ backgroundColor: { 'default': 'transparent', ':hover': cssVar.colorFillTertiary },
+ backgroundImage: { 'default': 'none', ':hover': 'none' },
+ },
+ time: {
+ flex: 'none',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '11px',
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorTextTertiary,
+ },
+});
interface VideoClaimListProps {
chapters: VerifyEvidenceChapter[];
@@ -110,12 +91,12 @@ export const VideoClaimList = ({ chapters, onSeek }: VideoClaimListProps) => {
<Flexbox horizontal gap={6} style={{ flexWrap: 'wrap' }}>
{steps.map((step) => (
<button
- className={styles.step}
+ {...stylex.props(styles.step)}
key={`${step.t}-${step.label}`}
type={'button'}
onClick={() => onSeek(step.t)}
>
- <span className={styles.time}>{formatVideoClock(step.t)}</span>
+ <span {...stylex.props(styles.time)}>{formatVideoClock(step.t)}</span>
{step.label}
</button>
))}
@@ -124,7 +105,7 @@ export const VideoClaimList = ({ chapters, onSeek }: VideoClaimListProps) => {
{claims.length > 0 && (
<button
aria-expanded={open}
- className={styles.toggle}
+ {...stylex.props(styles.toggle)}
type={'button'}
onClick={() => setOpen((value) => !value)}
>
@@ -135,7 +116,7 @@ export const VideoClaimList = ({ chapters, onSeek }: VideoClaimListProps) => {
{open &&
claims.map((claim, index) => (
<button
- className={styles.claim}
+ {...stylex.props(styles.claim)}
key={`${claim.kind}-${claim.t}-${index}`}
type={'button'}
onClick={() => onSeek(claim.t)}
@@ -143,7 +124,7 @@ export const VideoClaimList = ({ chapters, onSeek }: VideoClaimListProps) => {
<span style={{ alignSelf: 'center', display: 'inline-flex' }}>
<ClaimDot kind={claim.kind} />
</span>
- <span className={styles.time}>{formatVideoTime(claim.t)}</span>
+ <span {...stylex.props(styles.time)}>{formatVideoTime(claim.t)}</span>
<span>{claim.note}</span>
</button>
))}
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
index 24b8f9fa9e5..50503aa6ad7 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoEvidencePlayer.tsx
@@ -7,6 +7,8 @@ import type {
VerifyEvidenceChapter,
} from '@lobechat/types';
import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- needs lobe-ui slot: Video.Controls frame number
+ createStaticStyles,
cx,
Flexbox,
useVideo,
@@ -15,11 +17,15 @@ import {
Video,
type VideoPlayer,
} from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import type { CSSProperties, ReactNode, RefObject } from 'react';
import { memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
-import FloatingCommentAction, { FLOATING_ACTION_HOST } from '../FloatingCommentAction';
+import { sx } from '@/styles/sx';
+
+import { floatingActionHostMarker, videoPlayerMarker } from '../../markers.stylex';
+import FloatingCommentAction from '../FloatingCommentAction';
import { noteKeyOf, toClaimMarkers, toNoteMarkers, toSections } from './chapters';
import { readStoredRate, storeRate } from './playbackRate';
import { styles } from './styles';
@@ -31,6 +37,57 @@ import { frameOf } from './videoTime';
const MAX_HEIGHT = 360;
const MIN_PLAYER_WIDTH = 480;
+const fallback = createStaticStyles(({ css }) => ({
+ compactControls: css`
+ @media (width <= 767px) {
+ .lobe-video__frame-number {
+ display: none;
+ }
+ }
+ `,
+}));
+
+const playerStyles = stylex.create({
+ root: {
+ display: { 'default': null, ':fullscreen': 'flex' },
+ flexDirection: { 'default': null, ':fullscreen': 'column' },
+ borderRadius: { 'default': null, ':fullscreen': 0 },
+ },
+ controls: {
+ flex: { default: null, [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 'none' },
+ },
+ stage: {
+ containerType: {
+ default: null,
+ [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 'size',
+ },
+ flex: { default: null, [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: '1' },
+ alignItems: {
+ default: null,
+ [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 'center',
+ },
+ minWidth: { default: null, [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 0 },
+ minHeight: { default: null, [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 0 },
+ },
+ frame: {
+ flex: { default: null, [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 'none' },
+ width: {
+ default: null,
+ [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]:
+ 'min(100cqw, calc(100cqh * var(--acceptance-video-aspect)))',
+ },
+ maxWidth: {
+ default: 'var(--acceptance-video-frame-width)',
+ [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]: 'none',
+ },
+ height: {
+ default: null,
+ [stylex.when.ancestor(':fullscreen', videoPlayerMarker)]:
+ 'min(100cqh, calc(100cqw / var(--acceptance-video-aspect)))',
+ },
+ },
+});
+
export interface VideoEvidencePlayerHandle {
focus: (time: AcceptanceCommentTime, options?: { reveal?: boolean }) => void;
}
@@ -80,12 +137,12 @@ const CommentSurface = ({
const gesture = useVideoRegionGesture(player, onRegion);
if (!ready) return null;
return (
- <div className={cx(styles.overlay, styles.drawable)} onPointerDown={gesture.onPointerDown}>
+ <div {...stylex.props(styles.overlay, styles.drawable)} onPointerDown={gesture.onPointerDown}>
<FrameRegions active={active} regions={regions} />
{gesture.draft ? (
<DraftRegion rect={gesture.draft} />
) : (
- <div className={styles.hint}>
+ <div {...stylex.props(styles.hint)}>
{t(
paused
? 'acceptance.comments.video.hintPaused'
@@ -177,24 +234,26 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>(
{/* The host takes the player's width, so the comment action floats right
beside a narrow recording instead of at the far edge of the column. */}
<div
- {...{ [FLOATING_ACTION_HOST]: '' }}
data-acceptance-video-host
- style={{
+ {...sx(floatingActionHostMarker, {
maxWidth: frameMaxHeight
? `max(${MIN_PLAYER_WIDTH}px, calc(${frameMaxHeight} * ${aspect}))`
: `min(100%, ${Math.max(MIN_PLAYER_WIDTH, frameWidth)}px)`,
position: 'relative',
width: '100%',
- }}
+ })}
>
<Video.Root
- className={cx(styles.player, styles.compactControls)}
defaultPlaybackRate={defaultRate}
markers={markers}
maxHeight={frameMaxHeight ? undefined : MAX_HEIGHT}
player={player}
sections={sections}
src={src}
+ className={cx(
+ stylex.props(playerStyles.root, videoPlayerMarker).className,
+ fallback.compactControls,
+ )}
style={
{
'--acceptance-video-aspect': aspect,
@@ -211,8 +270,8 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>(
if (key !== undefined) onMarkClick?.(key);
}}
>
- <div data-acceptance-video-stage className={styles.stage}>
- <Video.Frame className={styles.frame}>
+ <div data-acceptance-video-stage {...stylex.props(styles.stage, playerStyles.stage)}>
+ <Video.Frame className={stylex.props(playerStyles.frame).className}>
{onRegion ? (
<CommentSurface
active={activeMark}
@@ -228,7 +287,7 @@ export const VideoEvidencePlayer = memo<VideoEvidencePlayerProps>(
<Video.LoadError />
</Video.Frame>
</div>
- <Video.Controls frameStep />
+ <Video.Controls frameStep className={stylex.props(playerStyles.controls).className} />
</Video.Root>
{onComment && (
<FloatingCommentAction
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx
index b1fcade2f77..263926830f0 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoNotes.tsx
@@ -1,7 +1,9 @@
'use client';
import { isFullFrameRect } from '@lobechat/const/verify';
-import { createStaticStyles, cssVar, cx, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Flag, Repeat } from 'lucide-react';
import { useTranslation } from 'react-i18next';
@@ -10,48 +12,37 @@ import { RegionNoteRow } from '../RegionNotes';
import { ClaimLabel } from './ClaimLabel';
import { formatVideoTime, frameOf } from './videoTime';
-const styles = createStaticStyles(({ css }) => ({
- stamp: css`
- cursor: pointer;
-
- display: inline-flex;
- gap: 4px;
- align-items: center;
-
- padding-block: 1px;
- padding-inline: 6px;
- border: none;
- border-radius: 4px;
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 11px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorErrorText};
-
- background: ${cssVar.colorErrorBg};
-
- &:hover {
- background: ${cssVar.colorErrorBgHover};
- }
- `,
- active: css`
- box-shadow: 0 0 0 1px ${cssVar.colorError};
- `,
- quote: css`
- display: flex;
- flex-direction: column;
- gap: 2px;
-
- padding-block: 6px;
- padding-inline: 10px;
- border-radius: 6px;
-
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+const styles = stylex.create({
+ stamp: {
+ cursor: 'pointer',
+ display: 'inline-flex',
+ gap: '4px',
+ alignItems: 'center',
+ paddingBlock: '1px',
+ paddingInline: '6px',
+ borderStyle: 'none',
+ borderRadius: '4px',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '11px',
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorErrorText,
+ backgroundColor: { 'default': cssVar.colorErrorBg, ':hover': cssVar.colorErrorBgHover },
+ backgroundImage: { 'default': 'none', ':hover': 'none' },
+ },
+ active: { boxShadow: `0 0 0 1px ${cssVar.colorError}` },
+ quote: {
+ display: 'flex',
+ flexDirection: 'column',
+ gap: '2px',
+ paddingBlock: '6px',
+ paddingInline: '10px',
+ borderRadius: '6px',
+ fontSize: '12px',
+ color: cssVar.colorTextSecondary,
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+});
interface VideoNotesProps {
activeNoteKey?: number;
@@ -98,7 +89,7 @@ export const VideoNotes = ({
<Flexbox gap={6}>
<Flexbox horizontal align={'center'} gap={6}>
<button
- className={cx(styles.stamp, note.key === activeNoteKey && styles.active)}
+ {...stylex.props(styles.stamp, note.key === activeNoteKey && styles.active)}
type={'button'}
onClick={() => onFocusNote(note)}
>
@@ -110,7 +101,7 @@ export const VideoNotes = ({
<span style={{ color: cssVar.colorTextTertiary, fontSize: 11 }}>{detail}</span>
</Flexbox>
{note.disputes && (
- <div className={styles.quote}>
+ <div {...stylex.props(styles.quote)}>
<ClaimLabel kind={note.disputes.kind} />
<div>{note.disputes.note}</div>
</div>
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx
index c2993969ac2..351f2c3e0a2 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/Video/VideoReviewStage.tsx
@@ -2,16 +2,9 @@
import { isFullFrameRect } from '@lobechat/const/verify';
import type { AcceptanceReviewAnnotation, VerifyEvidenceChapter } from '@lobechat/types';
-import {
- createStaticStyles,
- cssVar,
- cx,
- useVideo,
- useVideoPlayer,
- useVideoState,
- Video,
- type VideoPlayer,
-} from '@lobehub/ui';
+import { useVideo, useVideoPlayer, useVideoState, Video, type VideoPlayer } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import type { PointerEvent as ReactPointerEvent, RefObject } from 'react';
import { memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -29,17 +22,15 @@ type Rect = AcceptanceReviewAnnotation['rect'];
const RATES = [0.5, 1, 1.5, 2];
-const local = createStaticStyles(({ css }) => ({
- /** The frame shrinks to the room left by the timeline and the tools. */
- fit: css`
- display: flex;
- flex: 1;
- align-items: center;
- justify-content: center;
-
- min-height: 0;
- `,
-}));
+const local = stylex.create({
+ fit: {
+ display: 'flex',
+ flex: '1',
+ alignItems: 'center',
+ justifyContent: 'center',
+ minHeight: '0',
+ },
+});
export interface VideoReviewStageHandle {
/** Pause on a note's frame (and select its span) — the notes panel's "go there". */
@@ -123,7 +114,7 @@ const Hint = ({ drafting, flash }: { drafting: boolean; flash: string | null })
: paused
? t('acceptance.video.hintPaused', { frame })
: t('acceptance.video.hintPlaying'));
- return hint ? <div className={styles.hint}>{hint}</div> : null;
+ return hint ? <div {...stylex.props(styles.hint)}>{hint}</div> : null;
};
/**
@@ -310,7 +301,7 @@ export const VideoReviewStage = memo<VideoReviewStageProps>(
const disputed = notes.some((note) => disputesClaim(note.disputes, claim));
return (
<button
- className={styles.dispute}
+ {...stylex.props(styles.dispute)}
disabled={disputed}
type={'button'}
onClick={() => {
@@ -360,7 +351,7 @@ export const VideoReviewStage = memo<VideoReviewStageProps>(
if (fresh && fresh !== src) setSrc(fresh);
}}
>
- <div className={local.fit}>
+ <div {...stylex.props(local.fit)}>
<Video.Frame
style={{
borderRadius: cssVar.borderRadiusLG,
@@ -370,7 +361,7 @@ export const VideoReviewStage = memo<VideoReviewStageProps>(
}}
>
{ready && (
- <div className={cx(styles.overlay, styles.drawable)} onPointerDown={onStageDown}>
+ <div {...stylex.props(styles.overlay, styles.drawable)} onPointerDown={onStageDown}>
<FrameRegions regions={regions} />
{draft && <DraftRegion rect={draft} />}
<Hint drafting={Boolean(draft)} flash={flash} />
diff --git a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts b/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
index af14057be85..4be971f625e 100644
--- a/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
+++ b/src/features/Acceptance/Viewer/Evidence/Video/styles.ts
@@ -1,232 +1,163 @@
import type { VerifyEvidenceChapterKind } from '@lobechat/types';
-import { createStaticStyles, cssVar } from '@lobehub/ui';
-
-export const styles = createStaticStyles(({ css }) => ({
- player: css`
- &:fullscreen {
- display: flex;
- flex-direction: column;
- border-radius: 0;
- }
-
- &:fullscreen > [data-video-controls] {
- flex: none;
- }
-
- &:fullscreen > [data-acceptance-video-stage] {
- container-type: size;
- flex: 1;
- align-items: center;
-
- min-width: 0;
- min-height: 0;
- }
-
- &:fullscreen > [data-acceptance-video-stage] > .lobe-video__frame {
- flex: none;
- width: min(100cqw, calc(100cqh * var(--acceptance-video-aspect)));
- max-width: none;
- height: min(100cqh, calc(100cqw / var(--acceptance-video-aspect)));
- }
- `,
- stage: css`
- display: flex;
- justify-content: center;
- `,
- frame: css`
- max-width: var(--acceptance-video-frame-width);
- `,
- // Keep stepping and fullscreen visible on a phone; the frame is also named on its comment card.
- compactControls: css`
- @media (width <= 767px) {
- .lobe-video__frame-number {
- display: none;
- }
- }
- `,
- overlay: css`
- position: absolute;
- inset: 0;
- `,
- drawable: css`
- touch-action: none;
- cursor: crosshair;
- `,
- region: css`
- pointer-events: none;
-
- position: absolute;
-
- border: 2px solid ${cssVar.colorError};
- border-radius: 4px;
-
- box-shadow: 0 0 0 9999px rgb(0 0 0 / 20%);
- `,
- regionLabel: css`
- position: absolute;
- inset-block-start: -22px;
- inset-inline-start: -2px;
-
- overflow: hidden;
-
- max-width: 240px;
- padding-block: 1px;
- padding-inline: 6px;
- border-radius: 4px;
-
- font-size: 11px;
- line-height: 18px;
- color: #fff;
- text-overflow: ellipsis;
- white-space: nowrap;
-
- background: ${cssVar.colorError};
- `,
- /**
- * A comment region, drawn exactly like the region on a screenshot
- * (`Evidence/Annotation` and `ScreenshotTiles`): a 2px box with two rings —
- * the dark one separates it from a light frame, the light one from a dark
- * frame — in the annotation colour (`colorError`) unless the caller passes
- * the colour the screenshot overlay uses for the same comment.
- */
- mark: css`
- pointer-events: none;
-
- position: absolute;
-
- border: 2px solid ${cssVar.colorError};
- border-radius: 4px;
-
- box-shadow:
- 0 0 0 1px rgb(0 0 0 / 45%),
- inset 0 0 0 1px rgb(255 255 255 / 45%);
- `,
- /** The screenshot's numbered badge: 18px disc on the box's top-left corner. */
- markBadge: css`
- position: absolute;
- inset-block-start: -9px;
- inset-inline-start: -9px;
-
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- width: 18px;
- height: 18px;
- border-radius: 50%;
-
- font-size: 11px;
- font-weight: 600;
- line-height: 1;
- color: ${cssVar.colorTextLightSolid};
-
- background: ${cssVar.colorError};
- `,
- /** Selected reads the way an opened screenshot note does: a light outline on its disc. */
- markBadgeActive: css`
- outline: 2px solid ${cssVar.colorTextLightSolid};
- `,
- draft: css`
- pointer-events: none;
- position: absolute;
- border: 2px dashed ${cssVar.colorWarning};
- border-radius: 4px;
- `,
- hint: css`
- pointer-events: none;
-
- position: absolute;
- inset-block-start: 12px;
- inset-inline-start: 50%;
- transform: translateX(-50%);
-
- padding-block: 4px;
- padding-inline: 10px;
- border-radius: 999px;
-
- font-size: 12px;
- color: #fff;
- white-space: nowrap;
-
- background: rgb(0 0 0 / 65%);
- `,
- dispute: css`
- cursor: pointer;
-
- flex: none;
-
- padding-block: 1px;
- padding-inline: 8px;
- border: 1px solid rgb(255 255 255 / 30%);
- border-radius: 4px;
-
- font-size: 12px;
- color: #fff;
-
- background: transparent;
-
- &:disabled {
- cursor: default;
- opacity: 0.5;
- }
-
- &:hover:not(:disabled) {
- background: rgb(255 255 255 / 12%);
- }
- `,
- noteSpan: css`
- pointer-events: none;
-
- position: absolute;
- inset-block-start: 6px;
-
- height: 8px;
- border-radius: 2px;
-
- opacity: 0.6;
- background: ${cssVar.colorError};
- `,
- rangeBand: css`
- pointer-events: none;
-
- position: absolute;
- inset-block: 2px;
-
- border-radius: 3px;
-
- background: color-mix(in srgb, ${cssVar.colorWarning} 25%, transparent);
- box-shadow: inset 0 0 0 1px ${cssVar.colorWarning};
- `,
- lane: css`
- touch-action: none;
- cursor: text;
-
- position: relative;
-
- height: 16px;
- margin-block-start: 4px;
- border-radius: 4px;
-
- background: repeating-linear-gradient(
- 90deg,
- rgb(255 255 255 / 6%) 0,
- rgb(255 255 255 / 6%) 1px,
- transparent 1px,
- transparent 12px
- );
- `,
- laneLabel: css`
- pointer-events: none;
-
- position: absolute;
- inset-block-start: 0;
- inset-inline-start: 6px;
-
- font-size: 10px;
- line-height: 16px;
- color: #777;
- `,
-}));
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+
+export const styles = stylex.create({
+ stage: {
+ display: 'flex',
+ justifyContent: 'center',
+ },
+ overlay: {
+ position: 'absolute',
+ insetBlockStart: 0,
+ insetBlockEnd: 0,
+ insetInlineStart: 0,
+ insetInlineEnd: 0,
+ },
+ drawable: {
+ touchAction: 'none',
+ cursor: 'crosshair',
+ },
+ region: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorError,
+ borderRadius: '4px',
+ boxShadow: '0 0 0 9999px rgb(0 0 0 / 20%)',
+ },
+ regionLabel: {
+ position: 'absolute',
+ insetBlockStart: '-22px',
+ insetInlineStart: '-2px',
+ overflow: 'hidden',
+ maxWidth: '240px',
+ paddingBlock: '1px',
+ paddingInline: '6px',
+ borderRadius: '4px',
+ fontSize: '11px',
+ lineHeight: '18px',
+ color: '#fff',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ backgroundColor: cssVar.colorError,
+ },
+ // A comment region, drawn exactly like the region on a screenshot
+ // (`Evidence/Annotation` and `ScreenshotTiles`): a 2px box with two rings —
+ // the dark one separates it from a light frame, the light one from a dark
+ // frame — in the annotation colour (`colorError`) unless the caller passes
+ // the colour the screenshot overlay uses for the same comment.
+ mark: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ borderWidth: '2px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorError,
+ borderRadius: '4px',
+ boxShadow: '0 0 0 1px rgb(0 0 0 / 45%), inset 0 0 0 1px rgb(255 255 255 / 45%)',
+ },
+ // The screenshot's numbered badge: 18px disc on the box's top-left corner.
+ markBadge: {
+ position: 'absolute',
+ insetBlockStart: '-9px',
+ insetInlineStart: '-9px',
+ display: 'inline-flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '18px',
+ height: '18px',
+ borderRadius: '50%',
+ fontSize: '11px',
+ fontWeight: 600,
+ lineHeight: 1,
+ color: cssVar.colorTextLightSolid,
+ backgroundColor: cssVar.colorError,
+ },
+ // Selected reads the way an opened screenshot note does: a light outline on its disc.
+ markBadgeActive: {
+ outlineWidth: '2px',
+ outlineStyle: 'solid',
+ outlineColor: cssVar.colorTextLightSolid,
+ },
+ draft: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ borderWidth: '2px',
+ borderStyle: 'dashed',
+ borderColor: cssVar.colorWarning,
+ borderRadius: '4px',
+ },
+ hint: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: '12px',
+ insetInlineStart: '50%',
+ transform: 'translateX(-50%)',
+ paddingBlock: '4px',
+ paddingInline: '10px',
+ borderRadius: '999px',
+ fontSize: '12px',
+ color: '#fff',
+ whiteSpace: 'nowrap',
+ backgroundColor: 'rgb(0 0 0 / 65%)',
+ },
+ dispute: {
+ cursor: { 'default': 'pointer', ':disabled': 'default' },
+ flex: 'none',
+ paddingBlock: '1px',
+ paddingInline: '8px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: 'rgb(255 255 255 / 30%)',
+ borderRadius: '4px',
+ fontSize: '12px',
+ color: '#fff',
+ opacity: { 'default': null, ':disabled': 0.5 },
+ backgroundColor: {
+ 'default': 'transparent',
+ ':hover': { 'default': null, ':not(:disabled)': 'rgb(255 255 255 / 12%)' },
+ },
+ backgroundImage: 'none',
+ },
+ noteSpan: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: '6px',
+ height: '8px',
+ borderRadius: '2px',
+ opacity: 0.6,
+ backgroundColor: cssVar.colorError,
+ },
+ rangeBand: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: '2px',
+ insetBlockEnd: '2px',
+ borderRadius: '3px',
+ backgroundColor: `color-mix(in srgb, ${cssVar.colorWarning} 25%, transparent)`,
+ boxShadow: `inset 0 0 0 1px ${cssVar.colorWarning}`,
+ },
+ lane: {
+ touchAction: 'none',
+ cursor: 'text',
+ position: 'relative',
+ height: '16px',
+ marginBlockStart: '4px',
+ borderRadius: '4px',
+ backgroundImage:
+ 'repeating-linear-gradient(90deg, rgb(255 255 255 / 6%) 0, rgb(255 255 255 / 6%) 1px, transparent 1px, transparent 12px)',
+ },
+ laneLabel: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ insetBlockStart: 0,
+ insetInlineStart: '6px',
+ fontSize: '10px',
+ lineHeight: '16px',
+ color: '#777',
+ },
+});
export const CLAIM_COLOR: Record<VerifyEvidenceChapterKind, string> = {
check: cssVar.colorSuccess,
diff --git a/src/features/Acceptance/Viewer/Evidence/attachments.tsx b/src/features/Acceptance/Viewer/Evidence/attachments.tsx
index 0dbc271b3fc..189255c3703 100644
--- a/src/features/Acceptance/Viewer/Evidence/attachments.tsx
+++ b/src/features/Acceptance/Viewer/Evidence/attachments.tsx
@@ -1,19 +1,9 @@
'use client';
import type { AcceptanceAttachment } from '@lobechat/types';
-import {
- Button,
- createStaticStyles,
- cssVar,
- cx,
- Flexbox,
- Icon,
- Image,
- Spin,
- toast,
- Upload,
- useResponsive,
-} from '@lobehub/ui';
+import { Button, Flexbox, Icon, Image, Spin, toast, Upload, useResponsive } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ImagePlus, X } from 'lucide-react';
import { type ClipboardEvent, memo, useCallback, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -23,93 +13,74 @@ import { useFileStore } from '@/store/file';
/** 10MB — a screenshot, not a video; keeps the reject payload light. */
const MAX_ATTACHMENT_SIZE = 10 * 1024 * 1024;
-const styles = createStaticStyles(({ css }) => ({
- flushUpload: css`
- display: contents;
- `,
- remove: css`
- cursor: pointer;
+const coarseOrCompact = '@media (pointer: coarse), (width <= 767px)';
- position: absolute;
- z-index: 2;
- inset-block-start: 0;
- inset-inline-end: 0;
-
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 28px;
- height: 28px;
- padding: 0;
- border: none;
- border-radius: 50%;
-
- color: #fff;
-
- opacity: 1;
- background: ${cssVar.colorError};
-
- transition: opacity 0.15s;
-
- @media (pointer: coarse), (width <= 767px) {
- width: 44px;
- height: 44px;
- }
- `,
- thumb: css`
- position: relative;
-
- overflow: hidden;
-
- width: 56px;
- height: 56px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- &:hover .acceptance-attach-remove {
- opacity: 1;
- }
-
- img {
- display: block;
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- `,
- /**
- * A screenshot posted INTO a remark is the remark's evidence, not a chip on a
- * draft: at 56px "here is what I see instead" is unreadable, so in a comment
- * the picture is shown at a size a reader can judge without opening it.
- */
- thumbLarge: css`
- width: auto;
- max-width: min(100%, 360px);
- height: auto;
- max-height: 220px;
-
- img {
- cursor: zoom-in;
-
- width: auto;
- max-width: min(100%, 360px);
- height: auto;
- max-height: 220px;
-
- object-fit: contain;
- }
- `,
- thumbLoading: css`
- display: flex;
- align-items: center;
- justify-content: center;
-
- color: ${cssVar.colorTextTertiary};
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+const styles = stylex.create({
+ flushUpload: {
+ display: 'contents',
+ },
+ remove: {
+ cursor: 'pointer',
+ position: 'absolute',
+ zIndex: 2,
+ insetBlockStart: 0,
+ insetInlineEnd: 0,
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: { default: '28px', [coarseOrCompact]: '44px' },
+ height: { default: '28px', [coarseOrCompact]: '44px' },
+ padding: 0,
+ borderStyle: 'none',
+ borderRadius: '50%',
+ color: '#fff',
+ opacity: 1,
+ backgroundColor: cssVar.colorError,
+ backgroundImage: 'none',
+ transition: 'opacity 0.15s',
+ },
+ thumb: {
+ position: 'relative',
+ overflow: 'hidden',
+ width: '56px',
+ height: '56px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ },
+ // A screenshot posted INTO a remark is the remark's evidence, not a chip on a
+ // draft: at 56px "here is what I see instead" is unreadable, so in a comment
+ // the picture is shown at a size a reader can judge without opening it.
+ thumbLarge: {
+ width: 'auto',
+ maxWidth: 'min(100%, 360px)',
+ height: 'auto',
+ maxHeight: '220px',
+ },
+ thumbImage: {
+ display: 'block',
+ width: '100%',
+ height: '100%',
+ objectFit: 'cover',
+ },
+ thumbImageLarge: {
+ cursor: 'zoom-in',
+ width: 'auto',
+ maxWidth: 'min(100%, 360px)',
+ height: 'auto',
+ maxHeight: '220px',
+ objectFit: 'contain',
+ },
+ thumbLoading: {
+ display: 'flex',
+ alignItems: 'center',
+ justifyContent: 'center',
+ color: cssVar.colorTextTertiary,
+ backgroundColor: cssVar.colorFillQuaternary,
+ backgroundImage: 'none',
+ },
+});
/** An attachment the user just uploaded this session — id + a live preview URL. */
export interface PendingAttachment {
@@ -216,13 +187,18 @@ export const AttachmentStrip = memo<AttachmentStripProps>(
return (
<Flexbox horizontal gap={8} wrap={'wrap'}>
{attachments.map((attachment) => (
- <div className={styles.thumb} key={attachment.id}>
- <Image alt={attachment.name ?? ''} preview={false} src={attachment.url} />
+ <div key={attachment.id} {...stylex.props(styles.thumb)}>
+ <Image
+ alt={attachment.name ?? ''}
+ classNames={{ image: stylex.props(styles.thumbImage).className }}
+ preview={false}
+ src={attachment.url}
+ />
{!disabled && (
<button
aria-label={t('acceptance.review.removeAttachment')}
- className={cx('acceptance-attach-remove', styles.remove)}
type={'button'}
+ {...stylex.props(styles.remove)}
onClick={() => onRemove(attachment.id)}
>
<Icon icon={X} size={12} />
@@ -231,7 +207,7 @@ export const AttachmentStrip = memo<AttachmentStripProps>(
</div>
))}
{uploading && (
- <div className={cx(styles.thumb, styles.thumbLoading)}>
+ <div {...stylex.props(styles.thumb, styles.thumbLoading)}>
<Spin size="small" />
</div>
)}
@@ -256,7 +232,7 @@ export const AttachmentUploadButton = memo<AttachmentUploadButtonProps>(({ disab
<Upload
multiple
accept={'image/*'}
- className={styles.flushUpload}
+ {...stylex.props(styles.flushUpload)}
disabled={disabled}
onFiles={onFiles}
>
@@ -299,10 +275,17 @@ export const AttachmentThumbs = memo<AttachmentThumbsProps>(({ attachments, size
>
{usable.map((attachment) => (
<div
- className={cx(styles.thumb, size === 'comment' && styles.thumbLarge)}
key={attachment.id}
+ {...stylex.props(styles.thumb, size === 'comment' && styles.thumbLarge)}
>
- <Image alt={attachment.name ?? ''} src={attachment.url!} />
+ <Image
+ alt={attachment.name ?? ''}
+ src={attachment.url!}
+ classNames={{
+ image: stylex.props(styles.thumbImage, size === 'comment' && styles.thumbImageLarge)
+ .className,
+ }}
+ />
</div>
))}
</Flexbox>
diff --git a/src/features/Acceptance/Viewer/Evidence/styles.ts b/src/features/Acceptance/Viewer/Evidence/styles.ts
index 9479c927a68..f3a2d6381b9 100644
--- a/src/features/Acceptance/Viewer/Evidence/styles.ts
+++ b/src/features/Acceptance/Viewer/Evidence/styles.ts
@@ -1,31 +1,30 @@
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
-export const styles = createStaticStyles(({ css }) => ({
- caption: css`
- align-self: center;
- font-size: 12px;
- color: ${cssVar.colorTextTertiary};
- `,
- evidenceImage: css`
- overflow: hidden;
-
- width: fit-content;
- max-width: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- evidenceText: css`
- overflow: auto;
-
- max-height: 200px;
- padding-block: 8px;
- padding-inline: 12px;
- border-radius: ${cssVar.borderRadius};
-
- font-family: ${cssVar.fontFamilyCode};
- font-size: 12px;
- white-space: pre-wrap;
-
- background: ${cssVar.colorFillQuaternary};
- `,
-}));
+export const styles = stylex.create({
+ caption: {
+ alignSelf: 'center',
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
+ evidenceImage: {
+ overflow: 'hidden',
+ width: 'fit-content',
+ maxWidth: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ evidenceText: {
+ overflow: 'auto',
+ maxHeight: '200px',
+ paddingBlock: '8px',
+ paddingInline: '12px',
+ borderRadius: cssVar.borderRadius,
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '12px',
+ whiteSpace: 'pre-wrap',
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+});
diff --git a/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx
index edc6b41b98e..72927f70052 100644
--- a/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx
+++ b/src/features/Acceptance/Viewer/Flow/AcceptanceFlow.tsx
@@ -5,8 +5,6 @@ import '@xyflow/react/dist/style.css';
import {
ActionIcon,
Button,
- createStaticStyles,
- cssVar,
Empty,
Flexbox,
Select,
@@ -14,12 +12,16 @@ import {
useAppElement,
useResponsive,
} from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { MarkerType, ReactFlowProvider } from '@xyflow/react';
import { Maximize2, Minimize2 } from 'lucide-react';
import { use, useEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom';
import { useTranslation } from 'react-i18next';
+import { sx } from '@/styles/sx';
+
import { useAcceptanceScope } from '../AcceptanceScope';
import { acceptanceContentLayout } from '../layout';
import { AcceptancePlanReview } from '../Plan/AcceptancePlanReview';
@@ -33,62 +35,56 @@ import { FlowOutline } from './FlowOutline';
import { FlowPanelHostContext } from './FlowPanelHost';
import { FlowResults } from './FlowResults';
-const styles = createStaticStyles(({ css }) => ({
+const narrow = '@media (width <= 640px)';
+
+// The page's text measure, from the shared layout constants StyleX cannot read.
+const contentMeasure = acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline;
+
+const styles = stylex.create({
// Fullscreen is a two-column shell, the same shape the page uses: the details
// rail owns the full height of the right edge and the toolbar belongs to the
// canvas beside it, not to a band stretched across both.
- fullscreen: css`
- position: fixed;
- z-index: ${cssVar.zIndexPopupBase};
- inset: 0;
- background: ${cssVar.colorBgContainer};
-
- @media (width <= 640px) {
- flex-direction: column;
- }
- `,
- stage: css`
- min-width: 0;
- min-height: 0;
- padding: 16px;
- `,
- details: css`
- overflow: hidden;
- flex: none;
-
- width: min(440px, 42%);
- height: 100%;
- min-height: 0;
-
- @media (width <= 640px) {
- width: 100%;
- height: 40%;
- }
- `,
- workspace: css`
- min-width: 0;
- min-height: 0;
-
- @media (width <= 640px) {
- flex-direction: column;
- }
- `,
- toolbar: css`
- width: 100%;
- max-width: ${acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline}px;
- margin-inline: auto;
- `,
+ fullscreen: {
+ position: 'fixed',
+ zIndex: cssVar.zIndexPopupBase,
+ insetBlockStart: 0,
+ insetBlockEnd: 0,
+ insetInlineStart: 0,
+ insetInlineEnd: 0,
+ backgroundColor: cssVar.colorBgContainer,
+ flexDirection: { default: null, [narrow]: 'column' },
+ },
+ stage: {
+ minWidth: 0,
+ minHeight: 0,
+ padding: '16px',
+ },
+ details: {
+ overflow: 'hidden',
+ flex: 'none',
+ width: { default: 'min(440px, 42%)', [narrow]: '100%' },
+ height: { default: '100%', [narrow]: '40%' },
+ minHeight: 0,
+ },
+ workspace: {
+ minWidth: 0,
+ minHeight: 0,
+ flexDirection: { default: null, [narrow]: 'column' },
+ },
+ toolbar: {
+ width: '100%',
+ marginInline: 'auto',
+ },
// The outline is reading material, so it keeps the page's text measure while
// the canvas next to it is allowed the full width.
- outline: css`
- overflow: auto;
+ outline: {
+ overflow: 'auto',
+ width: '100%',
+ minWidth: 0,
+ marginInline: 'auto',
+ },
+});
- width: 100%;
- min-width: 0;
- max-width: ${acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline}px;
- margin-inline: auto;
- `,
-}));
const nodeTypes = { state: FlowNode, flowGroup: FlowGroup };
export function AcceptanceFlow() {
@@ -198,17 +194,17 @@ export function AcceptanceFlow() {
) : null;
const stage = (
<Flexbox
- className={fullscreen ? styles.stage : undefined}
flex={fullscreen ? 1 : undefined}
gap={16}
+ {...stylex.props(fullscreen && styles.stage)}
>
<Flexbox
horizontal
align="center"
- className={styles.toolbar}
gap={8}
justify="space-between"
wrap="wrap"
+ {...sx(styles.toolbar, { maxWidth: contentMeasure })}
>
<Flexbox horizontal align="center" gap={4}>
<Button size="small" type="text" onClick={() => setFocus(undefined)}>
@@ -258,9 +254,9 @@ export function AcceptanceFlow() {
/>
</Flexbox>
</Flexbox>
- <Flexbox horizontal className={styles.workspace} flex={fullscreen ? 1 : undefined}>
+ <Flexbox horizontal flex={fullscreen ? 1 : undefined} {...stylex.props(styles.workspace)}>
{showOutline ? (
- <Flexbox className={styles.outline} flex={1}>
+ <Flexbox flex={1} {...sx(styles.outline, { maxWidth: contentMeasure })}>
<FlowOutline edges={graphEdges} nodes={graph.nodes} onSelect={setSelected} />
</Flexbox>
) : (
@@ -281,9 +277,9 @@ export function AcceptanceFlow() {
);
if (!fullscreen) return stage;
return createPortal(
- <Flexbox horizontal className={styles.fullscreen}>
+ <Flexbox horizontal {...stylex.props(styles.fullscreen)}>
{stage}
- {results && <Flexbox className={styles.details}>{results}</Flexbox>}
+ {results && <Flexbox {...stylex.props(styles.details)}>{results}</Flexbox>}
</Flexbox>,
appElement ?? document.body,
);
diff --git a/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx b/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx
index 23fa5473a42..9a311d716d1 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowCanvas.tsx
@@ -1,4 +1,7 @@
-import { createStaticStyles, cssVar, Flexbox } from '@lobehub/ui';
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- @xyflow/react edge labels and control buttons take no className
+import { createStaticStyles, Flexbox } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import {
Background,
Controls,
@@ -13,6 +16,7 @@ import { useEffect, useRef } from 'react';
import { observeWidth } from '@/features/AgentGoals/ProcessControl/Graph/useFitViewOnResize';
import { useSingleton } from '@/hooks/useSingleton';
+import { sx } from '@/styles/sx';
import { FlowAnchorContext } from './flowAnchor';
import { FlowEdge } from './FlowEdge';
@@ -22,18 +26,21 @@ import { getSelectedFlowNodeId, panNodeIntoView } from './flowViewport';
const edgeTypes = { transition: FlowEdge };
const fitOptions = { maxZoom: 1, minZoom: 0.65, padding: 0.08 };
-const styles = createStaticStyles(({ css }) => ({
- canvas: css`
- overflow: hidden;
- flex: none;
-
- width: 100%;
- min-width: 0;
- height: clamp(520px, calc(100dvh - 400px), 900px);
- border-radius: ${cssVar.borderRadiusLG};
-
- background: transparent;
+const styles = stylex.create({
+ canvas: {
+ overflow: 'hidden',
+ flex: 'none',
+ width: '100%',
+ minWidth: 0,
+ height: 'clamp(520px, calc(100dvh - 400px), 900px)',
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ },
+});
+const fallback = createStaticStyles(({ css, cssVar }) => ({
+ canvas: css`
.react-flow__edgelabel-renderer {
z-index: 5;
}
@@ -125,9 +132,12 @@ export function FlowCanvas({
// anchor channel has to sit above the canvas to reach a group's toggle.
<FlowAnchorContext value={anchor}>
<Flexbox
- className={styles.canvas}
ref={ref}
- style={fullscreen ? { flex: 1, height: '100%', minHeight: 0 } : undefined}
+ {...sx(
+ styles.canvas,
+ fallback.canvas,
+ fullscreen ? { flex: 1, height: '100%', minHeight: 0 } : undefined,
+ )}
>
<ReactFlow
fitView
diff --git a/src/features/Acceptance/Viewer/Flow/FlowEdge.tsx b/src/features/Acceptance/Viewer/Flow/FlowEdge.tsx
index cc156d00b3d..ebf20182480 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowEdge.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowEdge.tsx
@@ -1,43 +1,32 @@
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import type { Edge, EdgeProps } from '@xyflow/react';
import { BaseEdge, EdgeLabelRenderer, getSmoothStepPath } from '@xyflow/react';
import { getFlowEdgeLabelLayout } from './flowEdgeLabel';
-const styles = createStaticStyles(({ css }) => ({
- // The caption reads the branch condition out; it is not a control. Clicking it
- // used to open the details panel, which narrows the canvas and shifts the page
- // column, so the caption moved out from under the pointer as if it had gone.
- // Clicks fall through to the canvas instead; the state card is the way in.
- label: css`
- pointer-events: none;
-
- position: absolute;
-
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 5;
-
- max-width: 200px;
- max-height: 94px;
- padding-block: 5px;
- padding-inline: 10px;
- border-radius: 8px;
-
- font-size: 12px;
- line-height: 18px;
- color: ${cssVar.colorTextSecondary};
- overflow-wrap: anywhere;
- white-space: normal;
-
- /* Filled, and opaque in both themes: the fill token is translucent, so it
- is layered over a solid surface rather than over the edge running
- underneath, which would otherwise strike the text through. */
- background-color: ${cssVar.colorBgContainer};
- background-image: linear-gradient(${cssVar.colorFillQuaternary}, ${cssVar.colorFillQuaternary});
- `,
-}));
+const styles = stylex.create({
+ label: {
+ pointerEvents: 'none',
+ position: 'absolute',
+ overflow: 'hidden',
+ display: '-webkit-box',
+ WebkitBoxOrient: 'vertical',
+ WebkitLineClamp: '5',
+ maxWidth: '200px',
+ maxHeight: '94px',
+ paddingBlock: '5px',
+ paddingInline: '10px',
+ borderRadius: '8px',
+ fontSize: '12px',
+ lineHeight: '18px',
+ color: cssVar.colorTextSecondary,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'normal',
+ backgroundColor: cssVar.colorBgContainer,
+ backgroundImage: `linear-gradient(${cssVar.colorFillQuaternary}, ${cssVar.colorFillQuaternary})`,
+ },
+});
type TransitionEdge = Edge<{ laneOffset?: number }>;
@@ -57,7 +46,7 @@ export function FlowEdge(props: EdgeProps<TransitionEdge>) {
<BaseEdge id={props.id} markerEnd={props.markerEnd} path={path} style={props.style} />
<EdgeLabelRenderer>
<div
- className={styles.label}
+ className={stylex.props(styles.label).className}
style={{
maxWidth: label.maxWidth,
transform: `translate(-50%, -50%) translate(${label.x}px, ${label.y}px)`,
diff --git a/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx
index db9173cb038..c94de41c2d4 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowGroup.tsx
@@ -1,4 +1,6 @@
-import { Button, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Handle, Position, useNodeId } from '@xyflow/react';
import {
CheckCircle2,
@@ -18,63 +20,53 @@ import { FlowAnchorContext } from './flowAnchor';
import type { FlowGraphData } from './flowGraph';
import { flowStateBackground, flowStateColor } from './FlowNode';
-const styles = createStaticStyles(({ css }) => ({
- group: css`
- overflow: hidden;
-
- width: 100%;
- height: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
- `,
- header: css`
- height: 36px;
- padding-inline: 16px;
- background: transparent;
- `,
- collapsed: css`
- cursor: pointer;
- height: 100%;
- padding-block: 12px;
- padding-inline: 12px;
- `,
- glyph: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 36px;
- height: 36px;
- border-radius: ${cssVar.borderRadius};
- `,
- title: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-
- font-size: 13px;
- font-weight: 500;
- line-height: 1.4;
- `,
- summary: css`
- font-size: 11px;
- line-height: 16px;
- color: ${cssVar.colorTextTertiary};
- `,
- handle: css`
- width: 1px;
- min-width: 0;
- height: 1px;
- min-height: 0;
- border: 0;
-
- opacity: 0;
- `,
-}));
+const styles = stylex.create({
+ group: {
+ overflow: 'hidden',
+ width: '100%',
+ height: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgContainer,
+ backgroundImage: 'none',
+ },
+ header: {
+ height: '36px',
+ paddingInline: '16px',
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ },
+ collapsed: { cursor: 'pointer', height: '100%', paddingBlock: '12px', paddingInline: '12px' },
+ glyph: {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '36px',
+ height: '36px',
+ borderRadius: cssVar.borderRadius,
+ },
+ title: {
+ overflow: 'hidden',
+ display: '-webkit-box',
+ WebkitBoxOrient: 'vertical',
+ WebkitLineClamp: '2',
+ fontSize: '13px',
+ fontWeight: 500,
+ lineHeight: 1.4,
+ },
+ summary: { fontSize: '11px', lineHeight: '16px', color: cssVar.colorTextTertiary },
+ handle: {
+ width: '1px',
+ minWidth: '0',
+ height: '1px',
+ minHeight: '0',
+ borderStyle: 'none',
+ opacity: 0,
+ },
+});
export function FlowGroup({ data }: { data: FlowGraphData }) {
const { t } = useTranslation('verify');
@@ -100,20 +92,25 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {
: CircleDashed;
return (
<>
- <Handle className={styles.handle} id="in" position={Position.Left} type="target" />
- <div className={styles.group}>
+ <Handle
+ className={stylex.props(styles.handle).className}
+ id="in"
+ position={Position.Left}
+ type="target"
+ />
+ <div {...stylex.props(styles.group)}>
{data.collapsed ? (
<Flexbox
horizontal
align="flex-start"
- className={styles.collapsed}
+ className={stylex.props(styles.collapsed).className}
gap={10}
role="button"
onClick={toggle}
>
<div
aria-label={t(`flow.state.${data.state ?? 'pending'}`)}
- className={styles.glyph}
+ className={stylex.props(styles.glyph).className}
role="img"
style={{
background: flowStateBackground(data.state),
@@ -123,8 +120,8 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {
<Icon icon={statusIcon} size={24} />
</div>
<Flexbox flex={1} gap={3} style={{ minWidth: 0 }}>
- <span className={styles.title}>{data.title}</span>
- <span className={styles.summary}>
+ <span {...stylex.props(styles.title)}>{data.title}</span>
+ <span {...stylex.props(styles.summary)}>
{`${data.passed}/${data.total} · ${t(`flow.state.${data.state ?? 'pending'}`)}`}
{Boolean(data.reviewed) &&
` · ${t('flow.groupReviewed', { count: data.reviewed })}`}
@@ -159,7 +156,12 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {
</Flexbox>
</Flexbox>
) : (
- <Flexbox horizontal align="center" className={styles.header} gap={8}>
+ <Flexbox
+ horizontal
+ align="center"
+ className={stylex.props(styles.header).className}
+ gap={8}
+ >
{data.onToggle && (
<Button
aria-label={t('flow.collapseGroup', { title: data.title })}
@@ -200,18 +202,33 @@ export function FlowGroup({ data }: { data: FlowGraphData }) {
</Flexbox>
)}
</div>
- <Handle className={styles.handle} id="stack-in" position={Position.Top} type="target" />
- <Handle className={styles.handle} id="stack-out" position={Position.Bottom} type="source" />
- <Handle className={styles.handle} id="out" position={Position.Right} type="source" />
<Handle
- className={styles.handle}
+ className={stylex.props(styles.handle).className}
+ id="stack-in"
+ position={Position.Top}
+ type="target"
+ />
+ <Handle
+ className={stylex.props(styles.handle).className}
+ id="stack-out"
+ position={Position.Bottom}
+ type="source"
+ />
+ <Handle
+ className={stylex.props(styles.handle).className}
+ id="out"
+ position={Position.Right}
+ type="source"
+ />
+ <Handle
+ className={stylex.props(styles.handle).className}
id="return-in"
position={Position.Bottom}
style={{ left: '35%' }}
type="target"
/>
<Handle
- className={styles.handle}
+ className={stylex.props(styles.handle).className}
id="return-out"
position={Position.Bottom}
style={{ left: '65%' }}
diff --git a/src/features/Acceptance/Viewer/Flow/FlowNode.tsx b/src/features/Acceptance/Viewer/Flow/FlowNode.tsx
index 177514dfc13..f1dfabf0b35 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowNode.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowNode.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createStaticStyles, cssVar, cx, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { Handle, Position } from '@xyflow/react';
import {
CheckCircle2,
@@ -41,88 +43,75 @@ export const flowStateColor = (state?: string) =>
? cssVar.colorWarning
: cssVar.colorTextTertiary;
-const styles = createStaticStyles(({ css }) => ({
- card: css`
- overflow: hidden;
- display: flex;
- flex-direction: column;
-
- width: 260px;
- height: 100%;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
-
- background: ${cssVar.colorBgContainer};
-
- transition:
- border-color 0.15s,
- box-shadow 0.15s;
-
- &:hover {
- border-color: ${cssVar.colorPrimaryBorder};
- }
- `,
- selected: css`
- border-color: ${cssVar.colorPrimaryBorder};
- box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};
- `,
- head: css`
- padding-block: 12px;
- padding-inline: 12px;
- `,
- glyph: css`
- display: flex;
- flex: none;
- align-items: center;
- justify-content: center;
-
- width: 36px;
- height: 36px;
- border-radius: ${cssVar.borderRadius};
-
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillTertiary};
- `,
- title: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-
- font-size: 13px;
- font-weight: 500;
- line-height: 1.4;
- `,
- subtitle: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 2;
-
- font-size: 11px;
- line-height: 16px;
- color: ${cssVar.colorTextTertiary};
- `,
- footer: css`
- margin-block-start: auto;
- padding-block: 7px;
- padding-inline: 12px;
- border-block-start: 1px dashed ${cssVar.colorBorderSecondary};
-
- font-size: 11px;
- color: ${cssVar.colorTextTertiary};
- `,
- handle: css`
- width: 1px;
- min-width: 0;
- height: 1px;
- min-height: 0;
- border: none;
-
- opacity: 0;
- `,
-}));
+const styles = stylex.create({
+ card: {
+ overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column',
+ width: '260px',
+ height: '100%',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorPrimaryBorder },
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgContainer,
+ backgroundImage: 'none',
+ transition: 'border-color 0.15s,\n box-shadow 0.15s',
+ },
+ selected: {
+ borderColor: cssVar.colorPrimaryBorder,
+ boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,
+ },
+ head: { paddingBlock: '12px', paddingInline: '12px' },
+ glyph: {
+ display: 'flex',
+ flex: 'none',
+ alignItems: 'center',
+ justifyContent: 'center',
+ width: '36px',
+ height: '36px',
+ borderRadius: cssVar.borderRadius,
+ color: cssVar.colorTextSecondary,
+ backgroundColor: cssVar.colorFillTertiary,
+ backgroundImage: 'none',
+ },
+ title: {
+ overflow: 'hidden',
+ display: '-webkit-box',
+ WebkitBoxOrient: 'vertical',
+ WebkitLineClamp: '2',
+ fontSize: '13px',
+ fontWeight: 500,
+ lineHeight: 1.4,
+ },
+ subtitle: {
+ overflow: 'hidden',
+ display: '-webkit-box',
+ WebkitBoxOrient: 'vertical',
+ WebkitLineClamp: '2',
+ fontSize: '11px',
+ lineHeight: '16px',
+ color: cssVar.colorTextTertiary,
+ },
+ footer: {
+ marginBlockStart: 'auto',
+ paddingBlock: '7px',
+ paddingInline: '12px',
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'dashed',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ fontSize: '11px',
+ color: cssVar.colorTextTertiary,
+ },
+ handle: {
+ width: '1px',
+ minWidth: '0',
+ height: '1px',
+ minHeight: '0',
+ borderStyle: 'none',
+ opacity: 0,
+ },
+});
/** Same status/head/summary hierarchy as Goal's exploration cards. */
export function FlowNode({ data }: { data: FlowNodeData }) {
@@ -141,12 +130,17 @@ export function FlowNode({ data }: { data: FlowNodeData }) {
: CircleDashed;
return (
<>
- <Handle className={styles.handle} id="in" position={Position.Left} type="target" />
- <div className={cx(styles.card, data.selected && styles.selected)}>
- <Flexbox horizontal className={styles.head} gap={10}>
+ <Handle
+ className={stylex.props(styles.handle).className}
+ id="in"
+ position={Position.Left}
+ type="target"
+ />
+ <div {...stylex.props(styles.card, data.selected && styles.selected)}>
+ <Flexbox horizontal className={stylex.props(styles.head).className} gap={10}>
<div
aria-label={t(`flow.state.${data.state ?? 'pending'}`)}
- className={styles.glyph}
+ className={stylex.props(styles.glyph).className}
role="img"
style={{
background: flowStateBackground(data.state),
@@ -156,11 +150,16 @@ export function FlowNode({ data }: { data: FlowNodeData }) {
<Icon icon={statusIcon} size={24} />
</div>
<Flexbox gap={3} style={{ minWidth: 0 }}>
- <span className={styles.title}>{data.title}</span>
- <span className={styles.subtitle}>{data.expected}</span>
+ <span {...stylex.props(styles.title)}>{data.title}</span>
+ <span {...stylex.props(styles.subtitle)}>{data.expected}</span>
</Flexbox>
</Flexbox>
- <Flexbox horizontal align="center" className={styles.footer} gap={12}>
+ <Flexbox
+ horizontal
+ align="center"
+ className={stylex.props(styles.footer).className}
+ gap={12}
+ >
<Flexbox horizontal align="center" gap={4}>
<Icon icon={Repeat2} size={12} />
{data.attempts}
@@ -171,16 +170,21 @@ export function FlowNode({ data }: { data: FlowNodeData }) {
</Flexbox>
</Flexbox>
</div>
- <Handle className={styles.handle} id="out" position={Position.Right} type="source" />
<Handle
- className={styles.handle}
+ className={stylex.props(styles.handle).className}
+ id="out"
+ position={Position.Right}
+ type="source"
+ />
+ <Handle
+ className={stylex.props(styles.handle).className}
id="return-in"
position={Position.Bottom}
style={{ left: '35%' }}
type="target"
/>
<Handle
- className={styles.handle}
+ className={stylex.props(styles.handle).className}
id="return-out"
position={Position.Bottom}
style={{ left: '65%' }}
diff --git a/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx b/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx
index 977afa4a1a5..107bb8a96c2 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowOutline.tsx
@@ -1,4 +1,6 @@
-import { Button, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import type { Edge, Node } from '@xyflow/react';
import {
ArrowRight,
@@ -18,49 +20,38 @@ import type { FlowGraphData } from './flowGraph';
import { flowStateColor } from './FlowNode';
import { buildOutlineTree, type OutlineBranch, type OutlineStep } from './flowOutlineTree';
-const styles = createStaticStyles(({ css }) => ({
- item: css`
- width: 100%;
- height: auto;
- min-height: 36px;
- padding-block: 6px;
- padding-inline: 12px;
-
- text-align: start;
- white-space: normal;
- `,
- // A branch is the condition for reaching the next step, not a step of its own.
- // Row-width and body-size type made it read as one more item in the list, so
- // it shrinks to caption scale and hugs its own text.
- branch: css`
- justify-content: flex-start;
-
- width: fit-content;
- max-width: 100%;
- height: auto;
- min-height: 24px;
-
- /* Same inline padding as a step row, so the branch glyph sits on the same
- axis as the status glyphs above and below it. */
- padding-block: 2px;
- padding-inline: 12px;
-
- font-size: 12px;
- line-height: 18px;
- text-align: start;
- white-space: normal;
- `,
- // The button carries its own colour rule, so the caption tone has to sit on
- // the content it wraps.
- branchContent: css`
- color: ${cssVar.colorTextTertiary};
- `,
- nested: css`
- margin-inline-start: 18px;
- padding-inline-start: 8px;
- border-inline-start: 1px solid ${cssVar.colorBorderSecondary};
- `,
-}));
+const styles = stylex.create({
+ item: {
+ width: '100%',
+ height: 'auto',
+ minHeight: '36px',
+ paddingBlock: '6px',
+ paddingInline: '12px',
+ textAlign: 'start',
+ whiteSpace: 'normal',
+ },
+ branch: {
+ justifyContent: 'flex-start',
+ width: 'fit-content',
+ maxWidth: '100%',
+ height: 'auto',
+ minHeight: '24px',
+ paddingBlock: '2px',
+ paddingInline: '12px',
+ fontSize: '12px',
+ lineHeight: '18px',
+ textAlign: 'start',
+ whiteSpace: 'normal',
+ },
+ branchContent: { color: cssVar.colorTextTertiary },
+ nested: {
+ marginInlineStart: '18px',
+ paddingInlineStart: '8px',
+ borderInlineStartWidth: '1px',
+ borderInlineStartStyle: 'solid',
+ borderInlineStartColor: cssVar.colorBorderSecondary,
+ },
+});
/** A readable traversal of the same graph: dependent steps are indented under the branch that leads to them. */
export function FlowOutline({
@@ -91,7 +82,7 @@ export function FlowOutline({
return (
<Button
aria-expanded={group ? !data.collapsed : undefined}
- className={styles.item}
+ className={stylex.props(styles.item).className}
type={data.selected ? 'default' : 'text'}
onClick={() => (group ? data.onToggle?.() : onSelect(node.id))}
>
@@ -123,14 +114,19 @@ export function FlowOutline({
if (!reference && (!label || label === branch.target.data.title)) return null;
return (
<Button
- className={styles.branch}
+ className={stylex.props(styles.branch).className}
key={branch.edge.id}
type="text"
onClick={() => onSelect(branch.edge.id)}
>
{/* Top-aligned: a caption that wraps keeps its glyph on the first line and
its later lines under the text, not under the glyph. */}
- <Flexbox horizontal align="flex-start" className={styles.branchContent} gap={6}>
+ <Flexbox
+ horizontal
+ align="flex-start"
+ className={stylex.props(styles.branchContent).className}
+ gap={6}
+ >
<Icon
icon={reference ? ArrowRight : CornerDownRight}
size={12}
@@ -147,7 +143,7 @@ export function FlowOutline({
<Flexbox gap={2} key={step.node.id}>
{renderItem(step.node)}
{step.node.type === 'flowGroup' && !step.node.data.collapsed && (
- <Flexbox className={styles.nested} gap={2}>
+ <Flexbox className={stylex.props(styles.nested).className} gap={2}>
{step.members.flatMap(renderSequence)}
</Flexbox>
)}
@@ -166,7 +162,7 @@ export function FlowOutline({
out.push(
<Flexbox gap={2} key={`branch:${branch.edge.id}`}>
{label}
- <Flexbox className={styles.nested} gap={2}>
+ <Flexbox className={stylex.props(styles.nested).className} gap={2}>
{steps}
</Flexbox>
</Flexbox>,
diff --git a/src/features/Acceptance/Viewer/Flow/FlowResults.tsx b/src/features/Acceptance/Viewer/Flow/FlowResults.tsx
index 17bfbed47ce..37d70f8c5b6 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowResults.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowResults.tsx
@@ -1,17 +1,8 @@
'use client';
-import {
- ActionIcon,
- Button,
- createStaticStyles,
- cssVar,
- Flexbox,
- Icon,
- Select,
- Text,
- TextArea,
- toast,
-} from '@lobehub/ui';
+import { ActionIcon, Button, Flexbox, Icon, Select, Text, TextArea, toast } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ClipboardCheck, History, X } from 'lucide-react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,45 +17,48 @@ import { flowStateColor } from './FlowNode';
type FlowVersion = AcceptanceBundle['flows'][number]['versions'][number];
type FlowAttempt = FlowVersion['runs'][number]['attempts'][number];
-const styles = createStaticStyles(({ css }) => ({
- panel: css`
- overflow: hidden;
-
- width: 100%;
- height: 100%;
- min-height: 0;
- border-inline-start: 1px solid ${cssVar.colorBorderSecondary};
-
- background: ${cssVar.colorBgContainer};
- `,
- header: css`
- padding: 16px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
- body: css`
- overflow: auto;
- min-height: 0;
- padding: 16px;
- `,
- plan: css`
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
-
- summary {
- cursor: pointer;
- padding-block: 6px;
- }
- `,
- observation: css`
- line-height: 1.7;
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
- review: css`
- padding-block-start: 16px;
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
- `,
-}));
+const styles = stylex.create({
+ panel: {
+ overflow: 'hidden',
+ width: '100%',
+ height: '100%',
+ minHeight: 0,
+ borderInlineStartWidth: '1px',
+ borderInlineStartStyle: 'solid',
+ borderInlineStartColor: cssVar.colorBorderSecondary,
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ header: {
+ padding: '16px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ },
+ body: {
+ overflow: 'auto',
+ minHeight: 0,
+ padding: '16px',
+ },
+ plan: {
+ fontSize: '12px',
+ color: cssVar.colorTextSecondary,
+ },
+ planSummary: {
+ cursor: 'pointer',
+ paddingBlock: '6px',
+ },
+ observation: {
+ lineHeight: 1.7,
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
+ review: {
+ paddingBlockStart: '16px',
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+});
function AttemptReview({
acceptanceId,
@@ -80,7 +74,7 @@ function AttemptReview({
const [comment, setComment] = useState(attempt.reviewComment ?? '');
const [saving, setSaving] = useState(false);
return (
- <Flexbox className={styles.review} gap={10}>
+ <Flexbox gap={10} {...stylex.props(styles.review)}>
{attempt.review && (
<Text>
{t(`flow.review.${attempt.review}`)}
@@ -209,8 +203,14 @@ export function FlowResults({
annotation,
]);
return (
- <Flexbox className={styles.panel}>
- <Flexbox horizontal align="center" className={styles.header} gap={12} justify="space-between">
+ <Flexbox {...stylex.props(styles.panel)}>
+ <Flexbox
+ horizontal
+ align="center"
+ gap={12}
+ justify="space-between"
+ {...stylex.props(styles.header)}
+ >
<Flexbox horizontal align="center" gap={10} wrap="wrap">
<Text strong fontSize={16}>
{node.title}
@@ -231,7 +231,7 @@ export function FlowResults({
onClick={onClose}
/>
</Flexbox>
- <Flexbox className={styles.body} gap={16}>
+ <Flexbox gap={16} {...stylex.props(styles.body)}>
{selectedEdge && (
<Text type="secondary">
{selectedEdge.trigger}
@@ -260,7 +260,7 @@ export function FlowResults({
<Text fontSize={12} type="secondary">
{t('flow.actual')}
</Text>
- <Text className={styles.observation}>{attempt.observation}</Text>
+ <Text {...stylex.props(styles.observation)}>{attempt.observation}</Text>
</Flexbox>
</>
) : (
@@ -272,8 +272,8 @@ export function FlowResults({
</Text>
<Text>{node.expected}</Text>
</Flexbox>
- <details className={styles.plan} open={!attempt}>
- <summary>{t('flow.instruction')}</summary>
+ <details {...stylex.props(styles.plan)} open={!attempt}>
+ <summary {...stylex.props(styles.planSummary)}>{t('flow.instruction')}</summary>
<Text>{node.instruction}</Text>
</details>
{attempt && (
diff --git a/src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsx b/src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsx
index 74a00644baa..5ca24ea37e4 100644
--- a/src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsx
+++ b/src/features/Acceptance/Viewer/Flow/FlowVersionDiff.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createModal, createStaticStyles, cssVar, Flexbox, Select, Text } from '@lobehub/ui';
+import { createModal, Flexbox, Select, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { t } from 'i18next';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -10,24 +12,22 @@ import type { AcceptanceBundle } from '@/services/verify';
import { diffFlowVersions } from './flowDiff';
type Version = AcceptanceBundle['flows'][number]['versions'][number];
-const styles = createStaticStyles(({ css }) => ({
- body: css`
- overflow: auto;
- max-height: 70dvh;
- `,
- change: css`
- padding-block: 16px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- `,
- field: css`
- display: grid;
- grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr);
- gap: 12px;
-
- overflow-wrap: anywhere;
- white-space: pre-wrap;
- `,
-}));
+const styles = stylex.create({
+ body: { overflow: 'auto', maxHeight: '70dvh' },
+ change: {
+ paddingBlock: '16px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ },
+ field: {
+ display: 'grid',
+ gridTemplateColumns: '120px minmax(0, 1fr) minmax(0, 1fr)',
+ gap: '12px',
+ overflowWrap: 'anywhere',
+ whiteSpace: 'pre-wrap',
+ },
+});
function FlowVersionDiff({ versions, selectedId }: { versions: Version[]; selectedId: string }) {
const { t } = useTranslation('verify');
@@ -66,10 +66,14 @@ function FlowVersionDiff({ versions, selectedId }: { versions: Version[]; select
/>
</Flexbox>
<Text type="secondary">{t('flow.diff.hint')}</Text>
- <Flexbox className={styles.body}>
+ <Flexbox className={stylex.props(styles.body).className}>
{changes.length === 0 && <Text>{t('flow.diff.empty')}</Text>}
{changes.map((change) => (
- <Flexbox className={styles.change} gap={12} key={`${change.kind}:${change.key}`}>
+ <Flexbox
+ className={stylex.props(styles.change).className}
+ gap={12}
+ key={`${change.kind}:${change.key}`}
+ >
<Flexbox horizontal gap={8}>
<Text
style={{
@@ -87,7 +91,7 @@ function FlowVersionDiff({ versions, selectedId }: { versions: Version[]; select
<Text strong>{change.title}</Text>
</Flexbox>
{change.fields.map((value) => (
- <div className={styles.field} key={value.field}>
+ <div {...stylex.props(styles.field)} key={value.field}>
<Text type="secondary">{t(`flow.diff.fields.${value.field}`)}</Text>
<Text style={{ color: cssVar.colorTextSecondary }}>
{displayValue(value.before, value.field, before)}
diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx
index ac166628e4b..2531b3de578 100644
--- a/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx
+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceEnterFocus.tsx
@@ -1,6 +1,7 @@
'use client';
-import { Button, createStaticStyles, Icon } from '@lobehub/ui';
+import { Button, Icon } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { ChevronRight } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router';
@@ -13,13 +14,9 @@ import { checksForTurn } from '../turnChecks';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { readAcceptanceTurn } from '../useAcceptanceTurn';
-const styles = createStaticStyles(({ css }) => ({
- button: css`
- @media (width <= 767px) {
- display: none;
- }
- `,
-}));
+const styles = stylex.create({
+ button: { display: { 'default': null, '@media (width <= 767px)': 'none' } },
+});
const AcceptanceEnterFocus = () => {
const { t } = useTranslation('verify');
@@ -33,7 +30,7 @@ const AcceptanceEnterFocus = () => {
return (
<Button
- className={styles.button}
+ className={stylex.props(styles.button).className}
icon={<Icon icon={ChevronRight} size={14} />}
size={'small'}
style={{ alignSelf: 'center' }}
diff --git a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
index d2923f6e31c..f7ec1d2ca63 100644
--- a/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
+++ b/src/features/Acceptance/Viewer/Focus/AcceptanceFocusReview.tsx
@@ -1,15 +1,9 @@
'use client';
import type { AcceptanceChecklistItem } from '@lobechat/types';
-import {
- Button,
- createStaticStyles,
- cssVar,
- Flexbox,
- Icon,
- Text,
- useResponsive,
-} from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text, useResponsive } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ArrowLeft, ChevronDown, ChevronLeft, ChevronRight, Plus } from 'lucide-react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -20,94 +14,70 @@ import {
type ProposalDismissInput,
} from '../Checks/types';
import AcceptanceStatusPill from '../Header/AcceptanceStatusPill';
-import { acceptanceFocusedLayout, acceptanceScrollLayout } from '../layout';
import { FocusCheckHeading } from './FocusCheckHeading';
import { FocusedCheckDetails } from './FocusedCheckDetails';
import { FocusOutline } from './FocusOutline';
-const styles = createStaticStyles(({ css }) => ({
- mobileNavigation: css`
- position: sticky;
- z-index: 2;
- inset-block-start: -16px;
-
- flex: none;
-
- padding-block: 8px;
-
- background: ${cssVar.colorBgContainer};
- `,
- countBadge: css`
- padding-block: 1px;
- padding-inline: 7px;
- border-radius: 99px;
-
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillTertiary};
- `,
- layout: css`
- display: grid;
- grid-template-columns: 320px minmax(0, 1fr);
-
- @media (width > 900px) {
- flex: 1;
- min-height: 0;
- }
-
- @media (width <= 900px) {
- grid-template-columns: 1fr;
- grid-template-rows: auto minmax(0, 1fr);
- flex: 1;
- min-height: 0;
- }
- `,
- outline: css`
- position: sticky;
- inset-block-start: 0;
-
- padding: 8px;
- border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
-
- background: ${cssVar.colorFillQuaternary};
-
- @media (width <= 900px) {
- position: static;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- border-inline-end: 0;
- }
- `,
- outlineList: css`
- overflow: ${acceptanceScrollLayout.paneOverflow};
-
- > * {
- flex-shrink: 0;
- }
-
- @media (width <= 767px) {
- overflow: auto;
- max-height: 40dvh;
- }
- `,
- main: css`
- overflow: ${acceptanceScrollLayout.paneOverflow};
- min-width: 0;
- padding-block: ${acceptanceFocusedLayout.contentPaddingBlock};
- padding-inline: 32px;
+const compact = '@media (width <= 900px)';
+const phone = '@media (width <= 767px)';
- @media (width <= 767px) {
- overflow: auto;
- min-height: 0;
- padding: 16px;
- }
- `,
- content: css`
- flex: none;
- width: min(880px, 100%);
- margin-inline: auto;
- `,
-}));
+// `overflow` and the content's block padding repeat acceptanceScrollLayout.paneOverflow
+// ('visible') and acceptanceFocusedLayout.contentPaddingBlock ('32px 24px') from
+// ../layout: StyleX cannot read constants from another module.
+const styles = stylex.create({
+ mobileNavigation: {
+ position: 'sticky',
+ zIndex: 2,
+ insetBlockStart: '-16px',
+ flex: 'none',
+ paddingBlock: '8px',
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ countBadge: {
+ paddingBlock: '1px',
+ paddingInline: '7px',
+ borderRadius: '99px',
+ fontSize: '12px',
+ color: cssVar.colorTextSecondary,
+ backgroundColor: cssVar.colorFillTertiary,
+ },
+ layout: {
+ display: 'grid',
+ gridTemplateColumns: { default: '320px minmax(0, 1fr)', [compact]: '1fr' },
+ gridTemplateRows: { default: null, [compact]: 'auto minmax(0, 1fr)' },
+ flex: '1',
+ minHeight: 0,
+ },
+ outline: {
+ position: { default: 'sticky', [compact]: 'static' },
+ insetBlockStart: 0,
+ padding: '8px',
+ borderInlineEndWidth: { default: '1px', [compact]: 0 },
+ borderInlineEndStyle: { default: 'solid', [compact]: 'none' },
+ borderInlineEndColor: { default: cssVar.colorBorderSecondary, [compact]: 'currentcolor' },
+ borderBlockEndWidth: { default: null, [compact]: '1px' },
+ borderBlockEndStyle: { default: null, [compact]: 'solid' },
+ borderBlockEndColor: { default: null, [compact]: cssVar.colorBorderSecondary },
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+ outlineList: {
+ overflow: { default: 'visible', [phone]: 'auto' },
+ maxHeight: { default: null, [phone]: '40dvh' },
+ },
+ main: {
+ overflow: { default: 'visible', [phone]: 'auto' },
+ minWidth: 0,
+ minHeight: { default: null, [phone]: 0 },
+ paddingBlockStart: { default: '32px', [phone]: '16px' },
+ paddingBlockEnd: { default: '24px', [phone]: '16px' },
+ paddingInline: { default: '32px', [phone]: '16px' },
+ },
+ content: {
+ flex: 'none',
+ width: 'min(880px, 100%)',
+ marginInline: 'auto',
+ },
+});
interface AcceptanceFocusReviewProps {
canReview: boolean;
@@ -152,8 +122,8 @@ const AcceptanceFocusReview = ({
const currentIndex = orderedChecks.findIndex((check) => check.id === focusedCheck.id);
return (
- <div className={styles.layout}>
- <Flexbox className={styles.outline}>
+ <div {...stylex.props(styles.layout)}>
+ <Flexbox {...stylex.props(styles.outline)}>
{/* The phone top line is a breadcrumb, not a nav bar: it introduces the
check and hands off to the outline. The row below it already owns
44px targets for stepping between checks, so stacking another
@@ -215,7 +185,9 @@ const AcceptanceFocusReview = ({
<Text strong style={{ fontSize: 13 }}>
{t('acceptance.checks.title')}
</Text>
- <span className={styles.countBadge}>{checks.length + standingChecks.length}</span>
+ <span {...stylex.props(styles.countBadge)}>
+ {checks.length + standingChecks.length}
+ </span>
<Flexbox flex={1} />
{onAddChecks && (
<Button
@@ -231,7 +203,7 @@ const AcceptanceFocusReview = ({
)}
</Flexbox>
{(md || outlineOpen) && (
- <Flexbox className={styles.outlineList} flex={1}>
+ <Flexbox flex={1} {...stylex.props(styles.outlineList)}>
<FocusOutline
checks={orderedChecks}
focusedCheckId={focusedCheck.id}
@@ -246,9 +218,9 @@ const AcceptanceFocusReview = ({
)}
</Flexbox>
- <Flexbox className={styles.main} key={focusedCheck.id}>
+ <Flexbox key={focusedCheck.id} {...stylex.props(styles.main)}>
{!md && (
- <Flexbox horizontal align={'center'} className={styles.mobileNavigation} gap={8}>
+ <Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.mobileNavigation)}>
<Button
aria-label={t('acceptance.focus.previous')}
disabled={currentIndex <= 0}
@@ -268,7 +240,7 @@ const AcceptanceFocusReview = ({
/>
</Flexbox>
)}
- <Flexbox className={styles.content} gap={16}>
+ <Flexbox gap={16} {...stylex.props(styles.content)}>
<FocusCheckHeading
check={focusedCheck}
showVerdictDescription={md}
diff --git a/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx b/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx
index 2e61fe3fe8e..cca35b8f76c 100644
--- a/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx
+++ b/src/features/Acceptance/Viewer/Focus/FocusOutline.tsx
@@ -2,6 +2,7 @@
import type { AcceptanceChecklistItem } from '@lobechat/types';
import { cssVar, Flexbox, Icon, Tag, Text } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { BadgeCheck, Ban, ChevronRight, CircleDashed, PencilLine, RotateCcw } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -12,6 +13,12 @@ import { checkFilterState } from '../Checks/checkState';
import type { AcceptanceCheck } from '../Checks/types';
import { acceptanceFocusedLayout } from '../layout';
+const styles = stylex.create({
+ row: {
+ flexShrink: 0,
+ },
+});
+
const STATE_ICON = {
accepted: BadgeCheck,
ignored: Ban,
@@ -54,6 +61,7 @@ export const FocusOutline = memo<FocusOutlineProps>(
return (
<NavItem
active={check.id === focusedCheckId}
+ className={stylex.props(styles.row).className}
extra={<Icon color={cssVar.colorTextQuaternary} icon={ChevronRight} size={14} />}
key={check.id}
paddingBlock={acceptanceFocusedLayout.outlineItemPaddingBlock}
@@ -94,7 +102,7 @@ export const FocusOutline = memo<FocusOutlineProps>(
);
})}
{standingChecks.length > 0 && onEditStandingCheck && (
- <Flexbox gap={4} paddingBlock={8} paddingInline={8}>
+ <Flexbox gap={4} paddingBlock={8} paddingInline={8} {...stylex.props(styles.row)}>
<Text fontSize={11} type={'secondary'}>
{t('acceptance.checkCreate.pendingGroup')}
</Text>
diff --git a/src/features/Acceptance/Viewer/Gate/GateReview.tsx b/src/features/Acceptance/Viewer/Gate/GateReview.tsx
index 225e94e0142..ded0e9eee2a 100644
--- a/src/features/Acceptance/Viewer/Gate/GateReview.tsx
+++ b/src/features/Acceptance/Viewer/Gate/GateReview.tsx
@@ -4,9 +4,6 @@ import type { GoalReleaseGateDossier, GoalReleaseGateUnit } from '@lobechat/type
import {
ActionIcon,
Button,
- createStaticStyles,
- cssVar,
- cx,
DraggablePanel,
Flexbox,
Icon,
@@ -15,6 +12,8 @@ import {
TextArea,
toast,
} from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import {
CircleCheck,
CircleDashed,
@@ -42,109 +41,104 @@ import SkillDirectory from './SkillDirectory';
import UnitArtifacts from './UnitArtifacts';
import { usePlanFiles } from './usePlanFiles';
-const styles = createStaticStyles(({ css }) => ({
- body: css`
- font-size: ${cssVar.fontSize};
- line-height: 1.7;
- `,
+const styles = stylex.create({
+ body: {
+ fontSize: cssVar.fontSize,
+ lineHeight: 1.7,
+ },
// The same action band as the approval island's cards: one tinted strip the
// decision lives in, apart from the report it decides on.
- footer: css`
- padding-block: 12px;
- padding-inline: 24px;
- border-block-start: 1px solid ${cssVar.colorBorder};
- background: color-mix(in srgb, ${cssVar.colorBgElevated} 92%, ${cssVar.colorFillSecondary});
- `,
- footerOnPage: css`
- position: sticky;
- z-index: 1;
- inset-block-end: 0;
-
- padding-inline: 0;
-
- background: ${cssVar.colorBgContainer};
- `,
- frame: css`
- overflow: hidden;
- display: flex;
- flex-direction: column;
- max-height: 84vh;
- `,
- header: css`
- display: flex;
- gap: 8px;
- align-items: center;
-
- padding-block: 12px;
- padding-inline: 24px;
- border-block-end: 1px solid ${cssVar.colorBorder};
- `,
- link: css`
- font-size: ${cssVar.fontSizeSM};
- color: ${cssVar.colorTextSecondary};
-
- &:hover {
- color: ${cssVar.colorText};
- }
- `,
- list: css`
- overflow: hidden;
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- meta: css`
- font-size: ${cssVar.fontSizeSM};
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextTertiary};
- `,
- panel: css`
- overflow: hidden auto;
- height: 100%;
- padding-block: 16px;
- padding-inline: 16px;
- `,
- plan: css`
- padding-block: 4px;
- padding-inline: 20px;
- border: 1px solid ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- row: css`
- cursor: pointer;
- padding-block: 12px;
- padding-inline: 16px;
-
- & + & {
- border-block-start: 1px solid ${cssVar.colorBorder};
- }
-
- &:hover {
- background: ${cssVar.colorFillQuaternary};
- }
- `,
- rowActive: css`
- background: ${cssVar.colorFillTertiary};
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
- scroll: css`
- overflow-y: auto;
- flex: 1;
- min-width: 0;
- `,
- section: css`
- font-size: ${cssVar.fontSizeLG};
- font-weight: 600;
- `,
- title: css`
- margin: 0;
- font-size: ${cssVar.fontSizeHeading4};
- font-weight: 600;
- line-height: 1.4;
- `,
-}));
+ footer: {
+ paddingBlock: '12px',
+ paddingInline: '24px',
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorder,
+ backgroundColor: `color-mix(in srgb, ${cssVar.colorBgElevated} 92%, ${cssVar.colorFillSecondary})`,
+ },
+ footerOnPage: {
+ position: 'sticky',
+ zIndex: 1,
+ insetBlockEnd: 0,
+ paddingInline: 0,
+ backgroundColor: cssVar.colorBgContainer,
+ },
+ frame: {
+ overflow: 'hidden',
+ display: 'flex',
+ flexDirection: 'column',
+ maxHeight: '84vh',
+ },
+ header: {
+ display: 'flex',
+ gap: '8px',
+ alignItems: 'center',
+ paddingBlock: '12px',
+ paddingInline: '24px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: 'solid',
+ borderBlockEndColor: cssVar.colorBorder,
+ },
+ link: {
+ fontSize: cssVar.fontSizeSM,
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ },
+ list: {
+ overflow: 'hidden',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorder,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ meta: {
+ fontSize: cssVar.fontSizeSM,
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorTextTertiary,
+ },
+ panel: {
+ overflowX: 'hidden',
+ overflowY: 'auto',
+ height: '100%',
+ paddingBlock: '16px',
+ paddingInline: '16px',
+ },
+ plan: {
+ paddingBlock: '4px',
+ paddingInline: '20px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorder,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ row: {
+ cursor: 'pointer',
+ paddingBlock: '12px',
+ paddingInline: '16px',
+ // Rows only ever sit next to other rows in a list (the old `& + &`).
+ borderBlockStartWidth: { 'default': null, ':not(:first-child)': '1px' },
+ borderBlockStartStyle: { 'default': null, ':not(:first-child)': 'solid' },
+ borderBlockStartColor: { 'default': null, ':not(:first-child)': cssVar.colorBorder },
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },
+ },
+ rowActive: {
+ backgroundColor: { 'default': cssVar.colorFillTertiary, ':hover': cssVar.colorFillTertiary },
+ },
+ scroll: {
+ overflowY: 'auto',
+ flex: '1',
+ minWidth: 0,
+ },
+ section: {
+ fontSize: cssVar.fontSizeLG,
+ fontWeight: 600,
+ },
+ title: {
+ margin: 0,
+ fontSize: cssVar.fontSizeHeading4,
+ fontWeight: 600,
+ lineHeight: 1.4,
+ },
+});
/** "A10 返工 #20851 首页 inbox …" → code "A10" and the rest of the title. */
const splitUnitTitle = (title: string) => {
@@ -199,7 +193,7 @@ const Section = ({
<Flexbox gap={12}>
<Flexbox horizontal align={'center'} justify={'space-between'}>
<Flexbox horizontal align={'center'} gap={4}>
- <span className={styles.section}>{title}</span>
+ <span {...stylex.props(styles.section)}>{title}</span>
{titleExtra}
</Flexbox>
{extra}
@@ -218,7 +212,7 @@ const ResultRow = memo<{
const exception = isException(unit);
const ratio = average > 0 ? unit.tokens / average : 0;
return (
- <Flexbox className={cx(styles.row, active && styles.rowActive)} gap={4} onClick={onSelect}>
+ <Flexbox gap={4} {...stylex.props(styles.row, active && styles.rowActive)} onClick={onSelect}>
<Flexbox horizontal align={'center'} gap={12}>
<Icon
color={exception ? cssVar.colorWarning : cssVar.colorSuccess}
@@ -226,7 +220,7 @@ const ResultRow = memo<{
size={16}
/>
<UnitTitle title={unit.title} />
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{[
unit.acceptance?.checks &&
t('acceptance.gate.unitAcceptance', {
@@ -265,13 +259,13 @@ const NextRow = memo<{ active: boolean; onSelect: () => void; title: string }>(
<Flexbox
horizontal
align={'center'}
- className={cx(styles.row, active && styles.rowActive)}
gap={12}
+ {...stylex.props(styles.row, active && styles.rowActive)}
onClick={onSelect}
>
<Icon color={cssVar.colorTextQuaternary} icon={CircleDashed} size={16} />
<UnitTitle title={title} />
- <span className={styles.meta}>{t('acceptance.gate.unitWaiting')}</span>
+ <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitWaiting')}</span>
</Flexbox>
);
},
@@ -286,7 +280,7 @@ const DetailPanel = memo<{ onClose: () => void; selection: Selection }>(
return (
<DraggablePanel
backgroundColor={'transparent'}
- classNames={{ content: styles.panel }}
+ classNames={{ content: stylex.props(styles.panel).className }}
defaultSize={{ height: '100%', width: PANEL_WIDTH.default }}
expandable={false}
maxWidth={PANEL_WIDTH.max}
@@ -302,7 +296,7 @@ const DetailPanel = memo<{ onClose: () => void; selection: Selection }>(
</Flexbox>
{selection.kind === 'result' ? (
<Flexbox gap={8}>
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.gate.unitMeta', {
runs: selection.unit.runs,
tokens: formatTokens(selection.unit.tokens),
@@ -310,7 +304,7 @@ const DetailPanel = memo<{ onClose: () => void; selection: Selection }>(
</span>
{selection.unit.acceptance && (
<a
- className={styles.link}
+ className={stylex.props(styles.link).className}
rel="noreferrer"
target="_blank"
href={buildWorkspaceAwarePath(
@@ -328,11 +322,11 @@ const DetailPanel = memo<{ onClose: () => void; selection: Selection }>(
)}
</Flexbox>
) : (
- <span className={styles.meta}>{t('acceptance.gate.unitWaitingHint')}</span>
+ <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitWaitingHint')}</span>
)}
{brief && (
<Flexbox gap={4}>
- <span className={styles.meta}>{t('acceptance.gate.unitBrief')}</span>
+ <span {...stylex.props(styles.meta)}>{t('acceptance.gate.unitBrief')}</span>
<Markdown fontSize={13} variant={'chat'}>
{brief.replace(/^\[origin=\w+\]\s*/, '')}
</Markdown>
@@ -366,7 +360,7 @@ const GateDecision = memo<{
const status = data.acceptance.status;
if (status === 'accepted' || status === 'rejected')
return (
- <Flexbox className={cx(styles.footer, !inModal && styles.footerOnPage)}>
+ <Flexbox {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>
<Text type={'secondary'}>
{status === 'accepted'
? t('acceptance.gate.decidedRelease', { wave: dossier.wave })
@@ -401,7 +395,7 @@ const GateDecision = memo<{
// A teammate who cannot sign the gate still sees what it asks and who signs it.
if (readOnly)
return (
- <Flexbox className={cx(styles.footer, !inModal && styles.footerOnPage)}>
+ <Flexbox {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>
<Flexbox horizontal align={'center'} gap={8}>
<Text style={{ flex: 1, minWidth: 0 }} type={'secondary'}>
{t('acceptance.bar.readOnlyReason')}
@@ -415,7 +409,7 @@ const GateDecision = memo<{
);
return (
- <Flexbox className={cx(styles.footer, !inModal && styles.footerOnPage)} gap={12}>
+ <Flexbox gap={12} {...stylex.props(styles.footer, !inModal && styles.footerOnPage)}>
{revising && (
<TextArea
autoFocus
@@ -504,12 +498,12 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
const report = (
<Flexbox gap={32} style={{ padding: inModal ? 24 : 0 }}>
<Flexbox gap={8}>
- <h2 className={styles.title}>
+ <h2 {...stylex.props(styles.title)}>
{probes
? t('acceptance.gate.titleProbes')
: t('acceptance.gate.titleWave', { wave: dossier.wave })}
</h2>
- <Text className={styles.body} type={'secondary'}>
+ <Text type={'secondary'} {...stylex.props(styles.body)}>
{probes
? t('acceptance.gate.leadProbes', {
count: dossier.units.length,
@@ -526,7 +520,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
})}`}
</Text>
{dossier.diagnosis && (
- <Text className={styles.body}>
+ <Text {...stylex.props(styles.body)}>
{t('acceptance.gate.agentSays', { reason: dossier.diagnosis })}
</Text>
)}
@@ -536,7 +530,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
title={t('acceptance.gate.planTitle')}
extra={
dossier.plan.skillName && (
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{dossier.plan.skillName} · v{dossier.plan.revision}
{extraFiles > 0 && ` · ${t('acceptance.gate.planFiles', { count: extraFiles + 1 })}`}
</span>
@@ -561,7 +555,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
skillId={dossier.plan.skillId}
/>
) : (
- <div className={styles.plan}>
+ <div {...stylex.props(styles.plan)}>
<Markdown fontSize={14} variant={'chat'}>
{dossier.plan.content}
</Markdown>
@@ -572,12 +566,12 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
<Section
title={probes ? t('acceptance.gate.resultsProbes') : t('acceptance.gate.resultsWave')}
extra={
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.gate.unitCount', { count: dossier.units.length })}
</span>
}
>
- <div className={styles.list}>
+ <div {...stylex.props(styles.list)}>
{units.map((unit) => (
<ResultRow
active={selectedKey === unit.nodeId}
@@ -593,12 +587,12 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
<Section
title={t('acceptance.gate.nextWaveTitle', { wave: dossier.wave })}
extra={
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.gate.unitCount', { count: dossier.nextWave.length })}
</span>
}
>
- <div className={styles.list}>
+ <div {...stylex.props(styles.list)}>
{dossier.nextWave.map((unit) => (
<NextRow
active={selectedKey === unit.title}
@@ -608,7 +602,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
/>
))}
</div>
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.gate.remaining', {
count: dossier.remainingAfter,
estimate: formatTokens(estimate),
@@ -616,7 +610,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
</span>
</Section>
- <span className={styles.meta}>
+ <span {...stylex.props(styles.meta)}>
{t('acceptance.gate.checks', {
passed: dossier.checks.filter((check) => check.passed).length,
total: dossier.checks.length,
@@ -643,8 +637,8 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
);
return (
- <div className={styles.frame}>
- <div className={styles.header}>
+ <div {...stylex.props(styles.frame)}>
+ <div {...stylex.props(styles.header)}>
<div style={{ flex: 1, minWidth: 0 }}>
<GoalDecisionAsker
agentId={dossier.agentId}
@@ -655,7 +649,7 @@ const GateReview = memo<GateReviewProps>(({ dossier, inModal, onClose, onDecided
{onClose && <ActionIcon icon={X} size={'small'} onClick={onClose} />}
</div>
<Flexbox horizontal style={{ flex: 1, minHeight: 0 }}>
- <div className={styles.scroll}>{report}</div>
+ <div {...stylex.props(styles.scroll)}>{report}</div>
{panel}
</Flexbox>
<GateDecision inModal dossier={dossier} onDecided={onDecided} />
diff --git a/src/features/Acceptance/Viewer/Gate/SkillDirectory.tsx b/src/features/Acceptance/Viewer/Gate/SkillDirectory.tsx
index ca4f824649b..1ff034e35d5 100644
--- a/src/features/Acceptance/Viewer/Gate/SkillDirectory.tsx
+++ b/src/features/Acceptance/Viewer/Gate/SkillDirectory.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createStaticStyles, cssVar, Flexbox, Highlighter, Markdown } from '@lobehub/ui';
+import { Flexbox, Highlighter, Markdown } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { memo, useMemo, useState } from 'react';
import AsyncError from '@/components/AsyncError';
@@ -18,27 +20,24 @@ import { parseSkillMarkdownFrontmatter } from '@/utils/skillMarkdown';
const SKILL_INDEX = 'SKILL.md';
const MARKDOWN_FILE = /\.mdx?$/i;
-const styles = createStaticStyles(({ css }) => ({
- // Kept open, the tree stays beside the file being read while it scrolls.
- tree: css`
- position: sticky;
- inset-block-start: 0;
-
- overflow-y: auto;
- flex: none;
- align-self: flex-start;
-
- width: 240px;
- max-height: 480px;
- padding-block: 4px;
- padding-inline: 0 8px;
- border-inline-end: 1px solid ${cssVar.colorBorder};
- `,
- viewer: css`
- flex: 1;
- min-width: 0;
- `,
-}));
+const styles = stylex.create({
+ tree: {
+ position: 'sticky',
+ insetBlockStart: '0',
+ overflowY: 'auto',
+ flex: 'none',
+ alignSelf: 'flex-start',
+ width: '240px',
+ maxHeight: '480px',
+ paddingBlock: '4px',
+ paddingInlineStart: '0',
+ paddingInlineEnd: '8px',
+ borderInlineEndWidth: '1px',
+ borderInlineEndStyle: 'solid',
+ borderInlineEndColor: cssVar.colorBorder,
+ },
+ viewer: { flex: '1', minWidth: '0' },
+});
interface SkillDirectoryProps {
/** `SKILL.md` as the dossier froze it, read when the skill itself can't be. */
@@ -94,7 +93,7 @@ const SkillDirectory = memo<SkillDirectoryProps>(
return (
<Flexbox horizontal gap={20}>
{filesOpen && (
- <div className={styles.tree}>
+ <div {...stylex.props(styles.tree)}>
<FileTree
resourceTree={resourceTree}
rootFile={{ label: SKILL_INDEX, path: SKILL_INDEX }}
@@ -103,7 +102,7 @@ const SkillDirectory = memo<SkillDirectoryProps>(
/>
</div>
)}
- <div className={styles.viewer}>
+ <div {...stylex.props(styles.viewer)}>
{/* Flush with the section, no frame of their own: documents as prose, the rest as code. */}
{MARKDOWN_FILE.test(shown) ? (
<Markdown fontSize={14} key={shown} variant={'chat'}>
diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx
index 73569736d1e..a2988cedd35 100644
--- a/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx
+++ b/src/features/Acceptance/Viewer/Header/AcceptanceGoal.tsx
@@ -1,6 +1,8 @@
'use client';
-import { ActionIcon, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronsDownUp, ChevronsUpDown, GitBranch, GitCommitHorizontal } from 'lucide-react';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,74 +11,32 @@ import { useLocalStorageState } from '@/hooks/useLocalStorageState';
import { useAcceptanceScope } from '../AcceptanceScope';
import { acceptanceCodingScope } from '../History/codingScope';
+import { goalCardMarker } from '../markers.stylex';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
const GOAL_COLLAPSED_STORAGE_KEY = 'lobehub-acceptance-goal-collapsed';
-const styles = createStaticStyles(({ css }) => ({
- /**
- * No border, no card. The requirement is the page's own subject line, not a
- * widget parked on it — boxing it added a frame around the one thing nobody
- * needs help finding.
- */
- card: css`
- &:hover [data-goal-toggle='true'] {
- pointer-events: auto;
- opacity: 1;
- }
- `,
- goalToggle: css`
- pointer-events: none;
- opacity: 0;
- transition: opacity ${cssVar.motionDurationMid};
-
- &:focus-visible {
- pointer-events: auto;
- opacity: 1;
- }
-
- @media (hover: none) {
- pointer-events: auto;
- opacity: 1;
- }
- `,
- requirementLabel: css`
- font-size: 12px;
- font-weight: 500;
- color: ${cssVar.colorTextTertiary};
- letter-spacing: 0.04em;
- `,
- scopeChip: css`
- font-size: 12px;
- color: ${cssVar.colorTextSecondary};
- `,
- scopeLink: css`
- cursor: pointer;
- color: ${cssVar.colorTextSecondary};
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
- summaryClamp: css`
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
-
- line-height: 1.6;
- `,
- viewReportLink: css`
- cursor: pointer;
- font-size: 12px;
- color: ${cssVar.colorTextQuaternary};
-
- &:hover {
- color: ${cssVar.colorTextSecondary};
- }
- `,
-}));
+const styles = stylex.create({
+ goalToggle: {
+ pointerEvents: {
+ 'default': 'none',
+ ':focus-visible': 'auto',
+ '@media (hover: none)': 'auto',
+ [stylex.when.ancestor(':hover', goalCardMarker)]: 'auto',
+ },
+ opacity: {
+ 'default': 0,
+ ':focus-visible': 1,
+ '@media (hover: none)': 1,
+ [stylex.when.ancestor(':hover', goalCardMarker)]: 1,
+ },
+ transition: `opacity ${cssVar.motionDurationMid}`,
+ },
+ scopeChip: {
+ fontSize: '12px',
+ color: cssVar.colorTextSecondary,
+ },
+});
interface AcceptanceGoalProps {
editSlot?: ReactNode;
@@ -96,7 +56,7 @@ const AcceptanceGoal = ({ editSlot }: AcceptanceGoalProps) => {
: t('acceptance.requirementEmpty');
return (
- <Flexbox className={styles.card} gap={collapsed ? 0 : 6}>
+ <Flexbox gap={collapsed ? 0 : 6} {...stylex.props(goalCardMarker)}>
{/* No "Acceptance goal" label: the sentence under the title IS the goal,
and naming it added a caption to a paragraph that reads fine alone.
Its controls therefore ride the sentence's own row — a header strip
@@ -117,7 +77,7 @@ const AcceptanceGoal = ({ editSlot }: AcceptanceGoalProps) => {
{!collapsed && editSlot}
<ActionIcon
data-goal-toggle
- className={styles.goalToggle}
+ {...stylex.props(styles.goalToggle)}
icon={collapsed ? ChevronsUpDown : ChevronsDownUp}
size={'small'}
title={t(collapsed ? 'acceptance.goalExpand' : 'acceptance.goalCollapse')}
@@ -129,12 +89,12 @@ const AcceptanceGoal = ({ editSlot }: AcceptanceGoalProps) => {
{scope && (
<Flexbox horizontal align={'center'} gap={16} wrap={'wrap'}>
{scope.branch && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
+ <Flexbox horizontal align={'center'} gap={4} {...stylex.props(styles.scopeChip)}>
<Icon icon={GitBranch} size={13} /> {scope.branch}
</Flexbox>
)}
{scope.commit && (
- <Flexbox horizontal align={'center'} className={styles.scopeChip} gap={4}>
+ <Flexbox horizontal align={'center'} gap={4} {...stylex.props(styles.scopeChip)}>
<Icon icon={GitCommitHorizontal} size={13} /> {scope.commit.slice(0, 10)}
</Flexbox>
)}
diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx
index 8261ee3de86..5fb52b2df7c 100644
--- a/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx
+++ b/src/features/Acceptance/Viewer/Header/AcceptanceIdentity.tsx
@@ -1,48 +1,50 @@
'use client';
-import { Avatar, createStaticStyles, cssVar, Flexbox, Text } from '@lobehub/ui';
+import { Avatar, Flexbox, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import type { ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import { useAcceptanceScope } from '../AcceptanceScope';
import { acceptanceCodingScope } from '../History/codingScope';
+import { titleRowMarker } from '../markers.stylex';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import AcceptanceStatusPill from './AcceptanceStatusPill';
import PreviewReviewLink from './PreviewReviewLink';
import PullRequestLinks from './PullRequestLinks';
-const styles = createStaticStyles(({ css }) => ({
- titleRow: css`
- /* The per-check entry keeps its box at all times and only shows its ink on
- hover: revealing it by reflow would retitle the row under the pointer,
- and the title is what the reader is aiming at. It fades rather than
- hiding, so it stays in the tab order and in the accessibility tree —
- a hidden visibility would drop it from both, and the focus rule below
- could never fire. The pointer-events switch keeps the faded box from
- swallowing clicks meant for the title. Touch never hovers, which is why the button
- removes itself outright below this breakpoint. */
- [data-role='focus-entry'] {
- pointer-events: none;
- flex: none;
- opacity: 0;
- transition: opacity 150ms ease;
- }
-
- &:hover [data-role='focus-entry'],
- &:focus-within [data-role='focus-entry'] {
- pointer-events: auto;
- opacity: 1;
- }
-
- @media (width <= 767px) {
- padding-inline-end: 48px;
- }
- `,
- metaRow: css`
- font-size: 13px;
- color: ${cssVar.colorTextSecondary};
- `,
-}));
+const styles = stylex.create({
+ titleRow: {
+ paddingInlineEnd: { 'default': null, '@media (width <= 767px)': '48px' },
+ },
+ // The per-check entry keeps its box at all times and only shows its ink on
+ // hover: revealing it by reflow would retitle the row under the pointer,
+ // and the title is what the reader is aiming at. It fades rather than
+ // hiding, so it stays in the tab order and in the accessibility tree —
+ // a hidden visibility would drop it from both, and the focus rule below
+ // could never fire. The pointer-events switch keeps the faded box from
+ // swallowing clicks meant for the title. Touch never hovers, which is why the button
+ // removes itself outright below this breakpoint.
+ focusEntry: {
+ pointerEvents: {
+ default: 'none',
+ [stylex.when.ancestor(':hover', titleRowMarker)]: 'auto',
+ [stylex.when.ancestor(':focus-within', titleRowMarker)]: 'auto',
+ },
+ flex: 'none',
+ opacity: {
+ default: 0,
+ [stylex.when.ancestor(':hover', titleRowMarker)]: 1,
+ [stylex.when.ancestor(':focus-within', titleRowMarker)]: 1,
+ },
+ transition: 'opacity 150ms ease',
+ },
+ metaRow: {
+ fontSize: '13px',
+ color: cssVar.colorTextSecondary,
+ },
+});
interface AcceptanceIdentityProps {
/** Rendered after the title, revealed on hover — the per-check entry point. */
@@ -87,14 +89,20 @@ const AcceptanceIdentity = ({ focusSlot, statusSlot, topicSlot }: AcceptanceIden
delivered is a fact about the plumbing, not about the delivery a
reader came to judge — and it sat where the title's own meaning
should carry. */}
- <Flexbox horizontal align={'center'} className={styles.titleRow} gap={10} wrap={'wrap'}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={10}
+ wrap={'wrap'}
+ {...stylex.props(styles.titleRow, titleRowMarker)}
+ >
<Text ellipsis as={'h1'} style={{ fontSize: 18, margin: 0, minWidth: 0 }}>
{subject.title ?? subject.id}
</Text>
- {focusSlot && <div data-role={'focus-entry'}>{focusSlot}</div>}
+ {focusSlot && <div {...stylex.props(styles.focusEntry)}>{focusSlot}</div>}
</Flexbox>
- <Flexbox horizontal align={'center'} className={styles.metaRow} gap={12} wrap={'wrap'}>
+ <Flexbox horizontal align={'center'} gap={12} wrap={'wrap'} {...stylex.props(styles.metaRow)}>
{statusSlot ?? <AcceptanceStatusPill status={acceptance.status} />}
{/* Who delivered this, right after its state — the same place a pull
request names its author. A shared record with no name on it reads
diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx
index 5ab381b68c7..894025dca77 100644
--- a/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx
+++ b/src/features/Acceptance/Viewer/Header/AcceptanceStatusPill.tsx
@@ -1,34 +1,31 @@
'use client';
import type { DropdownItem } from '@lobehub/ui';
-import { createStaticStyles, cssVar, cx, DropdownMenu, Icon } from '@lobehub/ui';
+import { DropdownMenu, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronDown } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { resolveAcceptanceVerdictMeta } from '../verdict';
-const styles = createStaticStyles(({ css }) => ({
- pill: css`
- display: inline-flex;
- gap: 5px;
- align-items: center;
-
- padding-block: 2px;
- padding-inline: 10px;
- border-radius: 99px;
-
- font-size: 12px;
- font-weight: 500;
- `,
- interactive: css`
- cursor: pointer;
- transition: filter ${cssVar.motionDurationMid};
-
- &:hover {
- filter: brightness(1.08);
- }
- `,
-}));
+const styles = stylex.create({
+ pill: {
+ display: 'inline-flex',
+ gap: '5px',
+ alignItems: 'center',
+ paddingBlock: '2px',
+ paddingInline: '10px',
+ borderRadius: '99px',
+ fontSize: '12px',
+ fontWeight: 500,
+ },
+ interactive: {
+ cursor: 'pointer',
+ transition: `filter ${cssVar.motionDurationMid}`,
+ filter: { 'default': null, ':hover': 'brightness(1.08)' },
+ },
+});
interface AcceptanceStatusPillProps {
menu?: DropdownItem[];
@@ -42,8 +39,12 @@ const AcceptanceStatusPill = ({ menu, pending, size = 13, status }: AcceptanceSt
const verdictMeta = resolveAcceptanceVerdictMeta(status, t);
const pill = (
<span
- className={menu ? cx(styles.pill, styles.interactive) : styles.pill}
title={menu ? t('acceptance.workspace.actions.status') : undefined}
+ className={
+ menu
+ ? stylex.props(styles.pill, styles.interactive).className
+ : stylex.props(styles.pill).className
+ }
style={{
background: verdictMeta.bg,
color: verdictMeta.color,
diff --git a/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx b/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx
index fecd47a6a66..049bc7c7564 100644
--- a/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx
+++ b/src/features/Acceptance/Viewer/Header/AcceptanceTabs.tsx
@@ -1,20 +1,21 @@
'use client';
-import { createStaticStyles, Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import { Flexbox, Icon, Tabs, Tag } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { ListChecks, MessagesSquare, Paperclip, Route } from 'lucide-react';
import { useTranslation } from 'react-i18next';
export type AcceptanceTabKey = 'checks' | 'discussion' | 'resources' | 'flow';
-const styles = createStaticStyles(({ css }) => ({
+const styles = stylex.create({
// The square variant underlines its whole list; the band below already draws
// the full-width rule, so the list's own line would sit on top of it.
- list: css`
- && {
- box-shadow: none;
- }
- `,
-}));
+ list: {
+ boxShadow: 'none',
+ },
+});
+
+const listClassName = stylex.props(styles.list).className;
interface AcceptanceTabsProps {
active: AcceptanceTabKey;
@@ -69,7 +70,7 @@ const AcceptanceTabs = ({
return (
<Tabs
activeKey={active}
- classNames={{ list: styles.list }}
+ classNames={{ list: listClassName }}
style={{ minWidth: 0, overflowX: 'auto' }}
variant={'square'}
items={tabs
diff --git a/src/features/Acceptance/Viewer/Header/PreviewReviewLink.tsx b/src/features/Acceptance/Viewer/Header/PreviewReviewLink.tsx
index 15a686ba247..005454b4212 100644
--- a/src/features/Acceptance/Viewer/Header/PreviewReviewLink.tsx
+++ b/src/features/Acceptance/Viewer/Header/PreviewReviewLink.tsx
@@ -1,6 +1,8 @@
'use client';
-import { createStaticStyles, cssVar, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ArrowUpRight, MonitorSmartphone } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,17 +11,13 @@ import type { AcceptanceBundle } from '@/services/verify';
import { previewReviewUrl } from './previewReview';
-const styles = createStaticStyles(({ css }) => ({
- link: css`
- cursor: pointer;
- color: ${cssVar.colorTextSecondary};
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
-}));
+const styles = stylex.create({
+ link: {
+ cursor: 'pointer',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ textDecoration: { 'default': null, ':hover': 'underline' },
+ },
+});
interface PreviewReviewLinkProps {
acceptanceId: string;
@@ -32,7 +30,7 @@ const PreviewReviewLink = memo<PreviewReviewLinkProps>(({ acceptanceId, rounds }
if (!href) return null;
return (
<a
- className={styles.link}
+ {...stylex.props(styles.link)}
href={href}
rel={'noreferrer'}
target={'_blank'}
diff --git a/src/features/Acceptance/Viewer/Header/PullRequestLinks.tsx b/src/features/Acceptance/Viewer/Header/PullRequestLinks.tsx
index da8e2b63110..f7c039cc51c 100644
--- a/src/features/Acceptance/Viewer/Header/PullRequestLinks.tsx
+++ b/src/features/Acceptance/Viewer/Header/PullRequestLinks.tsx
@@ -1,7 +1,9 @@
'use client';
import type { VerifyCodingPullRequest } from '@lobechat/types';
-import { createStaticStyles, cssVar, Flexbox, Icon } from '@lobehub/ui';
+import { Flexbox, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import {
GitMerge,
GitPullRequest,
@@ -13,17 +15,13 @@ import { memo } from 'react';
import type { AcceptanceBundle } from '@/services/verify';
-const styles = createStaticStyles(({ css }) => ({
- link: css`
- cursor: pointer;
- color: ${cssVar.colorTextSecondary};
-
- &:hover {
- color: ${cssVar.colorText};
- text-decoration: underline;
- }
- `,
-}));
+const styles = stylex.create({
+ link: {
+ cursor: 'pointer',
+ color: { 'default': cssVar.colorTextSecondary, ':hover': cssVar.colorText },
+ textDecoration: { 'default': null, ':hover': 'underline' },
+ },
+});
type PullRequest = AcceptanceBundle['pullRequests'][number];
@@ -57,7 +55,7 @@ const PullRequestLinks = memo<PullRequestLinksProps>(({ pullRequests, fallback }
const { color, icon } = stateIcon(pullRequest);
return (
<a
- className={styles.link}
+ {...stylex.props(styles.link)}
href={pullRequest.url}
key={pullRequest.url}
rel={'noreferrer'}
@@ -85,7 +83,7 @@ const PullRequestLinks = memo<PullRequestLinksProps>(({ pullRequests, fallback }
);
return fallback.url ? (
<a
- className={styles.link}
+ {...stylex.props(styles.link)}
href={fallback.url}
rel={'noreferrer'}
target={'_blank'}
diff --git a/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx b/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx
index 053bc4b1449..41b92840757 100644
--- a/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx
+++ b/src/features/Acceptance/Viewer/History/AcceptanceInteractionCost.tsx
@@ -1,6 +1,8 @@
'use client';
-import { Button, createStaticStyles, cssVar, Icon } from '@lobehub/ui';
+import { Button, Icon } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronRight } from 'lucide-react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -26,24 +28,23 @@ import { buildCheckLabels, selectPricedRound } from './interactionCost';
* seeing at a glance; the breakdown is one click away.
*/
-const styles = createStaticStyles(({ css }) => ({
- body: css`
- padding-block-end: 4px;
- padding-inline-start: 24px;
- `,
- chevron: css`
- transition: transform 0.15s ease;
-
- &[data-open='true'] {
- transform: rotate(90deg);
- }
- `,
- total: css`
- margin-inline-start: 6px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextTertiary};
- `,
-}));
+const styles = stylex.create({
+ body: {
+ paddingBlockEnd: '4px',
+ paddingInlineStart: '24px',
+ },
+ chevron: {
+ transition: 'transform 0.15s ease',
+ },
+ chevronOpen: {
+ transform: 'rotate(90deg)',
+ },
+ total: {
+ marginInlineStart: '6px',
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorTextTertiary,
+ },
+});
interface AcceptanceInteractionCostProps {
data: AcceptanceBundle;
@@ -61,17 +62,23 @@ const AcceptanceInteractionCost = memo<AcceptanceInteractionCostProps>(({ data }
return (
<>
<Button
- icon={<Icon className={styles.chevron} data-open={open} icon={ChevronRight} />}
size={'small'}
style={{ alignSelf: 'flex-start' }}
type={'text'}
+ icon={
+ <Icon
+ data-open={open}
+ icon={ChevronRight}
+ {...stylex.props(styles.chevron, open && styles.chevronOpen)}
+ />
+ }
onClick={() => setOpen((prev) => !prev)}
>
{t('report.interaction.title')}
- <span className={styles.total}>{formatSeconds(priced.cost.totalSeconds)}</span>
+ <span {...stylex.props(styles.total)}>{formatSeconds(priced.cost.totalSeconds)}</span>
</Button>
{open && (
- <div className={styles.body}>
+ <div {...stylex.props(styles.body)}>
<InteractionCostPanel
checkLabels={checkLabels}
cost={priced.cost}
diff --git a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
index 5c8ef82e1d4..6a78c00487e 100644
--- a/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
+++ b/src/features/Acceptance/Viewer/History/AcceptanceLedgerRail.tsx
@@ -1,14 +1,8 @@
'use client';
-import {
- createStaticStyles,
- cssVar,
- DraggablePanel,
- Flexbox,
- Icon,
- Text,
- useResponsive,
-} from '@lobehub/ui';
+import { DraggablePanel, Flexbox, Icon, Text, useResponsive } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { PanelRightOpen } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useParams, useSearchParams } from 'react-router';
@@ -24,40 +18,24 @@ import { canViewAcceptanceHistory } from '../visibility';
import LedgerPanel, { type AcceptanceRound } from './LedgerPanel';
import { useAcceptanceRailState } from './useAcceptanceRailState';
-const styles = createStaticStyles(({ css }) => ({
- chipCount: css`
- font-size: 11px;
- font-weight: 500;
- color: ${cssVar.colorTextSecondary};
- `,
- /**
- * Collapsed, the run ledger is a VERTICAL chip hugging the content's right
- * edge: the rounds are the page's audit trail, not its reading material, so
- * the affordance keeps the column it would otherwise occupy down to a
- * thumb-width strip. The icon plus the round count carry it — spelling the
- * label out sideways would cost the width the collapse just bought back.
- */
- toggle: css`
- cursor: pointer;
-
- position: absolute;
- z-index: 10;
- inset-block-start: 16px;
- inset-inline-end: 12px;
-
- padding-block: 8px;
- padding-inline: 5px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: 99px;
-
- background: ${cssVar.colorBgContainer};
-
- &:hover {
- border-color: ${cssVar.colorBorder};
- background: ${cssVar.colorFillQuaternary};
- }
- `,
-}));
+const styles = stylex.create({
+ chipCount: { fontSize: '11px', fontWeight: 500, color: cssVar.colorTextSecondary },
+ toggle: {
+ cursor: 'pointer',
+ position: 'absolute',
+ zIndex: 10,
+ insetBlockStart: '16px',
+ insetInlineEnd: '12px',
+ paddingBlock: '8px',
+ paddingInline: '5px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },
+ borderRadius: '99px',
+ backgroundColor: { 'default': cssVar.colorBgContainer, ':hover': cssVar.colorFillQuaternary },
+ backgroundImage: { 'default': 'none', ':hover': 'none' },
+ },
+});
const AcceptanceLedgerRail = () => {
const { t } = useTranslation('verify');
@@ -140,13 +118,13 @@ const AcceptanceLedgerRail = () => {
{!focused && !expand && (
<Flexbox
align={'center'}
- className={styles.toggle}
+ className={stylex.props(styles.toggle).className}
gap={5}
title={t('acceptance.ledger.expand')}
onClick={() => onExpandChange(true)}
>
<Icon icon={PanelRightOpen} size={14} />
- <Text className={styles.chipCount}>{data.rounds.length}</Text>
+ <Text className={stylex.props(styles.chipCount).className}>{data.rounds.length}</Text>
</Flexbox>
)}
{isNarrowViewport ? (
diff --git a/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx b/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx
index f6040ab3127..1d4da9e3106 100644
--- a/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx
+++ b/src/features/Acceptance/Viewer/History/AcceptanceViewReportLink.tsx
@@ -1,6 +1,7 @@
'use client';
-import { createStaticStyles, cssVar } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router';
@@ -8,27 +9,18 @@ import { useAcceptanceScope } from '../AcceptanceScope';
import { useAcceptanceBundle } from '../useAcceptanceBundle';
import { canViewAcceptanceHistory } from '../visibility';
-const styles = createStaticStyles(({ css }) => ({
- link: css`
- cursor: pointer;
-
- padding: 0;
- border: 0;
-
- font-size: 12px;
- color: ${cssVar.colorTextQuaternary};
-
- background: none;
-
- &:hover {
- color: ${cssVar.colorTextSecondary};
- }
-
- @media (width <= 767px) {
- min-height: 44px;
- }
- `,
-}));
+const styles = stylex.create({
+ link: {
+ cursor: 'pointer',
+ padding: '0',
+ borderStyle: 'none',
+ fontSize: '12px',
+ color: { 'default': cssVar.colorTextQuaternary, ':hover': cssVar.colorTextSecondary },
+ backgroundColor: 'transparent',
+ backgroundImage: 'none',
+ minHeight: { 'default': null, '@media (width <= 767px)': '44px' },
+ },
+});
const AcceptanceViewReportLink = () => {
const { t } = useTranslation('verify');
@@ -41,7 +33,7 @@ const AcceptanceViewReportLink = () => {
return (
<button
- className={styles.link}
+ {...stylex.props(styles.link)}
type={'button'}
onClick={() => {
if (round?.run.roundIndex == null) return;
diff --git a/src/features/Acceptance/Viewer/History/LedgerPanel.tsx b/src/features/Acceptance/Viewer/History/LedgerPanel.tsx
index 73f928c6637..6280fd13986 100644
--- a/src/features/Acceptance/Viewer/History/LedgerPanel.tsx
+++ b/src/features/Acceptance/Viewer/History/LedgerPanel.tsx
@@ -1,6 +1,8 @@
'use client';
-import { ActionIcon, createStaticStyles, cssVar, cx, Flexbox, Icon, Text } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import dayjs from 'dayjs';
import {
CheckCircle2,
@@ -19,6 +21,8 @@ import { useTranslation } from 'react-i18next';
import { useIsHydrated } from '@/hooks/useIsHydrated';
import type { AcceptanceBundle } from '@/services/verify';
+import { roundCardMarker } from '../markers.stylex';
+
export type AcceptanceRound = AcceptanceBundle['rounds'][number];
/** Per-round acceptance tally (how many of the round's own checks the user signed off). */
@@ -27,51 +31,46 @@ export interface RoundReview {
total: number;
}
-const styles = createStaticStyles(({ css }) => ({
- countBadge: css`
- padding-block: 1px;
- padding-inline: 7px;
- border-radius: 99px;
-
- font-size: 12px;
- font-variant-numeric: tabular-nums;
- color: ${cssVar.colorTextSecondary};
-
- background: ${cssVar.colorFillTertiary};
- `,
- round: css`
- padding-block: 10px;
- padding-inline: 12px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- transition:
- box-shadow 0.2s ease,
- border-color 0.2s ease;
- `,
- roundActive: css`
- border-color: ${cssVar.colorPrimary};
- box-shadow: 0 0 0 2px ${cssVar.colorPrimaryBg};
- `,
- /* The whole card is the report affordance — no inner button. */
- roundClickable: css`
- cursor: pointer;
-
- .acceptance-round-open-hint {
- opacity: 0;
- transition: opacity 0.2s ease;
- }
-
- &:hover {
- border-color: ${cssVar.colorBorder};
- background: ${cssVar.colorFillQuaternary};
-
- .acceptance-round-open-hint {
- opacity: 1;
- }
- }
- `,
-}));
+const styles = stylex.create({
+ countBadge: {
+ paddingBlock: '1px',
+ paddingInline: '7px',
+ borderRadius: '99px',
+ fontSize: '12px',
+ fontVariantNumeric: 'tabular-nums',
+ color: cssVar.colorTextSecondary,
+ backgroundColor: cssVar.colorFillTertiary,
+ },
+ round: {
+ paddingBlock: '10px',
+ paddingInline: '12px',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ transition: 'box-shadow 0.2s ease, border-color 0.2s ease',
+ },
+ roundActive: {
+ borderColor: cssVar.colorPrimary,
+ boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,
+ },
+ // The whole card is the report affordance — no inner button.
+ roundClickable: {
+ cursor: 'pointer',
+ borderColor: { 'default': cssVar.colorBorderSecondary, ':hover': cssVar.colorBorder },
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },
+ },
+ // An active card that is also clickable: hover still wins over the active
+ // border, as `.roundClickable:hover` outranked `.roundActive` before.
+ roundActiveClickable: {
+ borderColor: { 'default': cssVar.colorPrimary, ':hover': cssVar.colorBorder },
+ boxShadow: `0 0 0 2px ${cssVar.colorPrimaryBg}`,
+ },
+ openHint: {
+ opacity: { default: 0, [stylex.when.ancestor(':hover', roundCardMarker)]: 1 },
+ transition: 'opacity 0.2s ease',
+ },
+});
/** Only the still-running states keep a machine indicator; a settled round is
reframed as an ACCEPTANCE state (已验收 / 待验收), not a verification verdict. */
@@ -120,7 +119,7 @@ const LedgerPanel = memo<LedgerPanelProps>(
<Text strong style={{ fontSize: 13 }}>
{t('acceptance.ledger.title')}
</Text>
- <span className={styles.countBadge}>{rounds.length}</span>
+ <span {...stylex.props(styles.countBadge)}>{rounds.length}</span>
<Flexbox flex={1} />
{!hideCollapse && (
<ActionIcon
@@ -189,10 +188,12 @@ const LedgerPanel = memo<LedgerPanelProps>(
gap={6}
key={round.run.id}
role={openable ? 'button' : undefined}
- className={cx(
+ {...stylex.props(
styles.round,
openable && styles.roundClickable,
- highlight === round.run.roundIndex && styles.roundActive,
+ openable && roundCardMarker,
+ highlight === round.run.roundIndex &&
+ (openable ? styles.roundActiveClickable : styles.roundActive),
)}
onClick={openable ? () => onOpenReport(round) : undefined}
>
@@ -220,10 +221,10 @@ const LedgerPanel = memo<LedgerPanelProps>(
</Text>
{openable && (
<Icon
- className={'acceptance-round-open-hint'}
color={cssVar.colorTextTertiary}
icon={ChevronRight}
size={14}
+ {...stylex.props(styles.openHint)}
/>
)}
</Flexbox>
diff --git a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
index 5c73ef6ad19..8ff513b4ed2 100644
--- a/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
+++ b/src/features/Acceptance/Viewer/ReadOnly/Checks.tsx
@@ -1,4 +1,6 @@
-import { createStaticStyles, cssVar, Empty, Flexbox, Icon, Select, Text } from '@lobehub/ui';
+import { Empty, Flexbox, Icon, Select, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { type Dispatch, type SetStateAction, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -25,32 +27,32 @@ import type { EvidenceOverlayMap } from '../Evidence/overlay';
import { useAcceptanceBundle, useEvidenceUrlRefresh } from '../useAcceptanceBundle';
import { ReadComment } from './Discussion';
-const styles = createStaticStyles(({ css }) => ({
- check: css`
- overflow: hidden;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- history: css`
- padding-block: 8px;
-
- & > summary {
- cursor: pointer;
- color: ${cssVar.colorTextSecondary};
- }
- `,
- summary: css`
- cursor: pointer;
- padding: 16px;
- font-size: ${cssVar.fontSize};
- overflow-wrap: anywhere;
-
- &:focus-visible {
- outline: 2px solid ${cssVar.colorPrimary};
- outline-offset: -2px;
- }
- `,
-}));
+const styles = stylex.create({
+ check: {
+ overflow: 'hidden',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ history: {
+ paddingBlock: '8px',
+ },
+ historySummary: {
+ cursor: 'pointer',
+ color: cssVar.colorTextSecondary,
+ },
+ summary: {
+ cursor: 'pointer',
+ padding: '16px',
+ fontSize: cssVar.fontSize,
+ overflowWrap: 'anywhere',
+ outlineWidth: { 'default': null, ':focus-visible': '2px' },
+ outlineStyle: { 'default': null, ':focus-visible': 'solid' },
+ outlineColor: { 'default': null, ':focus-visible': cssVar.colorPrimary },
+ outlineOffset: { 'default': null, ':focus-visible': '-2px' },
+ },
+});
const ReadCheck = ({
check,
@@ -87,11 +89,11 @@ const ReadCheck = ({
return (
<details
- className={styles.check}
+ {...stylex.props(styles.check)}
open={open}
onToggle={(event) => onToggle(event.currentTarget.open)}
>
- <summary className={styles.summary}>
+ <summary {...stylex.props(styles.summary)}>
<Icon color={meta.color} icon={meta.icon} size={16} />{' '}
{checkDisplayTitle(check.title, t('acceptance.checks.holisticTitle'))}
<Text fontSize={12} style={{ marginInlineStart: 8 }} type={'secondary'}>
@@ -154,11 +156,13 @@ const ReadCheck = ({
{hasHistory && (
<details
- className={styles.history}
+ {...stylex.props(styles.history)}
open={historyOpen}
onToggle={(event) => onHistoryToggle(event.currentTarget.open)}
>
- <summary>{t('acceptance.checks.iterationHistory', { count: check.revisions })}</summary>
+ <summary {...stylex.props(styles.historySummary)}>
+ {t('acceptance.checks.iterationHistory', { count: check.revisions })}
+ </summary>
<Flexbox style={{ paddingBlockStart: 12 }}>
<IterationTimeline
check={check}
diff --git a/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx b/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx
index c00d7399ccc..de03b6e837d 100644
--- a/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx
+++ b/src/features/Acceptance/Viewer/ReadOnly/Discussion.tsx
@@ -1,9 +1,11 @@
import type { AcceptanceCommentItem } from '@lobechat/types';
import { Avatar, Button, Empty, Flexbox, Spin, Text } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { BadgeCheck, GitCommitHorizontal } from 'lucide-react';
import { useTranslation } from 'react-i18next';
import { useActivityTime } from '@/hooks/useActivityTime';
+import { sx } from '@/styles/sx';
import { useAcceptanceScope } from '../AcceptanceScope';
import AccessRequestEntry from '../Comments/AccessRequestEntry';
@@ -30,10 +32,17 @@ export const ReadComment = ({
return (
<Flexbox
- className={styles.box}
- style={{ marginInlineStart: threaded && comment.parentCommentId ? 24 : 0 }}
+ {...sx(styles.box, {
+ marginInlineStart: threaded && comment.parentCommentId ? 24 : 0,
+ })}
>
- <Flexbox horizontal align={'center'} className={styles.boxHeader} gap={8} wrap={'wrap'}>
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={8}
+ wrap={'wrap'}
+ {...stylex.props(styles.boxHeader)}
+ >
<Avatar avatar={comment.author.avatar || name.slice(0, 1)} size={20} />
<Text weight={600}>{nameOverride ?? name}</Text>
<Text fontSize={12} title={time.title} type={'secondary'}>
@@ -41,7 +50,7 @@ export const ReadComment = ({
</Text>
{comment.resolvedAt && <Text fontSize={12}>{t('acceptance.comments.resolved')}</Text>}
</Flexbox>
- <div className={styles.body}>
+ <div {...stylex.props(styles.body)}>
<CommentContent comment={comment} />
{comment.reactions.length > 0 && (
<Flexbox horizontal gap={8} style={{ paddingBlockStart: 8 }} wrap={'wrap'}>
diff --git a/src/features/Acceptance/Viewer/Review/DecisionBar.tsx b/src/features/Acceptance/Viewer/Review/DecisionBar.tsx
index 9fe6689316e..e9b736104fc 100644
--- a/src/features/Acceptance/Viewer/Review/DecisionBar.tsx
+++ b/src/features/Acceptance/Viewer/Review/DecisionBar.tsx
@@ -1,6 +1,9 @@
'use client';
-import { Button, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import type { ButtonProps } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import {
BadgeCheck,
CircleAlert,
@@ -15,99 +18,85 @@ import {
import { memo, useEffect, useRef } from 'react';
import { useTranslation } from 'react-i18next';
-import { acceptanceContentLayout } from '../layout';
-
-const styles = createStaticStyles(({ css }) => ({
- repairingArc: css`
- transform-origin: center;
- animation: acceptance-repairing-orbit 1.2s linear infinite;
-
- @keyframes acceptance-repairing-orbit {
- to {
- transform: rotate(360deg);
- }
- }
+import { sx } from '@/styles/sx';
- @media (prefers-reduced-motion: reduce) {
- animation: none;
- }
- `,
- /* Floats over the scrolling checklist — the decision stays reachable
- however deep the review goes. */
- bar: css`
- position: sticky;
- z-index: 20;
- inset-block-end: 16px;
-
- display: flex;
- flex-wrap: wrap;
- gap: 12px;
- align-items: center;
-
- width: 100%;
- max-width: ${acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline}px;
- margin-inline: auto;
- padding-block: 12px;
- padding-inline: 16px;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
+import { acceptanceContentLayout } from '../layout';
- background: ${cssVar.colorBgElevated};
- box-shadow: ${cssVar.boxShadowTertiary};
+const orbit = stylex.keyframes({
+ to: { transform: 'rotate(360deg)' },
+});
- @media (width <= 767px) {
- inset-block-end: max(8px, env(safe-area-inset-bottom));
- padding: 12px;
- }
- `,
- summary: css`
- flex: 1;
- min-width: 160px;
- `,
- actions: css`
- flex: none;
- flex-wrap: wrap;
- justify-content: flex-end;
+const completePop = stylex.keyframes({
+ '0%': { opacity: 0, transform: 'scale(0.5)' },
+ '55%': { transform: 'scale(1)' },
+ '100%': { opacity: 1, transform: 'scale(1)' },
+});
- > button {
- flex: none;
- }
+const reducedMotion = '@media (prefers-reduced-motion: reduce)';
+const phone = '@media (width <= 767px)';
+const narrow = '@media (width <= 480px)';
- @media (width <= 480px) {
- width: 100%;
+// The page's text measure, from the shared layout constants StyleX cannot read.
+const barMaxWidth = acceptanceContentLayout.maxWidth - 2 * acceptanceContentLayout.paddingInline;
- > button {
- flex: 1;
- }
- }
- `,
+const styles = stylex.create({
+ repairingArc: {
+ transformOrigin: 'center',
+ animationName: { default: orbit, [reducedMotion]: 'none' },
+ animationDuration: { default: '1.2s', [reducedMotion]: '0s' },
+ animationTimingFunction: { default: 'linear', [reducedMotion]: 'ease' },
+ animationIterationCount: { default: 'infinite', [reducedMotion]: 1 },
+ },
+ // Floats over the scrolling checklist — the decision stays reachable
+ // however deep the review goes.
+ bar: {
+ position: 'sticky',
+ zIndex: 20,
+ insetBlockEnd: { default: '16px', [phone]: 'max(8px, env(safe-area-inset-bottom))' },
+ display: 'flex',
+ flexWrap: 'wrap',
+ gap: '12px',
+ alignItems: 'center',
+ width: '100%',
+ marginInline: 'auto',
+ paddingBlock: '12px',
+ paddingInline: { default: '16px', [phone]: '12px' },
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorBgElevated,
+ backgroundImage: 'none',
+ boxShadow: cssVar.boxShadowTertiary,
+ },
+ summary: {
+ flex: '1',
+ minWidth: '160px',
+ },
+ actions: {
+ flex: 'none',
+ flexWrap: 'wrap',
+ justifyContent: 'flex-end',
+ width: { default: null, [narrow]: '100%' },
+ },
+ // The bar's own buttons (the old `.actions > button`).
+ actionButton: {
+ flex: { default: 'none', [narrow]: '1' },
+ },
// The completion mark springs in the instant review finishes — the felt beat
// the abrupt ring→disc swap never had, landing at the decision bar where the
// user's next action (accept / send back) already is, not behind a filter.
- completePop: css`
- @keyframes acceptance-decision-complete-pop {
- 0% {
- transform: scale(0.5);
- opacity: 0;
- }
-
- 55% {
- transform: scale(1);
- }
-
- 100% {
- transform: scale(1);
- opacity: 1;
- }
- }
-
- animation: acceptance-decision-complete-pop 0.2s ease-out both;
+ completePop: {
+ animationName: { default: completePop, [reducedMotion]: 'none' },
+ animationDuration: { default: '0.2s', [reducedMotion]: '0s' },
+ animationTimingFunction: { default: 'ease-out', [reducedMotion]: 'ease' },
+ animationFillMode: { default: 'both', [reducedMotion]: 'none' },
+ },
+});
- @media (prefers-reduced-motion: reduce) {
- animation: none;
- }
- `,
-}));
+const ActionButton = (props: ButtonProps) => (
+ <Button {...props} {...stylex.props(styles.actionButton)} />
+);
type BarState = 'accepted' | 'live' | 'rejected' | 'settled';
@@ -139,7 +128,7 @@ const RepairingMark = memo(() => {
strokeWidth={stroke}
/>
<circle
- className={styles.repairingArc}
+ {...stylex.props(styles.repairingArc)}
cx={size / 2}
cy={size / 2}
fill={'none'}
@@ -330,8 +319,8 @@ const DecisionBar = memo<DecisionBarProps>(
}, [reviewComplete]);
return (
- <div className={styles.bar}>
- <Flexbox horizontal align={'center'} className={styles.summary} gap={8}>
+ <div {...sx(styles.bar, { maxWidth: barMaxWidth })}>
+ <Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.summary)}>
{state === 'live' && repairing ? (
<RepairingMark />
) : stateMeta ? (
@@ -346,19 +335,17 @@ const DecisionBar = memo<DecisionBarProps>(
) : allConfirmed ? (
// Every check signed off — the same clean badge the accepted state carries.
<Icon
- className={justCompleted ? styles.completePop : undefined}
color={cssVar.colorSuccess}
icon={BadgeCheck}
size={22}
- style={{ flex: 'none' }}
+ {...sx(justCompleted && styles.completePop, { flex: 'none' })}
/>
) : settledNeedsFix ? (
<Icon
- className={justCompleted ? styles.completePop : undefined}
color={cssVar.colorWarning}
icon={CircleAlert}
size={22}
- style={{ flex: 'none' }}
+ {...sx(justCompleted && styles.completePop, { flex: 'none' })}
/>
) : (
<ProgressRing done={decidedCount} total={totalCount} />
@@ -410,36 +397,36 @@ const DecisionBar = memo<DecisionBarProps>(
// Not this viewer's call: the decision they are waiting on stays in
// view, disabled, so the bar says who decides instead of vanishing.
state === 'settled' && (
- <Flexbox horizontal className={styles.actions} gap={8}>
- <Button disabled title={readOnlyReason} type={'text'}>
+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>
+ <ActionButton disabled title={readOnlyReason} type={'text'}>
{t('acceptance.bar.rejectComment')}
- </Button>
- <Button disabled title={readOnlyReason} type={'fill'}>
+ </ActionButton>
+ <ActionButton disabled title={readOnlyReason} type={'fill'}>
{t('acceptance.actions.accept')}
- </Button>
+ </ActionButton>
</Flexbox>
)
) : rejectOnlyReason ? (
// Granted reject access only: sending back is theirs, accepting is not.
state === 'settled' && (
- <Flexbox horizontal className={styles.actions} gap={8}>
- <Button disabled={pending} type={'fill'} onClick={onRejectComment}>
+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>
+ <ActionButton disabled={pending} type={'fill'} onClick={onRejectComment}>
{t('acceptance.bar.rejectComment')}
- </Button>
- <Button disabled title={rejectOnlyReason} type={'fill'}>
+ </ActionButton>
+ <ActionButton disabled title={rejectOnlyReason} type={'fill'}>
{t('acceptance.actions.accept')}
- </Button>
+ </ActionButton>
</Flexbox>
)
) : (
- <Flexbox horizontal className={styles.actions} gap={8}>
+ <Flexbox horizontal gap={8} {...stylex.props(styles.actions)}>
{/* A dispatched send-back (repairing) keeps the copy entry alive —
the reviewer may still hand the prompt to another agent. Embedded,
the composer beside it already receives the draft. */}
{state === 'live' && hasFeedback && !embedded && (
- <Button disabled={pending} type={'fill'} onClick={onCopyReview}>
+ <ActionButton disabled={pending} type={'fill'} onClick={onCopyReview}>
{t('acceptance.bar.copyReview')}
- </Button>
+ </ActionButton>
)}
{(state === 'settled' || state === 'rejected') &&
@@ -449,41 +436,41 @@ const DecisionBar = memo<DecisionBarProps>(
<>
{/* Last words before the repair leaves — a global note the next
round reads, for what the queued per-check feedback missed. */}
- <Button
+ <ActionButton
disabled={pending}
icon={<Icon icon={MessageSquarePlus} />}
type={'fill'}
onClick={onAddComment}
>
{t('acceptance.bar.addComment')}
- </Button>
+ </ActionButton>
{/* One commit action per host: standalone copies the repair
prompt; embedded drafts it into the composer beside the bar. */}
{(!embedded || rerunAvailable) && (
- <Button
+ <ActionButton
disabled={pending}
loading={embedded && rerunPending}
type={'primary'}
onClick={embedded ? onRerun : onCopyReview}
>
{t(embedded ? 'acceptance.bar.rerun' : 'acceptance.bar.copyReview')}
- </Button>
+ </ActionButton>
)}
</>
) : (
// Clean review — accept carries primary weight only once every
// check is signed off; before that it stays a quiet option.
<>
- <Button disabled={pending} type={'text'} onClick={onRejectComment}>
+ <ActionButton disabled={pending} type={'text'} onClick={onRejectComment}>
{t('acceptance.bar.rejectComment')}
- </Button>
- <Button
+ </ActionButton>
+ <ActionButton
disabled={pending}
type={allConfirmed ? 'primary' : 'fill'}
onClick={onAccept}
>
{t('acceptance.actions.accept')}
- </Button>
+ </ActionButton>
</>
))}
</Flexbox>
diff --git a/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx
index 8c2c67330a7..7fcf1069376 100644
--- a/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx
+++ b/src/features/Acceptance/Viewer/Review/FeedbackDrawer.tsx
@@ -1,53 +1,43 @@
'use client';
import type { AcceptanceAttachment } from '@lobechat/types';
-import { createStaticStyles, cssVar, cx, Drawer, Flexbox, Text } from '@lobehub/ui';
+import { Drawer, Flexbox, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import dayjs from 'dayjs';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { AttachmentThumbs } from '../Evidence/attachments';
-const styles = createStaticStyles(({ css }) => ({
- clickable: css`
- cursor: pointer;
-
- &:hover {
- background: ${cssVar.colorFillQuaternary};
- }
- `,
- meta: css`
- flex: none;
- font-size: 11px;
- color: ${cssVar.colorTextQuaternary};
- white-space: nowrap;
- `,
- /* One feedback event as a list row — hairline-separated, no card chrome.
- The drawer is an audit trail; rows read as entries in a ledger. Roomy
- vertical rhythm: cramped rows made the trail read as one dense block. */
- row: css`
- padding-block: 20px;
- padding-inline: 8px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadius};
-
- &:last-child {
- border-block-end: none;
- }
- `,
- sectionTitle: css`
- font-size: 12px;
- font-weight: 500;
- color: ${cssVar.colorTextTertiary};
- letter-spacing: 0.04em;
- `,
- seq: css`
- flex: none;
- font-family: ${cssVar.fontFamilyCode};
- font-size: 11px;
- color: ${cssVar.colorTextSecondary};
- `,
-}));
+const styles = stylex.create({
+ clickable: {
+ cursor: 'pointer',
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillQuaternary },
+ backgroundImage: { 'default': null, ':hover': 'none' },
+ },
+ meta: { flex: 'none', fontSize: '11px', color: cssVar.colorTextQuaternary, whiteSpace: 'nowrap' },
+ row: {
+ paddingBlock: '20px',
+ paddingInline: '8px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: { 'default': 'solid', ':last-child': 'none' },
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadius,
+ },
+ sectionTitle: {
+ fontSize: '12px',
+ fontWeight: 500,
+ color: cssVar.colorTextTertiary,
+ letterSpacing: '0.04em',
+ },
+ seq: {
+ flex: 'none',
+ fontFamily: cssVar.fontFamilyCode,
+ fontSize: '11px',
+ color: cssVar.colorTextSecondary,
+ },
+});
/** One feedback event, flattened for the clearing list — check-scoped or group/global. */
export interface FeedbackListEntry {
@@ -94,7 +84,7 @@ const EntryRow = memo<{
return (
<Flexbox
- className={cx(styles.row, entry.checkId && styles.clickable)}
+ className={stylex.props(styles.row, entry.checkId ? styles.clickable : null).className}
gap={8}
role={entry.checkId ? 'button' : undefined}
style={entry.stale ? { opacity: 0.55 } : undefined}
@@ -114,7 +104,7 @@ const EntryRow = memo<{
<Flexbox horizontal align={'center'} gap={6} wrap={'wrap'}>
{isCheck ? (
<>
- <span className={styles.seq}>C{entry.checkSeq}</span>
+ <span {...stylex.props(styles.seq)}>C{entry.checkSeq}</span>
<Text ellipsis style={{ fontSize: 13, minWidth: 0 }}>
{entry.title}
</Text>
@@ -127,7 +117,7 @@ const EntryRow = memo<{
</Text>
)}
<Flexbox flex={1} />
- <span className={styles.meta}>{metaBits.join(' · ')}</span>
+ <span {...stylex.props(styles.meta)}>{metaBits.join(' · ')}</span>
</Flexbox>
{entry.comment && (
<Text style={{ fontSize: 12 }} type={'secondary'}>
@@ -160,7 +150,7 @@ const FeedbackDrawer = memo<FeedbackDrawerProps>(({ entries, onClose, onJumpToCh
>
<Flexbox gap={20}>
<Flexbox gap={4}>
- <Text className={styles.sectionTitle}>
+ <Text className={stylex.props(styles.sectionTitle).className}>
{t('acceptance.feedback.current', { count: active.length })}
</Text>
{active.length === 0 && (
@@ -176,7 +166,7 @@ const FeedbackDrawer = memo<FeedbackDrawerProps>(({ entries, onClose, onJumpToCh
</Flexbox>
{history.length > 0 && (
<Flexbox gap={4}>
- <Text className={styles.sectionTitle}>
+ <Text className={stylex.props(styles.sectionTitle).className}>
{t('acceptance.feedback.history', { count: history.length })}
</Text>
<Flexbox>
diff --git a/src/features/Acceptance/Viewer/Review/ProposalCard.tsx b/src/features/Acceptance/Viewer/Review/ProposalCard.tsx
index 0a6806ea658..33d3c5583a5 100644
--- a/src/features/Acceptance/Viewer/Review/ProposalCard.tsx
+++ b/src/features/Acceptance/Viewer/Review/ProposalCard.tsx
@@ -1,60 +1,47 @@
'use client';
-import { Button, createStaticStyles, cssVar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Button, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronDown, ChevronRight, Sparkles } from 'lucide-react';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import type { CheckProposal } from './proposal';
-const styles = createStaticStyles(({ css }) => ({
- /* Dashed and untinted: a proposal is a suggestion sitting next to real
- verdicts, so it must read as provisional rather than as another state the
- check has already reached. A solid tinted panel competed with the check's
- own status colour for the same glance. */
- card: css`
- padding-block: 8px;
- padding-inline: 10px;
- border: 1px dashed ${cssVar.colorBorder};
- border-radius: ${cssVar.borderRadiusLG};
- `,
- head: css`
- cursor: pointer;
- user-select: none;
- `,
- /* The collapsed line carries the whole claim, so the reviewer can skip the
- proposal without opening it. */
- preview: css`
- overflow: hidden;
- flex: 1;
-
- min-width: 0;
-
- font-size: 12px;
- text-overflow: ellipsis;
- white-space: nowrap;
- `,
- /* Quieter than `secondary` — these are provenance labels, not content. */
- muted: css`
- font-size: 11px;
- color: ${cssVar.colorTextQuaternary};
- `,
- regionIndex: css`
- flex: none;
-
- width: 16px;
- height: 16px;
- border-radius: 50%;
-
- font-size: 10px;
- font-weight: 600;
- line-height: 16px;
- color: #fff;
- text-align: center;
-
- background: ${cssVar.colorError};
- `,
-}));
+const styles = stylex.create({
+ card: {
+ paddingBlock: '8px',
+ paddingInline: '10px',
+ borderWidth: '1px',
+ borderStyle: 'dashed',
+ borderColor: cssVar.colorBorder,
+ borderRadius: cssVar.borderRadiusLG,
+ },
+ head: { cursor: 'pointer', userSelect: 'none' },
+ preview: {
+ overflow: 'hidden',
+ flex: '1',
+ minWidth: '0',
+ fontSize: '12px',
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+ muted: { fontSize: '11px', color: cssVar.colorTextQuaternary },
+ regionIndex: {
+ flex: 'none',
+ width: '16px',
+ height: '16px',
+ borderRadius: '50%',
+ fontSize: '10px',
+ fontWeight: 600,
+ lineHeight: '16px',
+ color: '#fff',
+ textAlign: 'center',
+ backgroundColor: cssVar.colorError,
+ backgroundImage: 'none',
+ },
+});
interface ProposalCardProps {
onAdjudicate: (adjudication: 'misidentified' | 'not-an-issue') => Promise<void> | void;
@@ -99,11 +86,11 @@ const ProposalCard = memo<ProposalCardProps>(
const regions = proposal.annotations ?? [];
return (
- <Flexbox className={styles.card} gap={open ? 8 : 0}>
+ <Flexbox className={stylex.props(styles.card).className} gap={open ? 8 : 0}>
<Flexbox
horizontal
align={'center'}
- className={styles.head}
+ className={stylex.props(styles.head).className}
gap={6}
onClick={() => onToggle(!open)}
>
@@ -116,13 +103,15 @@ const ProposalCard = memo<ProposalCardProps>(
card is open. Collapsed, the row's job is the finding itself —
a model id there just pushes the summary out of view. */}
{open && (
- <span className={styles.muted}>
+ <span {...stylex.props(styles.muted)}>
{proposal.provider}/{proposal.model}
</span>
)}
- {!open && proposal.comment && <span className={styles.preview}>{proposal.comment}</span>}
+ {!open && proposal.comment && (
+ <span {...stylex.props(styles.preview)}>{proposal.comment}</span>
+ )}
{!open && regions.length > 0 && (
- <span className={styles.muted}>
+ <span {...stylex.props(styles.muted)}>
{t('acceptance.proposal.regionCount', { count: regions.length })}
</span>
)}
@@ -135,7 +124,10 @@ const ProposalCard = memo<ProposalCardProps>(
{/* Numbers match the badges now drawn on the evidence image below. */}
{regions.map((region, index) => (
<Flexbox horizontal align={'flex-start'} gap={6} key={index}>
- <span className={styles.regionIndex} style={{ marginBlockStart: 2 }}>
+ <span
+ className={stylex.props(styles.regionIndex).className}
+ style={{ marginBlockStart: 2 }}
+ >
{index + 1}
</span>
<Text fontSize={12} type={'secondary'}>
diff --git a/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx
index 3fe8704f817..3e612034dd0 100644
--- a/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx
+++ b/src/features/Acceptance/Viewer/Review/RejectFeedbackPreview.tsx
@@ -1,6 +1,8 @@
'use client';
-import { Avatar, createStaticStyles, cssVar, cx, Flexbox, Icon, Text } from '@lobehub/ui';
+import { Avatar, Flexbox, Icon, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { ChevronDown, ChevronUp, CircleAlert, Loader2, MessagesSquare } from 'lucide-react';
import { memo, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -17,49 +19,47 @@ import {
rejectFeedbackPreviewState,
} from './rejectFeedback';
-const styles = createStaticStyles(({ css }) => ({
- avatarStack: css`
- flex: none;
-
- > * + * {
- margin-inline-start: -6px;
- box-shadow: 0 0 0 2px ${cssVar.colorBgElevated};
- }
- `,
- box: css`
- overflow: hidden;
- border: 1px solid ${cssVar.colorBorderSecondary};
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorFillQuaternary};
- `,
- body: css`
- padding-block: 0 10px;
- padding-inline: 12px;
- `,
- list: css`
- overflow-y: auto;
- max-height: 240px;
- `,
- row: css`
- padding-block: 10px;
- border-block-end: 1px solid ${cssVar.colorBorderSecondary};
-
- &:last-child {
- border-block-end: none;
- }
- `,
- summary: css`
- padding-block: 10px;
- padding-inline: 12px;
- `,
- toggle: css`
- cursor: pointer;
-
- &:hover {
- background: ${cssVar.colorFillTertiary};
- }
- `,
-}));
+const styles = stylex.create({
+ avatarStack: {
+ flex: 'none',
+ },
+ // Every avatar after the first tucks under its neighbour (the old `> * + *`).
+ avatarOverlap: {
+ marginInlineStart: '-6px',
+ boxShadow: `0 0 0 2px ${cssVar.colorBgElevated}`,
+ },
+ box: {
+ overflow: 'hidden',
+ borderWidth: '1px',
+ borderStyle: 'solid',
+ borderColor: cssVar.colorBorderSecondary,
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+ body: {
+ paddingBlockStart: 0,
+ paddingBlockEnd: '10px',
+ paddingInline: '12px',
+ },
+ list: {
+ overflowY: 'auto',
+ maxHeight: '240px',
+ },
+ row: {
+ paddingBlock: '10px',
+ borderBlockEndWidth: '1px',
+ borderBlockEndStyle: { 'default': 'solid', ':last-child': 'none' },
+ borderBlockEndColor: cssVar.colorBorderSecondary,
+ },
+ summary: {
+ paddingBlock: '10px',
+ paddingInline: '12px',
+ },
+ toggle: {
+ cursor: 'pointer',
+ backgroundColor: { 'default': null, ':hover': cssVar.colorFillTertiary },
+ },
+});
const useAuthorLabel = () => {
const { t } = useTranslation('verify');
@@ -69,14 +69,25 @@ const useAuthorLabel = () => {
: author.name || t('acceptance.reject.teammate');
};
-const AuthorAvatar = memo<{ author: RejectFeedbackItem['author']; label: string }>(
- ({ author, label }) =>
- author.kind === 'unknown' ? (
- <Avatar avatar={<Icon icon={MessagesSquare} size={12} />} size={20} />
- ) : (
- // First character only — a two-character CJK name wraps in a small circle.
- <Avatar avatar={author.avatar || label.slice(0, 1)} size={20} />
- ),
+const AuthorAvatar = memo<{
+ author: RejectFeedbackItem['author'];
+ label: string;
+ overlap?: boolean;
+}>(({ author, label, overlap }) =>
+ author.kind === 'unknown' ? (
+ <Avatar
+ avatar={<Icon icon={MessagesSquare} size={12} />}
+ size={20}
+ {...stylex.props(overlap && styles.avatarOverlap)}
+ />
+ ) : (
+ // First character only — a two-character CJK name wraps in a small circle.
+ <Avatar
+ avatar={author.avatar || label.slice(0, 1)}
+ size={20}
+ {...stylex.props(overlap && styles.avatarOverlap)}
+ />
+ ),
);
AuthorAvatar.displayName = 'AcceptanceRejectAuthorAvatar';
@@ -92,7 +103,7 @@ const FeedbackRow = memo<{ item: RejectFeedbackItem }>(({ item }) => {
].filter(Boolean);
return (
- <Flexbox horizontal className={styles.row} gap={8}>
+ <Flexbox horizontal gap={8} {...stylex.props(styles.row)}>
<AuthorAvatar author={item.author} label={authorLabel} />
<Flexbox flex={1} gap={4} style={{ minWidth: 0 }}>
<Flexbox horizontal align={'baseline'} gap={6} style={{ minWidth: 0 }}>
@@ -120,7 +131,7 @@ FeedbackRow.displayName = 'AcceptanceRejectFeedbackRow';
const Notice = memo<{ icon: typeof MessagesSquare; spin?: boolean; text: string }>(
({ icon, spin, text }) => (
- <Flexbox horizontal align={'center'} className={cx(styles.box, styles.summary)} gap={8}>
+ <Flexbox horizontal align={'center'} gap={8} {...stylex.props(styles.box, styles.summary)}>
<Icon color={cssVar.colorTextTertiary} icon={icon} size={16} spin={spin} />
<Text fontSize={13} type={'secondary'}>
{text}
@@ -189,15 +200,15 @@ const RejectFeedbackPreview = memo<{ acceptanceId: string }>(({ acceptanceId })
const toggle = () => setOpen((value) => !value);
return (
- <Flexbox className={styles.box}>
+ <Flexbox {...stylex.props(styles.box)}>
<Flexbox
horizontal
align={'center'}
aria-expanded={open}
- className={cx(styles.summary, styles.toggle)}
gap={8}
role={'button'}
tabIndex={0}
+ {...stylex.props(styles.summary, styles.toggle)}
onClick={toggle}
onKeyDown={(event) => {
if (event.key === 'Enter' || event.key === ' ') {
@@ -210,19 +221,19 @@ const RejectFeedbackPreview = memo<{ acceptanceId: string }>(({ acceptanceId })
<Text strong fontSize={13} style={{ flex: 1, minWidth: 0 }}>
{[t('acceptance.reject.included', { count: feedback.length }), ...breakdown].join(' · ')}
</Text>
- <Flexbox horizontal className={styles.avatarStack}>
- {faces.map(([label, author]) => (
- <AuthorAvatar author={author} key={label} label={label} />
+ <Flexbox horizontal {...stylex.props(styles.avatarStack)}>
+ {faces.map(([label, author], index) => (
+ <AuthorAvatar author={author} key={label} label={label} overlap={index > 0} />
))}
</Flexbox>
<Icon icon={open ? ChevronUp : ChevronDown} size={14} />
</Flexbox>
{open && (
- <Flexbox className={styles.body} gap={4}>
+ <Flexbox gap={4} {...stylex.props(styles.body)}>
<Text fontSize={12} type={'secondary'}>
{t('acceptance.reject.includedHint')}
</Text>
- <Flexbox className={styles.list}>
+ <Flexbox {...stylex.props(styles.list)}>
{feedback.map((item) => (
<FeedbackRow item={item} key={item.key} />
))}
diff --git a/src/features/Acceptance/Viewer/Review/modals.tsx b/src/features/Acceptance/Viewer/Review/modals.tsx
index 4e6a8e53564..85681d9dff1 100644
--- a/src/features/Acceptance/Viewer/Review/modals.tsx
+++ b/src/features/Acceptance/Viewer/Review/modals.tsx
@@ -3,14 +3,14 @@
import {
Button,
createModal,
- createStaticStyles,
- cssVar,
Flexbox,
type ModalInstance,
Text,
TextArea,
useModalContext,
} from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { t } from 'i18next';
import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
@@ -22,14 +22,15 @@ import {
} from '../Evidence/attachments';
import RejectFeedbackPreview from './RejectFeedbackPreview';
-const styles = createStaticStyles(({ css }) => ({
- warning: css`
- padding-block: 10px;
- padding-inline: 14px;
- border-radius: ${cssVar.borderRadiusLG};
- background: ${cssVar.colorWarningBg};
- `,
-}));
+const styles = stylex.create({
+ warning: {
+ paddingBlock: '10px',
+ paddingInline: '14px',
+ borderRadius: cssVar.borderRadiusLG,
+ backgroundColor: cssVar.colorWarningBg,
+ backgroundImage: 'none',
+ },
+});
/**
* A frosted scrim for the acceptance decision dialogs — the page behind reads
@@ -66,7 +67,7 @@ const AcceptContent = memo<AcceptContentProps>(({ exceptions, onConfirm, subject
<Flexbox gap={16}>
<Text>{translate('acceptance.accept.summary', { title: subjectTitle })}</Text>
{exceptions.length > 0 && (
- <Flexbox className={styles.warning} gap={4}>
+ <Flexbox className={stylex.props(styles.warning).className} gap={4}>
<Text strong fontSize={13}>
{translate('acceptance.accept.exceptionsTitle', { count: exceptions.length })}
</Text>
diff --git a/src/features/Acceptance/Viewer/Review/rejectModalShell.ts b/src/features/Acceptance/Viewer/Review/rejectModalShell.ts
index 0f1775c7b03..defe0ebcd4f 100644
--- a/src/features/Acceptance/Viewer/Review/rejectModalShell.ts
+++ b/src/features/Acceptance/Viewer/Review/rejectModalShell.ts
@@ -1,42 +1,47 @@
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- needs lobe-ui slot: createModal panel
import { createStaticStyles, cx } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
import { frostedModalStyles } from './modals';
export const CHECK_REJECT_MODAL_SIZE = { height: '98dvh', width: '98vw' } as const;
export const TEXT_REJECT_MODAL_WIDTH = 'min(560px, calc(100vw - 32px))';
+const phone = '@media (width <= 767px)';
+
/**
* The modal chrome, not its contents. These classes ride on the popup element
* that `createModal` owns, so they stay media-query driven: the shell has to
* answer for both breakpoints in one node, unlike the body, which mounts one
* presentation or the other.
*/
-const styles = createStaticStyles(({ css }) => ({
- mobileClose: css`
- @media (width <= 767px) {
- inset-block-start: max(4px, env(safe-area-inset-top));
- inset-inline-end: 4px;
- width: 44px;
- height: 44px;
- }
- `,
- mobileContent: css`
- @media (width <= 767px) {
- padding-block: 0 max(12px, env(safe-area-inset-bottom));
- padding-inline: 12px;
- }
- `,
- mobileHeader: css`
- @media (width <= 767px) {
- min-height: 56px;
- padding-block: max(12px, env(safe-area-inset-top)) 12px;
- padding-inline: 12px 52px;
- }
- `,
+const styles = stylex.create({
+ mobilePopup: {
+ maxWidth: { default: null, [phone]: '100vw' },
+ },
+ mobileClose: {
+ insetBlockStart: { default: null, [phone]: 'max(4px, env(safe-area-inset-top))' },
+ insetInlineEnd: { default: null, [phone]: '4px' },
+ width: { default: null, [phone]: '44px' },
+ height: { default: null, [phone]: '44px' },
+ },
+ mobileContent: {
+ paddingBlockStart: { default: null, [phone]: 0 },
+ paddingBlockEnd: { default: null, [phone]: 'max(12px, env(safe-area-inset-bottom))' },
+ paddingInline: { default: null, [phone]: '12px' },
+ },
+ mobileHeader: {
+ minHeight: { default: null, [phone]: '56px' },
+ paddingBlockStart: { default: null, [phone]: 'max(12px, env(safe-area-inset-top))' },
+ paddingBlockEnd: { default: null, [phone]: '12px' },
+ paddingInlineStart: { default: null, [phone]: '12px' },
+ paddingInlineEnd: { default: null, [phone]: '52px' },
+ },
+});
+
+const fallback = createStaticStyles(({ css }) => ({
mobilePopup: css`
@media (width <= 767px) {
- max-width: 100vw !important;
-
> div {
width: 100vw;
max-width: 100vw;
@@ -81,10 +86,15 @@ export const checkRejectModalShell = (evidenceCount: number) => {
const modalSize = checkRejectModalSize(evidenceCount);
return {
classNames: {
- close: styles.mobileClose,
- content: styles.mobileContent,
- header: styles.mobileHeader,
- popup: cx(styles.modalPopup, styles.mobilePopup, evidenceCount > 0 && styles.modalPopupMedia),
+ close: stylex.props(styles.mobileClose).className,
+ content: stylex.props(styles.mobileContent).className,
+ header: stylex.props(styles.mobileHeader).className,
+ popup: cx(
+ stylex.props(styles.mobilePopup).className,
+ fallback.modalPopup,
+ fallback.mobilePopup,
+ evidenceCount > 0 && fallback.modalPopupMedia,
+ ),
},
styles: {
...frostedModalStyles,
diff --git a/src/features/Acceptance/Viewer/index.tsx b/src/features/Acceptance/Viewer/index.tsx
index 40638dc89c1..12b3eef731e 100644
--- a/src/features/Acceptance/Viewer/index.tsx
+++ b/src/features/Acceptance/Viewer/index.tsx
@@ -1,9 +1,13 @@
'use client';
-import { createStaticStyles, cssVar, Flexbox } from '@lobehub/ui';
+import { Flexbox } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
import { useState } from 'react';
import { useParams } from 'react-router';
+import { sx } from '@/styles/sx';
+
import { extractUuid } from '../utils';
import { AcceptanceOverview } from './AcceptanceOverview';
import { AcceptanceBundleGate, AcceptanceScope } from './AcceptanceScope';
@@ -11,43 +15,35 @@ import CollaboratorConversationRail from './Conversation/CollaboratorConversatio
import { FlowPanelHostContext } from './Flow/FlowPanelHost';
import AcceptanceFocusWorkspace from './Focus/AcceptanceFocusWorkspace';
import AcceptanceLedgerRail from './History/AcceptanceLedgerRail';
-import { acceptanceScrollLayout } from './layout';
-
-const styles = createStaticStyles(({ css }) => ({
- contentFrame: css`
- overflow: ${acceptanceScrollLayout.frameOverflow};
- `,
- flowPanel: css`
- flex: none;
- width: min(440px, 42%);
- height: 100%;
- min-height: 0;
-
- &:empty {
- display: none;
- }
-
- @media (width <= 767px) {
- width: 100%;
- height: 50%;
- border-block-start: 1px solid ${cssVar.colorBorderSecondary};
- }
- `,
- page: css`
- position: relative;
-
- overflow: hidden;
- width: 100%;
- height: 100%;
+const phone = '@media (width <= 767px)';
- background: ${cssVar.colorBgContainer};
+// `overflow` repeats acceptanceScrollLayout.frameOverflow ('auto') from ./layout:
+// StyleX cannot read constants from another module.
+const styles = stylex.create({
+ contentFrame: {
+ overflow: 'auto',
+ },
+ flowPanel: {
+ flex: 'none',
+ width: { default: 'min(440px, 42%)', [phone]: '100%' },
+ height: { default: '100%', [phone]: '50%' },
+ minHeight: 0,
+ display: { 'default': null, ':empty': 'none' },
+ borderBlockStartWidth: { default: null, [phone]: '1px' },
+ borderBlockStartStyle: { default: null, [phone]: 'solid' },
+ borderBlockStartColor: { default: null, [phone]: cssVar.colorBorderSecondary },
+ },
+ page: {
+ position: 'relative',
+ overflow: 'hidden',
+ width: '100%',
+ height: '100%',
+ backgroundColor: cssVar.colorBgContainer,
+ flexDirection: { default: null, [phone]: 'column' },
+ },
+});
- @media (width <= 767px) {
- flex-direction: column;
- }
- `,
-}));
interface AcceptancePageProps {
acceptanceId?: string;
onDraftToComposer?: (text: string) => boolean;
@@ -69,13 +65,13 @@ const AcceptancePage = ({
<AcceptanceScope acceptanceId={acceptanceId} embedded={embedded}>
<AcceptanceBundleGate>
<FlowPanelHostContext value={flowPanelHost}>
- <Flexbox horizontal className={styles.page}>
+ <Flexbox horizontal {...stylex.props(styles.page)}>
<Flexbox
horizontal
flex={1}
style={{ minHeight: 0, minWidth: 0, position: 'relative' }}
>
- <Flexbox className={styles.contentFrame} flex={1} style={{ minWidth: 0 }}>
+ <Flexbox flex={1} {...sx(styles.contentFrame, { minWidth: 0 })}>
<Flexbox
flex={focused ? 1 : undefined}
gap={16}
@@ -88,7 +84,7 @@ const AcceptancePage = ({
<AcceptanceLedgerRail />
{!embedded && <CollaboratorConversationRail />}
</Flexbox>
- <div className={styles.flowPanel} ref={setFlowPanelHostContext} />
+ <div ref={setFlowPanelHostContext} {...stylex.props(styles.flowPanel)} />
</Flexbox>
</FlowPanelHostContext>
</AcceptanceBundleGate>
diff --git a/src/features/Acceptance/Viewer/markers.stylex.ts b/src/features/Acceptance/Viewer/markers.stylex.ts
new file mode 100644
index 00000000000..2291566d1d3
--- /dev/null
+++ b/src/features/Acceptance/Viewer/markers.stylex.ts
@@ -0,0 +1,15 @@
+import * as stylex from '@stylexjs/stylex';
+
+/**
+ * Hover / focus markers for StyleX `when.ancestor()` rules. Each is unique, so a
+ * hovered outer element never triggers a descendant rule meant for another one.
+ */
+export const groupHeaderMarker = stylex.defineMarker();
+export const rowHeaderMarker = stylex.defineMarker();
+export const timelineEntryMarker = stylex.defineMarker();
+export const roundHeaderMarker = stylex.defineMarker();
+export const floatingActionHostMarker = stylex.defineMarker();
+export const goalCardMarker = stylex.defineMarker();
+export const titleRowMarker = stylex.defineMarker();
+export const roundCardMarker = stylex.defineMarker();
+export const videoPlayerMarker = stylex.defineMarker();