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): replace plain CSS files with createStaticStyles fallbacks (#22444)

Innei14c46f8583c3
diff --git a/scripts/stylexMigration/plainCssImporters.json b/scripts/stylexMigration/plainCssImporters.json
index a40ec63f529..347c1f48b11 100644
--- a/scripts/stylexMigration/plainCssImporters.json
+++ b/scripts/stylexMigration/plainCssImporters.json
@@ -10,29 +10,6 @@
"packages/style-equivalence/test/fixtures/mini-project/host.tsx",
"scripts/stylexMigration/styleEquivalenceHost.tsx",
"scripts/stylexMigration/verification/fixtures/FixtureHost.tsx",
- "src/components/CodeEditorPane/index.tsx",
- "src/components/CommentList/CommentItem.tsx",
- "src/components/GalleyGrid/Grid.tsx",
- "src/components/GeneratingBorder/index.tsx",
- "src/components/GuideModal/index.tsx",
- "src/components/InlineTable/index.tsx",
- "src/components/Loading/BrandTextLoading/index.tsx",
- "src/components/Menu/index.tsx",
- "src/components/Skeleton/Settings/Section.tsx",
- "src/components/Skeleton/Settings/Sections.tsx",
- "src/features/Acceptance/Report/TerminalEvidence/playerStyle.ts",
- "src/features/Acceptance/Report/TerminalEvidence/styles.ts",
- "src/features/AgentChannel/PlatformDetail/Body.tsx",
- "src/features/Auth/OAuthCallback/Success.tsx",
- "src/features/Auth/OAuthDevice/DeviceSuccess.tsx",
- "src/features/ChatInput/ControlBar/BranchSwitcher.tsx",
- "src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx",
- "src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx",
- "src/features/CommunitySkillDetail/Details/Install/Platform.tsx",
- "src/features/CommunitySkillDetail/Details/Overview/index.tsx",
- "src/features/Conversation/Messages/index.tsx",
"src/initialize.ts",
- "src/layout/GlobalProvider/AppTheme.tsx",
- "src/routes/(main)/community/(detail)/features/ShareButton.tsx",
- "src/routes/(mobile)/_layout/NavBar.tsx"
+ "src/layout/GlobalProvider/AppTheme.tsx"
]
diff --git a/src/components/CodeEditorPane/index.tsx b/src/components/CodeEditorPane/index.tsx
index 6a9c2ac5125..ecf9e69b339 100644
--- a/src/components/CodeEditorPane/index.tsx
+++ b/src/components/CodeEditorPane/index.tsx
@@ -1,13 +1,13 @@
'use client';
-import './style.css';
-
import {
type CodeMirrorOptions,
type ICodeMirrorInstance,
loadCodeMirror,
lobeTheme,
} from '@lobehub/editor/codemirror';
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- CodeMirror renders its own DOM without slots
+import { createStaticStyles, cx } from '@lobehub/ui';
import { type CSSProperties, memo, useEffect, useMemo, useRef, useState } from 'react';
import { useIsDark } from '@/hooks/useIsDark';
@@ -16,6 +16,181 @@ import { detectIndentStyle } from './indent';
import { getEditorLanguage } from './language';
import StatusBar, { type CursorPosition } from './StatusBar';
+const fallback = createStaticStyles(({ css, cssVar }) => ({
+ container: css`
+ overflow: hidden;
+ display: flex;
+ flex-direction: column;
+
+ width: 100%;
+ height: 100%;
+
+ background: ${cssVar.colorBgContainer};
+
+ .cm-textarea {
+ height: 0;
+ opacity: 0;
+ }
+ `,
+ /*
+ * Selectors are one level deeper than the CodeMirror theme emits
+ * (.cm-editor.cm-editor) so these rules win regardless of which style sheet
+ * the browser inserted last.
+ */
+ editorArea: css`
+ overflow: hidden;
+ flex: 1;
+ min-height: 0;
+
+ .cm-editor {
+ height: 100%;
+ padding-block: 0;
+ }
+
+ /* Own the vertical scroll here rather than in an outer wrapper, so the
+ gutter and the fold markers stay pinned while the text scrolls. */
+ .cm-scroller {
+ overflow: auto;
+ font-variant-ligatures: none;
+ line-height: 20px;
+ }
+
+ .cm-editor.cm-editor span,
+ .cm-editor.cm-editor .cm-line {
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ line-height: 20px;
+ }
+
+ /* Clicking below the last line should still land in the document, the way
+ every desktop editor behaves. */
+ .cm-content {
+ min-height: 100%;
+ padding-block: 8px;
+ }
+
+ .cm-gutters {
+ user-select: none;
+ border-inline-end: 1px solid ${cssVar.colorBorderSecondary};
+ background: ${cssVar.colorBgContainer};
+ }
+
+ /* The bundled theme pads every line by 12px, which lands on top of the
+ gutter's own trailing space and pushes the code away from its number. */
+ .cm-editor.cm-editor .cm-line {
+ padding-inline: 6px 12px;
+ }
+
+ /* The number sits closer to the code than to the pane edge: it labels the
+ line, so the eye should travel from it rightwards, not across a gap. */
+ .cm-lineNumbers .cm-gutterElement {
+ min-width: 22px;
+ padding-inline: 16px 2px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 11px;
+ font-variant-numeric: tabular-nums;
+ line-height: 20px;
+ color: ${cssVar.colorTextQuaternary};
+ }
+
+ /* The bundle carries a base style that paints the caret's line and gutter a
+ hard-coded near-white, in dark mode too, and qualifies both of them with
+ the editor class. Naming that class twice is what outranks it: otherwise
+ the focused line reads as a white band with its punctuation washed out. */
+ .cm-editor.cm-editor .cm-activeLineGutter {
+ color: ${cssVar.colorText} !important;
+ background: transparent;
+ }
+
+ .cm-editor.cm-editor .cm-activeLine {
+ background: ${cssVar.colorFillQuaternary};
+ }
+
+ /* A focused editor gets the stronger cue; an unfocused one keeps a faint
+ marker so the caret position is still findable after a click elsewhere. */
+ .cm-editor.cm-editor:not(.cm-focused) .cm-activeLine {
+ background: transparent;
+ }
+
+ .cm-matchingBracket,
+ .cm-editor.cm-focused .cm-matchingBracket {
+ border-radius: 2px;
+ background: ${cssVar.colorFillSecondary};
+ outline: 1px solid ${cssVar.colorBorder};
+ }
+
+ .cm-nonmatchingBracket {
+ border-radius: 2px;
+ background: ${cssVar.colorErrorBg};
+ }
+
+ /* Fold markers render as empty divs; the chevron is entirely ours. */
+ .gutter-fold-open,
+ .gutter-fold-close {
+ cursor: pointer;
+
+ display: flex;
+ align-items: center;
+ justify-content: center;
+
+ width: 13px;
+ height: 20px;
+
+ color: ${cssVar.colorTextTertiary};
+
+ transition: opacity 0.15s;
+ }
+
+ .gutter-fold-open::before,
+ .gutter-fold-close::before {
+ content: '';
+
+ width: 5px;
+ height: 5px;
+ border-block-end: 1.4px solid currentcolor;
+ border-inline-end: 1.4px solid currentcolor;
+ }
+
+ /* Pointing down: this range is expanded. Only offered on gutter hover, so
+ the gutter is not a column of permanent arrows. */
+ .gutter-fold-open {
+ opacity: 0;
+ }
+
+ .gutter-fold-open::before {
+ transform: translateY(-1px) rotate(45deg);
+ }
+
+ /* Pointing right: content is hidden here, so this one always shows. */
+ .gutter-fold-close::before {
+ transform: translateX(-2px) rotate(-45deg);
+ }
+
+ .gutter-fold-open:hover,
+ .gutter-fold-close:hover {
+ color: ${cssVar.colorText};
+ }
+
+ .cm-gutters:hover .gutter-fold-open {
+ opacity: 1;
+ }
+
+ .cm-editor.cm-editor .cm-foldPlaceholder {
+ width: auto;
+ height: auto;
+ padding-inline: 6px;
+ border: 1px solid ${cssVar.colorBorderSecondary};
+ border-radius: 4px;
+
+ font-size: 11px;
+ color: ${cssVar.colorTextTertiary};
+
+ background: ${cssVar.colorFillTertiary};
+ }
+ `,
+}));
+
/**
* The parts of the underlying CodeMirror 6 view that the compat wrapper does
* not re-export. Reading the live selection is the only way to drive a cursor
@@ -215,11 +390,8 @@ const CodeEditorPane = memo<CodeEditorPaneProps>(
}, [isDark]);
return (
- <div
- className={`${'lobe-code-editor-pane-d8fecd5f-container'} ${className ?? ''}`.trim()}
- style={style}
- >
- <div className={'lobe-code-editor-pane-d8fecd5f-editor-area'}>
+ <div className={cx(fallback.container, className)} style={style}>
+ <div className={fallback.editorArea}>
<textarea className={'cm-textarea'} ref={textareaRef} />
</div>
{showStatusBar && (
diff --git a/src/components/CodeEditorPane/style.css b/src/components/CodeEditorPane/style.css
deleted file mode 100644
index bdabb6d54c8..00000000000
--- a/src/components/CodeEditorPane/style.css
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * The editor chrome. Selectors are one level deeper than the CodeMirror theme
- * emits (`.cm-editor.cm-editor`) so these rules win regardless of which style
- * sheet the browser inserted last.
- */
-.lobe-code-editor-pane-d8fecd5f-container {
- overflow: hidden;
- display: flex;
- flex-direction: column;
-
- width: 100%;
- height: 100%;
-
- background: var(--lobe-color-bg-container);
-}
-
-.lobe-code-editor-pane-d8fecd5f-container .cm-textarea {
- height: 0;
- opacity: 0;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area {
- overflow: hidden;
- flex: 1;
- min-height: 0;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor {
- height: 100%;
- padding-block: 0;
-}
-
-/* Own the vertical scroll here rather than in an outer wrapper, so the
- gutter and the fold markers stay pinned while the text scrolls. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-scroller {
- overflow: auto;
- font-variant-ligatures: none;
- line-height: 20px;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor span,
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor .cm-line {
- font-family: var(--lobe-font-family-code);
- font-size: 12px;
- line-height: 20px;
-}
-
-/* Clicking below the last line should still land in the document, the way
- every desktop editor behaves. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-content {
- min-height: 100%;
- padding-block: 8px;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-gutters {
- user-select: none;
- border-inline-end: 1px solid var(--lobe-color-border-secondary);
- background: var(--lobe-color-bg-container);
-}
-
-/* The bundled theme pads every line by 12px, which lands on top of the
- gutter's own trailing space and pushes the code away from its number. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor .cm-line {
- padding-inline: 6px 12px;
-}
-
-/* The number sits closer to the code than to the pane edge: it labels the
- line, so the eye should travel from it rightwards, not across a gap. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-lineNumbers .cm-gutterElement {
- min-width: 22px;
- padding-inline: 16px 2px;
-
- font-family: var(--lobe-font-family-code);
- font-size: 11px;
- font-variant-numeric: tabular-nums;
- line-height: 20px;
- color: var(--lobe-color-text-quaternary);
-}
-
-/* The bundle carries a base style that paints the caret's line and gutter a
- hard-coded near-white, in dark mode too, and qualifies both of them with
- the editor class. Naming that class twice is what outranks it: otherwise
- the focused line reads as a white band with its punctuation washed out. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor .cm-activeLineGutter {
- color: var(--lobe-color-text) !important;
- background: transparent;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor .cm-activeLine {
- background: var(--lobe-color-fill-quaternary);
-}
-
-/* A focused editor gets the stronger cue; an unfocused one keeps a faint
- marker so the caret position is still findable after a click elsewhere. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor:not(.cm-focused) .cm-activeLine {
- background: transparent;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-matchingBracket,
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-focused .cm-matchingBracket {
- border-radius: 2px;
- background: var(--lobe-color-fill-secondary);
- outline: 1px solid var(--lobe-color-border);
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-nonmatchingBracket {
- border-radius: 2px;
- background: var(--lobe-color-error-bg);
-}
-
-/* Fold markers render as empty divs; the chevron is entirely ours. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-open,
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-close {
- cursor: pointer;
-
- display: flex;
- align-items: center;
- justify-content: center;
-
- width: 13px;
- height: 20px;
-
- color: var(--lobe-color-text-tertiary);
-
- transition: opacity 0.15s;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-open::before,
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-close::before {
- content: '';
-
- width: 5px;
- height: 5px;
- border-block-end: 1.4px solid currentcolor;
- border-inline-end: 1.4px solid currentcolor;
-}
-
-/* Pointing down: this range is expanded. Only offered on gutter hover, so
- the gutter is not a column of permanent arrows. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-open {
- opacity: 0;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-open::before {
- transform: translateY(-1px) rotate(45deg);
-}
-
-/* Pointing right: content is hidden here, so this one always shows. */
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-close::before {
- transform: translateX(-2px) rotate(-45deg);
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-open:hover,
-.lobe-code-editor-pane-d8fecd5f-editor-area .gutter-fold-close:hover {
- color: var(--lobe-color-text);
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-gutters:hover .gutter-fold-open {
- opacity: 1;
-}
-
-.lobe-code-editor-pane-d8fecd5f-editor-area .cm-editor.cm-editor .cm-foldPlaceholder {
- width: auto;
- height: auto;
- padding-inline: 6px;
- border: 1px solid var(--lobe-color-border-secondary);
- border-radius: 4px;
-
- font-size: 11px;
- color: var(--lobe-color-text-tertiary);
-
- background: var(--lobe-color-fill-tertiary);
-}
diff --git a/src/components/CommentList/CommentItem.css b/src/components/CommentList/CommentItem.css
deleted file mode 100644
index ad91198019d..00000000000
--- a/src/components/CommentList/CommentItem.css
+++ /dev/null
@@ -1,28 +0,0 @@
-.lobe-comment-item-3223608e-content {
- font-size: 16px;
- line-height: 1.56;
- color: var(--lobe-color-text-secondary);
-}
-
-.lobe-comment-item-3223608e-content p {
- margin-block: 0;
-}
-
-.lobe-comment-item-3223608e-content p + p {
- margin-block-start: 0.72em;
-}
-
-.lobe-comment-item-3223608e-content a {
- color: var(--lobe-color-link);
-}
-
-.lobe-comment-item-3223608e-content strong {
- font-weight: 600;
- color: var(--lobe-color-text);
-}
-
-@media (width <= 575.98px) {
- .lobe-comment-item-3223608e-content {
- font-size: 15px;
- }
-}
diff --git a/src/components/CommentList/CommentItem.tsx b/src/components/CommentList/CommentItem.tsx
index 3420b18f275..7b30fc5bd3f 100644
--- a/src/components/CommentList/CommentItem.tsx
+++ b/src/components/CommentList/CommentItem.tsx
@@ -1,9 +1,14 @@
'use client';
-import './CommentItem.css';
-
import { AgentIcon } from '@lobehub/icons';
-import { Avatar, Flexbox, Markdown, Text } from '@lobehub/ui';
+import {
+ Avatar,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- rendered Markdown elements get no className
+ createStaticStyles,
+ Flexbox,
+ Markdown,
+ Text,
+} from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import { media } from '@lobehub/ui/stylex/media.stylex';
import * as stylex from '@stylexjs/stylex';
@@ -48,6 +53,35 @@ const styles = stylex.create({
},
});
+const fallback = createStaticStyles(({ css }) => ({
+ content: css`
+ font-size: 16px;
+ line-height: 1.56;
+ color: var(--lobe-color-text-secondary);
+
+ p {
+ margin-block: 0;
+ }
+
+ p + p {
+ margin-block-start: 0.72em;
+ }
+
+ a {
+ color: var(--lobe-color-link);
+ }
+
+ strong {
+ font-weight: 600;
+ color: var(--lobe-color-text);
+ }
+
+ @media (width <= 575.98px) {
+ font-size: 15px;
+ }
+ `,
+}));
+
const CommentItem = memo<{ item: SkillCommentItem }>(({ item }) => {
const { i18n, t } = useTranslation('discover');
const author = item.author;
@@ -105,7 +139,7 @@ const CommentItem = memo<{ item: SkillCommentItem }>(({ item }) => {
</Flexbox>
<Text className={stylex.props(styles.date).className}>{createdAt}</Text>
</Flexbox>
- <Markdown className={'lobe-comment-item-3223608e-content'} variant={'chat'}>
+ <Markdown className={fallback.content} variant={'chat'}>
{item.content}
</Markdown>
</Flexbox>
diff --git a/src/components/GalleyGrid/Grid.tsx b/src/components/GalleyGrid/Grid.tsx
index c50480c07e8..607184388de 100644
--- a/src/components/GalleyGrid/Grid.tsx
+++ b/src/components/GalleyGrid/Grid.tsx
@@ -1,11 +1,38 @@
-import './style.css';
-
-import { cx, Flexbox } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- grid cells are caller-provided children
+ createStaticStyles,
+ cx,
+ Flexbox,
+} from '@lobehub/ui';
import { type CSSProperties, type ReactNode } from 'react';
import { memo, useMemo } from 'react';
import { MAX_SIZE_DESKTOP, MIN_IMAGE_SIZE } from './style';
+const fallback = createStaticStyles(({ css }) => ({
+ container: css`
+ display: grid;
+ grid-gap: var(--galley-grid-gap, 6px);
+ grid-template-columns: repeat(var(--galley-grid-col, 3), 1fr);
+
+ width: 100%;
+ max-width: var(--galley-grid-max, 200px);
+
+ > div {
+ width: 100%;
+ min-width: var(--galley-grid-min, 64px);
+ min-height: var(--galley-grid-min, 64px);
+ max-height: calc(
+ (
+ var(--galley-grid-max, 200px) - var(--galley-grid-gap, 6px) *
+ (var(--galley-grid-col, 3) - 1)
+ ) /
+ var(--galley-grid-col, 3)
+ );
+ }
+ `,
+}));
+
interface GridProps {
children: ReactNode;
className?: string;
@@ -39,7 +66,7 @@ const Grid = memo<GridProps>(
return (
<Flexbox
horizontal
- className={cx('lobe-galley-grid-17c2ab70-container', className)}
+ className={cx(fallback.container, className)}
gap={gap}
style={{
...cssVariables,
diff --git a/src/components/GalleyGrid/style.css b/src/components/GalleyGrid/style.css
deleted file mode 100644
index 693466dc629..00000000000
--- a/src/components/GalleyGrid/style.css
+++ /dev/null
@@ -1,21 +0,0 @@
-.lobe-galley-grid-17c2ab70-container {
- display: grid;
- grid-gap: var(--galley-grid-gap, 6px);
- grid-template-columns: repeat(var(--galley-grid-col, 3), 1fr);
-
- width: 100%;
- max-width: var(--galley-grid-max, 200px);
-}
-
-.lobe-galley-grid-17c2ab70-container > div {
- width: 100%;
- min-width: var(--galley-grid-min, 64px);
- min-height: var(--galley-grid-min, 64px);
- max-height: calc(
- (
- var(--galley-grid-max, 200px) - var(--galley-grid-gap, 6px) *
- (var(--galley-grid-col, 3) - 1)
- ) /
- var(--galley-grid-col, 3)
- );
-}
diff --git a/src/components/GeneratingBorder/index.tsx b/src/components/GeneratingBorder/index.tsx
index 5afc46e9a83..0437fd3a044 100644
--- a/src/components/GeneratingBorder/index.tsx
+++ b/src/components/GeneratingBorder/index.tsx
@@ -1,8 +1,10 @@
'use client';
-import './property.css';
-
-import { Flexbox } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- StyleX has no API for a named @property registration
+ createStaticStyles,
+ Flexbox,
+} from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import { memo, type ReactNode } from 'react';
@@ -20,6 +22,19 @@ const sweep = stylex.keyframes({
to: { '--lobe-generating-border-angle': '360deg' } as SweepFrame,
});
+// `@property` is what makes the angle animatable: an unregistered custom property
+// jumps from 0deg to 360deg instead of sweeping. Emotion hoists the at-rule out of
+// the class, so it is registered once, document-wide.
+const fallback = createStaticStyles(({ css }) => ({
+ angleProperty: css`
+ @property --lobe-generating-border-angle {
+ inherits: false;
+ initial-value: 0deg;
+ syntax: '<angle>';
+ }
+ `,
+}));
+
const styles = stylex.create({
shell: { position: 'relative', borderRadius: '8px' },
// `overflow: hidden` belongs to the generating state only: on the resting
@@ -81,7 +96,15 @@ export interface GeneratingBorderProps {
*/
const GeneratingBorder = memo<GeneratingBorderProps>(
({ children, className, generating, style }) => (
- <Flexbox {...sx(styles.shell, generating && styles.shellGenerating, className, style)}>
+ <Flexbox
+ {...sx(
+ styles.shell,
+ generating && styles.shellGenerating,
+ fallback.angleProperty,
+ className,
+ style,
+ )}
+ >
{children}
</Flexbox>
),
diff --git a/src/components/GeneratingBorder/property.css b/src/components/GeneratingBorder/property.css
deleted file mode 100644
index 43ac8ad4737..00000000000
--- a/src/components/GeneratingBorder/property.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * `@property` is what makes the angle animatable — a plain custom property is
- * an unregistered token and jumps from 0deg to 360deg instead of sweeping.
- * Declared once here rather than per call site.
- */
-@property --lobe-generating-border-angle {
- inherits: false;
- initial-value: 0deg;
- syntax: '<angle>';
-}
diff --git a/src/components/GuideModal/GuideModal.css b/src/components/GuideModal/GuideModal.css
deleted file mode 100644
index 3b88f1274af..00000000000
--- a/src/components/GuideModal/GuideModal.css
+++ /dev/null
@@ -1,8 +0,0 @@
-.lobe-guide-modal-92efaf88-body h3 {
- margin: 0;
- font-weight: bold;
-}
-
-.lobe-guide-modal-92efaf88-body p {
- margin: 0;
-}
diff --git a/src/components/GuideModal/index.tsx b/src/components/GuideModal/index.tsx
index b4de7ae0381..2dae42d4dfa 100644
--- a/src/components/GuideModal/index.tsx
+++ b/src/components/GuideModal/index.tsx
@@ -1,11 +1,30 @@
'use client';
-import './GuideModal.css';
-
-import { Button, createModal, Flexbox, type ModalInstance, useModalContext } from '@lobehub/ui';
+import {
+ Button,
+ createModal,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- title and desc are caller-provided nodes under bare h3 / p
+ createStaticStyles,
+ Flexbox,
+ type ModalInstance,
+ useModalContext,
+} from '@lobehub/ui';
import { type ReactNode } from 'react';
import { memo } from 'react';
+const fallback = createStaticStyles(({ css }) => ({
+ body: css`
+ h3 {
+ margin: 0;
+ font-weight: bold;
+ }
+
+ p {
+ margin: 0;
+ }
+ `,
+}));
+
interface GuideModalContentProps {
cancelText?: ReactNode;
cover: ReactNode;
@@ -31,7 +50,7 @@ const GuideModalContent = memo<GuideModalContentProps>(
};
return (
- <Flexbox className={'lobe-guide-modal-92efaf88-body'}>
+ <Flexbox className={fallback.body}>
{cover}
<Flexbox gap={4} padding={16}>
<h3>{title}</h3>
diff --git a/src/components/InlineTable/InlineTable.css b/src/components/InlineTable/InlineTable.css
deleted file mode 100644
index 5b3cfa268f8..00000000000
--- a/src/components/InlineTable/InlineTable.css
+++ /dev/null
@@ -1,27 +0,0 @@
-.lobe-inline-table-b75cf865-table table {
- font-size: 13px;
-}
-
-.lobe-inline-table-b75cf865-table th {
- background: transparent;
- box-shadow: inset 0 999px 0 var(--lobe-color-fill-quaternary);
-}
-
-.lobe-inline-table-b75cf865-table td {
- border: none;
- background: transparent;
-}
-
-.lobe-inline-table-b75cf865-table tr:hover > td {
- background: var(--lobe-color-fill-quaternary);
-}
-
-.lobe-inline-table-b75cf865-table tr td:first-child,
-.lobe-inline-table-b75cf865-table tr th:first-child {
- padding-inline-start: 24px;
-}
-
-.lobe-inline-table-b75cf865-table tr td:last-child,
-.lobe-inline-table-b75cf865-table tr th:last-child {
- padding-inline-end: 24px;
-}
diff --git a/src/components/InlineTable/index.tsx b/src/components/InlineTable/index.tsx
index 45ef59a3d93..71881dc228f 100644
--- a/src/components/InlineTable/index.tsx
+++ b/src/components/InlineTable/index.tsx
@@ -1,6 +1,10 @@
-import './InlineTable.css';
-
-import { cx, Table, type TableProps } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- Table renders table cells without a slot
+ createStaticStyles,
+ cx,
+ Table,
+ type TableProps,
+} from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { sx } from '@/styles/sx';
@@ -11,6 +15,38 @@ const hoverStyles = stylex.create({
},
});
+const fallback = createStaticStyles(({ css, cssVar }) => ({
+ table: css`
+ table {
+ font-size: 13px;
+ }
+
+ th {
+ background: transparent;
+ box-shadow: inset 0 999px 0 ${cssVar.colorFillQuaternary};
+ }
+
+ td {
+ border: none;
+ background: transparent;
+ }
+
+ tr:hover > td {
+ background: ${cssVar.colorFillQuaternary};
+ }
+
+ tr td:first-child,
+ tr th:first-child {
+ padding-inline-start: 24px;
+ }
+
+ tr td:last-child,
+ tr th:last-child {
+ padding-inline-end: 24px;
+ }
+ `,
+}));
+
export type InlineTableProps<T> = TableProps<T> & { hoverToActive?: boolean };
const InlineTable = <T extends object>({
@@ -22,10 +58,7 @@ const InlineTable = <T extends object>({
pagination={false}
size={'small'}
className={
- sx(
- hoverToActive && hoverStyles.hoverToActive,
- cx('lobe-inline-table-b75cf865-table', className),
- ).className
+ sx(hoverToActive && hoverStyles.hoverToActive, cx(fallback.table, className)).className
}
{...rest}
/>
diff --git a/src/components/Loading/BrandTextLoading/index.css b/src/components/Loading/BrandTextLoading/index.css
deleted file mode 100644
index 17eb28264ae..00000000000
--- a/src/components/Loading/BrandTextLoading/index.css
+++ /dev/null
@@ -1,68 +0,0 @@
-.lobe-brand-text-loading-15b392f3-container {
- --brand-text-color: var(--colorText, #1f1f1f);
- --brand-muted-color: var(--colorTextSecondary, #8c8c8c);
- --brand-border-color: var(--colorBorder, #d9d9d9);
- --brand-tag-bg: var(--colorFillTertiary, rgb(0 0 0 / 4%));
-
- display: flex;
- flex-direction: column;
- gap: 12px;
- align-items: center;
- justify-content: center;
-
- width: 100%;
- height: 100vh;
- height: 100dvh;
-}
-
-[data-theme='dark'] .lobe-brand-text-loading-15b392f3-container {
- --brand-text-color: var(--colorText, #f0f0f0);
- --brand-muted-color: var(--colorTextSecondary, #a6a6a6);
- --brand-border-color: var(--colorBorder, #424242);
- --brand-tag-bg: var(--colorFillTertiary, rgb(255 255 255 / 8%));
-}
-
-.lobe-brand-text-loading-15b392f3-brand {
- display: flex;
- gap: 12px;
- align-items: center;
-
- color: var(--brand-text-color);
-
- opacity: 0.6;
-}
-
-.lobe-brand-text-loading-15b392f3-brand .lobe-brand-loading {
- display: block;
- color: inherit;
-}
-
-.lobe-brand-text-loading-15b392f3-debug-row {
- display: flex;
- gap: 8px;
- align-items: center;
-
- font-size: 12px;
- color: var(--brand-muted-color);
-}
-
-.lobe-brand-text-loading-15b392f3-debug-row code {
- font-family:
- ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
- monospace;
-}
-
-.lobe-brand-text-loading-15b392f3-debug-tag {
- display: inline-flex;
- align-items: center;
-
- padding-block: 2px;
- padding-inline: 8px;
- border-radius: 6px;
-
- background: var(--brand-tag-bg);
-}
-
-.lobe-brand-text-loading-15b392f3-debug-tag code {
- color: var(--brand-text-color);
-}
diff --git a/src/components/Loading/BrandTextLoading/index.tsx b/src/components/Loading/BrandTextLoading/index.tsx
index ca14991ca0b..545a6297823 100644
--- a/src/components/Loading/BrandTextLoading/index.tsx
+++ b/src/components/Loading/BrandTextLoading/index.tsx
@@ -1,5 +1,5 @@
-import './index.css';
-
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- BrandLoading renders its svg without a slot
+import { createStaticStyles } from '@lobehub/ui';
import { BrandLoading, LobeHubText } from '@lobehub/ui/brand';
import * as stylex from '@stylexjs/stylex';
@@ -7,6 +7,74 @@ import { isCustomBranding } from '@/const/version';
import CircleLoading from '../CircleLoading';
+const fallback = createStaticStyles(({ css }) => ({
+ brand: css`
+ display: flex;
+ gap: 12px;
+ align-items: center;
+
+ color: var(--brand-text-color);
+
+ opacity: 0.6;
+
+ .lobe-brand-loading {
+ display: block;
+ color: inherit;
+ }
+ `,
+ container: css`
+ --brand-text-color: var(--colorText, #1f1f1f);
+ --brand-muted-color: var(--colorTextSecondary, #8c8c8c);
+ --brand-border-color: var(--colorBorder, #d9d9d9);
+ --brand-tag-bg: var(--colorFillTertiary, rgb(0 0 0 / 4%));
+
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ align-items: center;
+ justify-content: center;
+
+ width: 100%;
+ height: 100vh;
+ height: 100dvh;
+
+ [data-theme='dark'] & {
+ --brand-text-color: var(--colorText, #f0f0f0);
+ --brand-muted-color: var(--colorTextSecondary, #a6a6a6);
+ --brand-border-color: var(--colorBorder, #424242);
+ --brand-tag-bg: var(--colorFillTertiary, rgb(255 255 255 / 8%));
+ }
+ `,
+ debugRow: css`
+ display: flex;
+ gap: 8px;
+ align-items: center;
+
+ font-size: 12px;
+ color: var(--brand-muted-color);
+
+ code {
+ font-family:
+ ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
+ monospace;
+ }
+ `,
+ debugTag: css`
+ display: inline-flex;
+ align-items: center;
+
+ padding-block: 2px;
+ padding-inline: 8px;
+ border-radius: 6px;
+
+ background: var(--brand-tag-bg);
+
+ code {
+ color: var(--brand-text-color);
+ }
+ `,
+}));
+
const stylesAtomic = stylex.create({
debug: {
display: 'flex',
@@ -25,7 +93,7 @@ interface BrandTextLoadingProps {
const BrandTextLoading = ({ debugId }: BrandTextLoadingProps) => {
if (isCustomBranding)
return (
- <div className={'lobe-brand-text-loading-15b392f3-container'}>
+ <div className={fallback.container}>
<CircleLoading />
</div>
);
@@ -33,15 +101,15 @@ const BrandTextLoading = ({ debugId }: BrandTextLoadingProps) => {
const showDebug = process.env.NODE_ENV === 'development' && debugId;
return (
- <div className={'lobe-brand-text-loading-15b392f3-container'}>
- <div aria-label="Loading" className={'lobe-brand-text-loading-15b392f3-brand'} role="status">
+ <div className={fallback.container}>
+ <div aria-label="Loading" className={fallback.brand} role="status">
<BrandLoading size={40} text={LobeHubText} />
</div>
{showDebug && (
<div {...stylex.props(stylesAtomic['debug'])}>
- <div className={'lobe-brand-text-loading-15b392f3-debug-row'}>
+ <div className={fallback.debugRow}>
<code>Debug ID:</code>
- <span className={'lobe-brand-text-loading-15b392f3-debug-tag'}>
+ <span className={fallback.debugTag}>
<code>{debugId}</code>
</span>
</div>
diff --git a/src/components/Menu/Menu.css b/src/components/Menu/Menu.css
deleted file mode 100644
index 1dc0cfd2665..00000000000
--- a/src/components/Menu/Menu.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.lobe-menu-8b666d35-inset > li:not([role='separator']) {
- margin-inline: 4px;
-}
diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx
index 566d816e897..56fb5ee50b5 100644
--- a/src/components/Menu/index.tsx
+++ b/src/components/Menu/index.tsx
@@ -1,15 +1,27 @@
-import './Menu.css';
-
-import { cx, List, type ListProps } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- List renders its li items without a slot
+ createStaticStyles,
+ cx,
+ List,
+ type ListProps,
+} from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import { memo } from 'react';
+const fallback = createStaticStyles(({ css }) => ({
+ inset: css`
+ > li:not([role='separator']) {
+ margin-inline: 4px;
+ }
+ `,
+}));
+
export type MenuProps = ListProps;
const Menu = memo<MenuProps>(
({ className, compact, selectable = false, styles: customStyles, ...rest }) => (
<List
- className={cx(!compact && 'lobe-menu-8b666d35-inset', className)}
+ className={cx(!compact && fallback.inset, className)}
compact={compact}
selectable={selectable}
styles={
diff --git a/src/components/Skeleton/Settings/Section.css b/src/components/Skeleton/Settings/Section.css
deleted file mode 100644
index 215aee23ef1..00000000000
--- a/src/components/Skeleton/Settings/Section.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* A loaded settings form renders its fields flush in the group body (each field
- pads itself), while a bare `Form.Group` pads the body by 16px on both ends. */
-.lobe-section-96565f37-group > :last-child {
- padding-block: 0;
-}
diff --git a/src/components/Skeleton/Settings/Section.tsx b/src/components/Skeleton/Settings/Section.tsx
index 6726e6d61bb..0e620f4058e 100644
--- a/src/components/Skeleton/Settings/Section.tsx
+++ b/src/components/Skeleton/Settings/Section.tsx
@@ -1,7 +1,5 @@
'use client';
-import './Section.css';
-
import { Flexbox } from '@lobehub/ui';
import { Form, type FormGroupItem, useForm } from '@lobehub/ui/form';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
@@ -11,6 +9,7 @@ import { type ReactNode } from 'react';
import { FORM_STYLE } from '@/const/layoutTokens';
import SkeletonBar from '../Bar';
+import { sectionGroupStyles } from './sectionGroupStyles';
const styles = stylex.create({
divider: {
@@ -109,7 +108,7 @@ const Group = ({
withDesc = true,
}: SettingsSectionSkeletonGroup) => (
<Form.Group
- className={'lobe-section-96565f37-group'}
+ className={sectionGroupStyles.group}
collapsible={false}
extra={extra}
variant={'filled'}
diff --git a/src/components/Skeleton/Settings/Sections.css b/src/components/Skeleton/Settings/Sections.css
deleted file mode 100644
index 4d09657736e..00000000000
--- a/src/components/Skeleton/Settings/Sections.css
+++ /dev/null
@@ -1,7 +0,0 @@
-.lobe-sections-05ee388b-flush {
- overflow: hidden;
-}
-
-.lobe-sections-05ee388b-flush [data-form-group-body] {
- padding: 0;
-}
diff --git a/src/components/Skeleton/Settings/Sections.tsx b/src/components/Skeleton/Settings/Sections.tsx
index a42b442f943..7077b05ea83 100644
--- a/src/components/Skeleton/Settings/Sections.tsx
+++ b/src/components/Skeleton/Settings/Sections.tsx
@@ -1,8 +1,10 @@
'use client';
-import './Sections.css';
-
-import { Flexbox } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- Form.Group renders its body without a slot
+ createStaticStyles,
+ Flexbox,
+} from '@lobehub/ui';
import { Form } from '@lobehub/ui/form';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
@@ -197,6 +199,16 @@ const styles = stylex.create({
},
});
+const fallback = createStaticStyles(({ css }) => ({
+ flush: css`
+ overflow: hidden;
+
+ [data-form-group-body] {
+ padding: 0;
+ }
+ `,
+}));
+
const widthAt = (index: number, widths: number[]) => widths[index % widths.length];
/** Matches the 16px/25px title line of a filled group head. */
@@ -235,7 +247,7 @@ const Group = ({
return (
<Form.Group
- className={flush ? 'lobe-sections-05ee388b-flush' : undefined}
+ className={flush ? fallback.flush : undefined}
collapsible={false}
desc={description ?? (desc || descKey ? <GroupDesc /> : undefined)}
extra={extraSize ? <SkeletonBar {...extraSize} /> : undefined}
diff --git a/src/components/Skeleton/Settings/sectionGroupStyles.ts b/src/components/Skeleton/Settings/sectionGroupStyles.ts
new file mode 100644
index 00000000000..5290e457616
--- /dev/null
+++ b/src/components/Skeleton/Settings/sectionGroupStyles.ts
@@ -0,0 +1,13 @@
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- Form.Group renders its body without a slot
+import { createStaticStyles } from '@lobehub/ui';
+
+/** Shared by the section skeleton and the tab skeletons that draw their own `Form.Group`. */
+export const sectionGroupStyles = createStaticStyles(({ css }) => ({
+ group: css`
+ /* A loaded settings form renders its fields flush in the group body (each field
+ pads itself), while a bare Form.Group pads the body by 16px on both ends. */
+ > :last-child {
+ padding-block: 0;
+ }
+ `,
+}));
diff --git a/src/components/Skeleton/Settings/tabs/ServiceModel.tsx b/src/components/Skeleton/Settings/tabs/ServiceModel.tsx
index 41540e3e0f9..7857c95c148 100644
--- a/src/components/Skeleton/Settings/tabs/ServiceModel.tsx
+++ b/src/components/Skeleton/Settings/tabs/ServiceModel.tsx
@@ -12,6 +12,7 @@ import {
import SkeletonBar from '../../Bar';
import SettingsSectionSkeleton from '../Section';
+import { sectionGroupStyles } from '../sectionGroupStyles';
import { useSkeletonText } from '../useSkeletonText';
import type { SettingsTabSkeleton } from './types';
@@ -35,7 +36,7 @@ const TierGroup = ({
title: string;
}) => (
<Form.Group
- className={'lobe-section-96565f37-group'}
+ className={sectionGroupStyles.group}
collapsible={false}
desc={text(desc, 220, 12)}
title={text(title, 80, 18)}
diff --git a/src/features/Acceptance/Report/TerminalEvidence/player.css b/src/features/Acceptance/Report/TerminalEvidence/player.css
deleted file mode 100644
index 2f0852e98ca..00000000000
--- a/src/features/Acceptance/Report/TerminalEvidence/player.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.lobe-player-15569863-screen .xterm {
- width: max-content;
-}
diff --git a/src/features/Acceptance/Report/TerminalEvidence/playerStyle.ts b/src/features/Acceptance/Report/TerminalEvidence/playerStyle.ts
index a4cdedb175d..c1bb98a6b8a 100644
--- a/src/features/Acceptance/Report/TerminalEvidence/playerStyle.ts
+++ b/src/features/Acceptance/Report/TerminalEvidence/playerStyle.ts
@@ -1,6 +1,8 @@
-import './player.css';
-
-import { cx } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- xterm renders its own DOM without slots
+ createStaticStyles,
+ cx,
+} from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
@@ -62,8 +64,16 @@ const definitions = stylex.create({
},
});
+const fallback = createStaticStyles(({ css }) => ({
+ screen: css`
+ .xterm {
+ width: max-content;
+ }
+ `,
+}));
+
export const styles = {
- screen: cx(stylex.props(definitions.screen).className ?? '', 'lobe-player-15569863-screen'),
+ screen: cx(stylex.props(definitions.screen).className ?? '', fallback.screen),
clock: stylex.props(definitions.clock).className ?? '',
rate: stylex.props(definitions.rate).className ?? '',
rateActive: stylex.props(definitions.rateActive).className ?? '',
diff --git a/src/features/Acceptance/Report/TerminalEvidence/relational.css b/src/features/Acceptance/Report/TerminalEvidence/relational.css
deleted file mode 100644
index fe14fa36edf..00000000000
--- a/src/features/Acceptance/Report/TerminalEvidence/relational.css
+++ /dev/null
@@ -1,20 +0,0 @@
-.lobe-relational-0c7e78c1-fold-header:hover [data-fold-title] {
- color: var(--lobe-color-text);
-}
-
-.lobe-relational-0c7e78c1-facts dt {
- color: var(--lobe-color-text-tertiary);
-}
-
-.lobe-relational-0c7e78c1-facts dd {
- min-width: 0;
- margin: 0;
- color: var(--lobe-color-text-secondary);
- overflow-wrap: anywhere;
-}
-
-@media (width <= 767px) {
- .lobe-relational-0c7e78c1-facts dd + dt {
- margin-block-start: 6px;
- }
-}
diff --git a/src/features/Acceptance/Report/TerminalEvidence/styles.ts b/src/features/Acceptance/Report/TerminalEvidence/styles.ts
index c3026fa4bfb..783dc8b3adc 100644
--- a/src/features/Acceptance/Report/TerminalEvidence/styles.ts
+++ b/src/features/Acceptance/Report/TerminalEvidence/styles.ts
@@ -1,6 +1,8 @@
-import './relational.css';
-
-import { cx } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- descendant hover and dl children are styled from their container
+ createStaticStyles,
+ cx,
+} from '@lobehub/ui';
import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
@@ -235,11 +237,34 @@ const definitions = stylex.create({
},
});
+const fallback = createStaticStyles(({ css }) => ({
+ facts: css`
+ dt {
+ color: var(--lobe-color-text-tertiary);
+ }
+
+ dd {
+ min-width: 0;
+ margin: 0;
+ color: var(--lobe-color-text-secondary);
+ overflow-wrap: anywhere;
+ }
+
+ @media (width <= 767px) {
+ dd + dt {
+ margin-block-start: 6px;
+ }
+ }
+ `,
+ foldHeader: css`
+ &:hover [data-fold-title] {
+ color: var(--lobe-color-text);
+ }
+ `,
+}));
+
export const styles = {
- foldHeader: cx(
- stylex.props(definitions.foldHeader).className ?? '',
- 'lobe-relational-0c7e78c1-fold-header',
- ),
+ foldHeader: cx(stylex.props(definitions.foldHeader).className ?? '', fallback.foldHeader),
foldChevron: stylex.props(definitions.foldChevron).className ?? '',
foldChevronOpen: stylex.props(definitions.foldChevronOpen).className ?? '',
foldIcon: stylex.props(definitions.foldIcon).className ?? '',
@@ -251,7 +276,7 @@ export const styles = {
command: stylex.props(definitions.command).className ?? '',
commandText: stylex.props(definitions.commandText).className ?? '',
commandPrompt: stylex.props(definitions.commandPrompt).className ?? '',
- facts: cx(stylex.props(definitions.facts).className ?? '', 'lobe-relational-0c7e78c1-facts'),
+ facts: cx(stylex.props(definitions.facts).className ?? '', fallback.facts),
mono: stylex.props(definitions.mono).className ?? '',
inlineList: stylex.props(definitions.inlineList).className ?? '',
linkButton: stylex.props(definitions.linkButton).className ?? '',
diff --git a/src/features/AgentChannel/PlatformDetail/Body.css b/src/features/AgentChannel/PlatformDetail/Body.css
deleted file mode 100644
index fe9afc049ca..00000000000
--- a/src/features/AgentChannel/PlatformDetail/Body.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * A settings block with a Save in the corner of its header. The group header sizes its title to the
- * text and never wraps it, so a long description pushed the Save out of the card; let the title give
- * way instead. Scoped plain CSS because the header is the form library's own DOM.
- */
-.lobe-body-2aeb75a4-module-group .lobe-form-form__group-header {
- gap: 12px;
-}
-
-.lobe-body-2aeb75a4-module-group .lobe-form-form__group-header > .lobe-form-form__group-title {
- flex: 1 1 0;
- min-width: 0;
-}
diff --git a/src/features/AgentChannel/PlatformDetail/Body.tsx b/src/features/AgentChannel/PlatformDetail/Body.tsx
index e3ff2ae1f2c..835283ef7e9 100644
--- a/src/features/AgentChannel/PlatformDetail/Body.tsx
+++ b/src/features/AgentChannel/PlatformDetail/Body.tsx
@@ -1,8 +1,13 @@
'use client';
-import './Body.css';
-
-import { Button, confirmModal, Flexbox, Text } from '@lobehub/ui';
+import {
+ Button,
+ confirmModal,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- Form.Group renders its header without a slot
+ createStaticStyles,
+ Flexbox,
+ Text,
+} from '@lobehub/ui';
import { Form, type FormInstance, useWatch } from '@lobehub/ui/form';
import { RotateCcw } from 'lucide-react';
import { Fragment, memo, type ReactNode, useCallback, useMemo, useState } from 'react';
@@ -39,6 +44,24 @@ import {
WAKE_KEY_PREFIX,
} from './settingsGroups';
+/*
+ * A settings block with a Save in the corner of its header. The group header sizes its title to the
+ * text and never wraps it, so a long description pushed the Save out of the card; let the title give
+ * way instead.
+ */
+const fallback = createStaticStyles(({ css }) => ({
+ moduleGroup: css`
+ .lobe-form-form__group-header {
+ gap: 12px;
+ }
+
+ .lobe-form-form__group-header > .lobe-form-form__group-title {
+ flex: 1 1 0;
+ min-width: 0;
+ }
+ `,
+}));
+
/**
* What the page hands the body so each block can show its own Save: which blocks exist, which
* hold unsaved changes, and which one is being saved. Absent while a bot is still being created,
@@ -296,7 +319,7 @@ const Body = memo<BodyProps>(
fold away; a new bot has nothing else to do but fill them in. */}
{(groupCredentialFields.length > 0 || showApplicationId || showExtras) && (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={!!hasConfig || inlineKeys.size > 0}
defaultActive={!hasConfig && inlineKeys.size === 0}
desc={t('channel.group.credentialsDesc')}
@@ -359,7 +382,7 @@ const Body = memo<BodyProps>(
)}
{connectGroup && (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={false}
extra={moduleExtra('connection')}
keyValue={`settings-connect-${platformDef.id}`}
@@ -395,7 +418,7 @@ const Body = memo<BodyProps>(
// three separate decisions, so each gets a block (and a Save) of its own.
groupAccessFields(group.fields).map((section) => (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={false}
extra={moduleExtra(`access-${section.key}`)}
key={section.key}
@@ -423,7 +446,7 @@ const Body = memo<BodyProps>(
// it is a block of its own with a Save.
groupReplyFields(group.fields).map((section) => (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={false}
extra={section.key === 'style' ? moduleExtra('reply-style') : undefined}
key={section.key}
@@ -447,7 +470,7 @@ const Body = memo<BodyProps>(
.filter(wakeSectionShown)
.map((section) => (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={false}
key={section.key}
keyValue={`settings-wake-${section.key}-${platformDef.id}`}
@@ -467,7 +490,7 @@ const Body = memo<BodyProps>(
))
) : (
<Form.Group
- className={'lobe-body-2aeb75a4-module-group'}
+ className={fallback.moduleGroup}
collapsible={false}
extra={moduleExtra(group.key as SaveModuleId)}
keyValue={`settings-${group.key}-${platformDef.id}`}
diff --git a/src/features/Auth/OAuthCallback/Success.tsx b/src/features/Auth/OAuthCallback/Success.tsx
index e49cc741368..40bafcbcb39 100644
--- a/src/features/Auth/OAuthCallback/Success.tsx
+++ b/src/features/Auth/OAuthCallback/Success.tsx
@@ -1,12 +1,12 @@
'use client';
-import '../resultStyles.css';
-
import { FluentEmoji, Result, Text } from '@lobehub/ui';
import React, { memo, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSearchParams } from 'react-router';
+import { resultStyles } from '../resultStyles';
+
const SuccessPage = memo(() => {
const { t } = useTranslation('oauth');
const [searchParams] = useSearchParams();
@@ -48,7 +48,7 @@ const SuccessPage = memo(() => {
return (
<Result
- className={'lobe-result-styles-cb01c08e-full-width-sub-title'}
+ className={resultStyles.fullWidthSubTitle}
icon={<FluentEmoji emoji={'✅'} size={96} type={'anim'} />}
status="success"
subTitle={
diff --git a/src/features/Auth/OAuthDevice/DeviceSuccess.tsx b/src/features/Auth/OAuthDevice/DeviceSuccess.tsx
index e3fe7f08009..e2800e9bcaf 100644
--- a/src/features/Auth/OAuthDevice/DeviceSuccess.tsx
+++ b/src/features/Auth/OAuthDevice/DeviceSuccess.tsx
@@ -1,17 +1,17 @@
'use client';
-import '../resultStyles.css';
-
import { FluentEmoji, Result, Text } from '@lobehub/ui';
import React, { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { resultStyles } from '../resultStyles';
+
const DeviceSuccess = memo(() => {
const { t } = useTranslation('oauth');
return (
<Result
- className={'lobe-result-styles-cb01c08e-full-width-sub-title'}
+ className={resultStyles.fullWidthSubTitle}
icon={<FluentEmoji emoji={'✅'} size={96} type={'anim'} />}
status="success"
subTitle={
diff --git a/src/features/Auth/resultStyles.css b/src/features/Auth/resultStyles.css
deleted file mode 100644
index 0a4bfcf5c36..00000000000
--- a/src/features/Auth/resultStyles.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* Result caps the subtitle at 36ch, which makes it narrower than the title.
- Keep the subtitle paragraph at full width inside the Result root. */
-.lobe-result-styles-cb01c08e-full-width-sub-title p {
- max-width: 100%;
-}
diff --git a/src/features/Auth/resultStyles.ts b/src/features/Auth/resultStyles.ts
new file mode 100644
index 00000000000..7629619dce0
--- /dev/null
+++ b/src/features/Auth/resultStyles.ts
@@ -0,0 +1,10 @@
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- Result renders its subtitle paragraph without a slot
+import { createStaticStyles } from '@lobehub/ui';
+
+export const resultStyles = createStaticStyles(({ css }) => ({
+ fullWidthSubTitle: css`
+ p {
+ max-width: 100%;
+ }
+ `,
+}));
diff --git a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
index fb432d01463..ecc13ffa707 100644
--- a/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
+++ b/src/features/ChatInput/ControlBar/BranchSwitcher.tsx
@@ -1,5 +1,3 @@
-import './gitMenuTrigger.css';
-
import type { DeviceGitWorktreeListItem } from '@lobechat/types';
import {
confirmModal,
@@ -48,6 +46,7 @@ import { gitService } from '@/services/git';
import { useFetchGitWorkingTreeStatus } from '@/store/device';
import { openCreateBranchModal } from './CreateBranchModal';
+import { gitMenuTriggerStyles } from './gitMenuTrigger';
import { openRenameBranchModal } from './RenameBranchModal';
import { useBranchList } from './useBranchList';
import { useSwitchWorktree } from './useSwitchWorktree';
@@ -437,7 +436,7 @@ const BranchSwitcher = memo<BranchSwitcherProps>(
return (
<DropdownMenuRoot open={open} onOpenChange={onOpenChange}>
<DropdownMenuTrigger>
- <div className={'lobe-git-menu-trigger-7cf96368-trigger'}>{children}</div>
+ <div className={gitMenuTriggerStyles.trigger}>{children}</div>
</DropdownMenuTrigger>
<DropdownMenuPortal>
<DropdownMenuPositioner placement={placement} sideOffset={8}>
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.css b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.css
deleted file mode 100644
index 53e0e9a3dae..00000000000
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.css
+++ /dev/null
@@ -1,13 +0,0 @@
-.lobe-quota-account-manager-modal-2f1ccb6d-radio-group {
- width: 100%;
-}
-
-/* Targets the RadioGroup's own label / text DOM, which has no className hook. */
-.lobe-quota-account-manager-modal-2f1ccb6d-radio-group > label {
- width: 100%;
-}
-
-.lobe-quota-account-manager-modal-2f1ccb6d-radio-group > label > span:last-child {
- flex: 1;
- min-width: 0;
-}
diff --git a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx
index d9b43fa0a5a..bc497af3f28 100644
--- a/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx
+++ b/src/features/ChatInput/ControlBar/HeteroControlBar/QuotaMenu/QuotaAccountManagerModal.tsx
@@ -1,7 +1,5 @@
'use client';
-import './QuotaAccountManagerModal.css';
-
import { isDesktop } from '@lobechat/const';
import {
currentUtilization,
@@ -12,6 +10,8 @@ import {
ActionIcon,
Button,
createModal,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- RadioGroup renders its label / text DOM without a slot
+ createStaticStyles,
DropdownMenu,
Flexbox,
Icon,
@@ -78,6 +78,21 @@ const styles = stylex.create({
rowOff: { opacity: 0.5 },
});
+const fallback = createStaticStyles(({ css }) => ({
+ radioGroup: css`
+ width: 100%;
+
+ > label {
+ width: 100%;
+ }
+
+ > label > span:last-child {
+ flex: 1;
+ min-width: 0;
+ }
+ `,
+}));
+
type Account = QuotaAccount;
type Binding = QuotaBinding;
type QuotaReading = QuotaLatestReading;
@@ -417,7 +432,7 @@ const QuotaAccountManager = memo<QuotaAccountManagerProps>(({ agentId, deviceId
<AccountReadingsSync accountId={a.id} key={a.id} />
))}
<RadioGroup
- className={'lobe-quota-account-manager-modal-2f1ccb6d-radio-group'}
+ className={fallback.radioGroup}
gap={2}
horizontal={false}
// Which mode is active is unknown until the bindings are on screen. The
diff --git a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx
index a23bd6eac92..df895684383 100644
--- a/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx
+++ b/src/features/ChatInput/ControlBar/WorktreeSwitcher.tsx
@@ -1,5 +1,3 @@
-import './gitMenuTrigger.css';
-
import { deriveWorktreePath, type DeviceGitWorktreeListItem } from '@lobechat/types';
import {
confirmModal,
@@ -41,6 +39,7 @@ import { useTranslation } from 'react-i18next';
import { gitService } from '@/services/git';
import { openCreateWorktreeModal } from './CreateWorktreeModal';
+import { gitMenuTriggerStyles } from './gitMenuTrigger';
import { useSwitchWorktree } from './useSwitchWorktree';
import { useWorktreeHomeDir } from './useWorktreeHomeDir';
import { getPathName, isDisabled, normalizeDisplayPath } from './worktreeHelpers';
@@ -599,7 +598,7 @@ const WorktreeSwitcher = memo<WorktreeSwitcherProps>(
<DropdownMenuTrigger>
<div
aria-disabled={disabled}
- className={'lobe-git-menu-trigger-7cf96368-trigger'}
+ className={gitMenuTriggerStyles.trigger}
data-disabled={disabled || undefined}
>
{open ? trigger : <Tooltip title={triggerTitle}>{trigger}</Tooltip>}
diff --git a/src/features/ChatInput/ControlBar/gitMenuTrigger.css b/src/features/ChatInput/ControlBar/gitMenuTrigger.css
deleted file mode 100644
index c30e9af464c..00000000000
--- a/src/features/ChatInput/ControlBar/gitMenuTrigger.css
+++ /dev/null
@@ -1,32 +0,0 @@
-.lobe-git-menu-trigger-7cf96368-trigger {
- display: inline-flex;
- flex: none;
- min-width: 0;
-}
-
-/* The stable menu anchor must not paint behind the child's rounded chip or
- overview row. Keep hover and popup-open feedback on that same surface. */
-.lobe-git-menu-trigger-7cf96368-trigger.lobe-git-menu-trigger-7cf96368-trigger.lobe-git-menu-trigger-7cf96368-trigger[data-popup-open] {
- background: transparent;
-}
-
-/* Child rules use !important: the chips inside are StyleX-styled, and StyleX
- longhands (raised specificity) would otherwise beat these selectors. */
-
-/* A column host stretches the anchor for overview rows; compact composer
- chips use their intrinsic width instead of 100% of the whole git group. */
-.lobe-git-menu-trigger-7cf96368-trigger.lobe-git-menu-trigger-7cf96368-trigger > * {
- flex: 1 !important;
- min-width: 0 !important;
-}
-
-.lobe-git-menu-trigger-7cf96368-trigger[data-popup-open] > * {
- background: var(--lobe-color-fill-tertiary) !important;
-}
-
-/* Stale-first: the trigger stays in place (no layout jump) but cannot
- checkout until the current probe confirms the branch. */
-.lobe-git-menu-trigger-7cf96368-trigger[aria-disabled='true'] > * {
- cursor: not-allowed !important;
- opacity: 0.6 !important;
-}
diff --git a/src/features/ChatInput/ControlBar/gitMenuTrigger.ts b/src/features/ChatInput/ControlBar/gitMenuTrigger.ts
new file mode 100644
index 00000000000..0e9878f1fb7
--- /dev/null
+++ b/src/features/ChatInput/ControlBar/gitMenuTrigger.ts
@@ -0,0 +1,37 @@
+// oxlint-disable-next-line stylex-migration/no-emotion-styles -- the trigger restyles caller-provided chips it cannot pass props to
+import { createStaticStyles } from '@lobehub/ui';
+
+export const gitMenuTriggerStyles = createStaticStyles(({ css, cssVar }) => ({
+ trigger: css`
+ display: inline-flex;
+ flex: none;
+ min-width: 0;
+
+ /* The stable menu anchor must not paint behind the child's rounded chip or
+ overview row. Keep hover and popup-open feedback on that same surface. */
+ &&&[data-popup-open] {
+ background: transparent;
+ }
+
+ /* Child rules use !important: the chips inside are StyleX-styled, and StyleX
+ longhands (raised specificity) would otherwise beat these selectors. */
+
+ /* A column host stretches the anchor for overview rows; compact composer
+ chips use their intrinsic width instead of 100% of the whole git group. */
+ && > * {
+ flex: 1 !important;
+ min-width: 0 !important;
+ }
+
+ &[data-popup-open] > * {
+ background: ${cssVar.colorFillTertiary} !important;
+ }
+
+ /* Stale-first: the trigger stays in place (no layout jump) but cannot
+ checkout until the current probe confirms the branch. */
+ &[aria-disabled='true'] > * {
+ cursor: not-allowed !important;
+ opacity: 0.6 !important;
+ }
+ `,
+}));
diff --git a/src/features/CommunitySkillDetail/Details/Install/Platform.css b/src/features/CommunitySkillDetail/Details/Install/Platform.css
deleted file mode 100644
index 69864efa995..00000000000
--- a/src/features/CommunitySkillDetail/Details/Install/Platform.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.lobe-platform-535c8dc5-lite pre {
- padding: 12px !important;
-}
diff --git a/src/features/CommunitySkillDetail/Details/Install/Platform.tsx b/src/features/CommunitySkillDetail/Details/Install/Platform.tsx
index 9d552bfa765..e3448f38922 100644
--- a/src/features/CommunitySkillDetail/Details/Install/Platform.tsx
+++ b/src/features/CommunitySkillDetail/Details/Install/Platform.tsx
@@ -1,13 +1,13 @@
'use client';
-import './Platform.css';
-
import { AGENT_CHAT_URL, DEFAULT_INBOX_AVATAR } from '@lobechat/const';
import { Claude, Cline, Cursor, OpenAI } from '@lobehub/icons';
import {
Avatar,
Block,
Button,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- Highlighter renders its pre without a slot
+ createStaticStyles,
Divider,
Flexbox,
Highlighter,
@@ -30,6 +30,14 @@ import { useDetailActionContext } from '../../DetailProvider';
import { getSkillInstructionsUrl } from './getSkillInstructionsUrl';
import VsCodeIcon from './VsCodeIcon';
+const fallback = createStaticStyles(({ css }) => ({
+ lite: css`
+ pre {
+ padding: 12px !important;
+ }
+ `,
+}));
+
const Title = ({ children }: { children?: React.ReactNode }) => (
<Text as={'h3'} fontSize={16} style={{ margin: 0, paddingInline: 8 }} weight={600}>
{children}
@@ -247,7 +255,7 @@ const Platform = memo<PlatformProps>(
<Highlighter
fullFeatured
wrap
- className={lite ? 'lobe-platform-535c8dc5-lite' : undefined}
+ className={lite ? fallback.lite : undefined}
defaultExpand={expandCodeByDefault ?? false}
fileName={'Agent prompt'}
language={'bash'}
@@ -306,7 +314,7 @@ const Platform = memo<PlatformProps>(
{lite && <Divider dashed />}
<Highlighter
fullFeatured
- className={lite ? 'lobe-platform-535c8dc5-lite' : undefined}
+ className={lite ? fallback.lite : undefined}
defaultExpand={expandCodeByDefault ?? false}
fileName={t('skills.details.sidebar.installCommand')}
language={'bash'}
@@ -318,7 +326,7 @@ const Platform = memo<PlatformProps>(
{lite && <Divider dashed />}
<Highlighter
fullFeatured
- className={lite ? 'lobe-platform-535c8dc5-lite' : undefined}
+ className={lite ? fallback.lite : undefined}
defaultExpand={false}
fileName={t('skills.details.sidebar.directoryLayout')}
language={'text'}
diff --git a/src/features/CommunitySkillDetail/Details/Overview/Overview.css b/src/features/CommunitySkillDetail/Details/Overview/Overview.css
deleted file mode 100644
index c0c87d79707..00000000000
--- a/src/features/CommunitySkillDetail/Details/Overview/Overview.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.lobe-overview-22f20c33-summary p {
- margin-block: 0 0.8em;
-}
diff --git a/src/features/CommunitySkillDetail/Details/Overview/index.tsx b/src/features/CommunitySkillDetail/Details/Overview/index.tsx
index f1ce525fe1f..f1b8d175ca1 100644
--- a/src/features/CommunitySkillDetail/Details/Overview/index.tsx
+++ b/src/features/CommunitySkillDetail/Details/Overview/index.tsx
@@ -1,11 +1,11 @@
'use client';
-import './Overview.css';
-
import {
Accordion,
Block,
Button,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- rendered Markdown paragraphs get no className
+ createStaticStyles,
Flexbox,
Icon,
Markdown,
@@ -55,6 +55,14 @@ const styles = stylex.create({
},
});
+const fallback = createStaticStyles(({ css }) => ({
+ summary: css`
+ p {
+ margin-block: 0 0.8em;
+ }
+ `,
+}));
+
const SectionLabel = memo<{ children: string }>(({ children }) => (
<Text as={'h2'} className={stylex.props(styles.sectionLabel).className}>
{children}
@@ -96,7 +104,7 @@ const Overview = memo(() => {
{/* ABOUT */}
<Flexbox gap={12}>
<SectionLabel>{t('skills.details.overview.about')}</SectionLabel>
- <div {...sx(styles.summary, 'lobe-overview-22f20c33-summary')}>
+ <div {...sx(styles.summary, fallback.summary)}>
<Markdown variant={'chat'}>{overview?.summary || description || ''}</Markdown>
</div>
</Flexbox>
diff --git a/src/features/Conversation/Messages/index.css b/src/features/Conversation/Messages/index.css
deleted file mode 100644
index 56e8b5a91c0..00000000000
--- a/src/features/Conversation/Messages/index.css
+++ /dev/null
@@ -1,4 +0,0 @@
-/* Prevent the antd textarea from growing too long. */
-.lobe-messages-0fc10b22-message .ant-input {
- max-height: 900px;
-}
diff --git a/src/features/Conversation/Messages/index.tsx b/src/features/Conversation/Messages/index.tsx
index a026235d798..e4eb1bcfbed 100644
--- a/src/features/Conversation/Messages/index.tsx
+++ b/src/features/Conversation/Messages/index.tsx
@@ -1,9 +1,11 @@
'use client';
-import './index.css';
-
import { isDesktop } from '@lobechat/const';
-import { Flexbox } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- the antd textarea inside a message has no slot
+ createStaticStyles,
+ Flexbox,
+} from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
import { type MouseEvent, type ReactNode } from 'react';
@@ -41,6 +43,15 @@ const styles = stylex.create({
message: { position: 'relative' },
});
+const fallback = createStaticStyles(({ css }) => ({
+ message: css`
+ /* Prevent the antd textarea from growing too long. */
+ .ant-input {
+ max-height: 900px;
+ }
+ `,
+}));
+
export interface MessageItemProps {
className?: string;
continuations?: SteerContinuation[];
@@ -281,7 +292,7 @@ const MessageItem = memo<MessageItemProps>(
{...sx(
styles.message,
shouldDimCreatingMessage && styles.loading,
- ['lobe-messages-0fc10b22-message', className].filter(Boolean).join(' '),
+ [fallback.message, className].filter(Boolean).join(' '),
)}
data-index={index}
onContextMenu={onContextMenu}
diff --git a/src/routes/(main)/community/(detail)/features/ShareButton.css b/src/routes/(main)/community/(detail)/features/ShareButton.css
deleted file mode 100644
index 74a64181c5d..00000000000
--- a/src/routes/(main)/community/(detail)/features/ShareButton.css
+++ /dev/null
@@ -1,15 +0,0 @@
-.lobe-share-button-4579d448-icon {
- border: 1px solid var(--lobe-color-fill-secondary);
-}
-
-.lobe-share-button-4579d448-icon svg {
- fill: var(--lobe-color-text-secondary);
-}
-
-.lobe-share-button-4579d448-icon:hover {
- border: 1px solid var(--lobe-color-border-secondary);
-}
-
-.lobe-share-button-4579d448-icon:hover svg {
- fill: var(--lobe-color-text);
-}
diff --git a/src/routes/(main)/community/(detail)/features/ShareButton.tsx b/src/routes/(main)/community/(detail)/features/ShareButton.tsx
index 8084b5e1522..ecb4fc9fb2a 100644
--- a/src/routes/(main)/community/(detail)/features/ShareButton.tsx
+++ b/src/routes/(main)/community/(detail)/features/ShareButton.tsx
@@ -1,11 +1,11 @@
-import './ShareButton.css';
-
import {
ActionIcon,
Avatar,
Button,
Center,
CopyButton,
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- ActionIcon renders its svg without a slot
+ createStaticStyles,
Flexbox,
Icon,
Input,
@@ -54,6 +54,24 @@ interface ShareButtonProps extends ComponentProps<typeof Button> {
};
}
+const fallback = createStaticStyles(({ css }) => ({
+ icon: css`
+ border: 1px solid var(--lobe-color-fill-secondary);
+
+ svg {
+ fill: var(--lobe-color-text-secondary);
+ }
+
+ &:hover {
+ border: 1px solid var(--lobe-color-border-secondary);
+
+ svg {
+ fill: var(--lobe-color-text);
+ }
+ }
+ `,
+}));
+
const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
const { x, reddit, telegram, whatsapp, mastodon, weibo } = useShare({
avatar: '',
@@ -107,7 +125,7 @@ const ShareButton = memo<ShareButtonProps>(({ meta, ...rest }) => {
item.icon && (
<a href={item.link} key={item.title} rel="noreferrer" target="_blank">
<ActionIcon
- className={'lobe-share-button-4579d448-icon'}
+ className={fallback.icon}
icon={item.icon}
size={{ blockSize: 36, borderRadius: 18, size: 16 }}
title={item.title}
diff --git a/src/routes/(mobile)/_layout/NavBar.css b/src/routes/(mobile)/_layout/NavBar.css
deleted file mode 100644
index caa23546e3e..00000000000
--- a/src/routes/(mobile)/_layout/NavBar.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.lobe-nav-bar-c7ad71e3-active svg {
- fill: color-mix(in srgb, var(--lobe-color-primary) 33%, transparent);
-}
diff --git a/src/routes/(mobile)/_layout/NavBar.tsx b/src/routes/(mobile)/_layout/NavBar.tsx
index 090eedf45f8..a263f8518da 100644
--- a/src/routes/(mobile)/_layout/NavBar.tsx
+++ b/src/routes/(mobile)/_layout/NavBar.tsx
@@ -1,8 +1,10 @@
'use client';
-import './NavBar.css';
-
-import { Icon } from '@lobehub/ui';
+import {
+ // oxlint-disable-next-line stylex-migration/no-emotion-styles -- Icon renders its svg without a slot
+ createStaticStyles,
+ Icon,
+} from '@lobehub/ui';
import { type TabBarProps } from '@lobehub/ui/mobile';
import { TabBar } from '@lobehub/ui/mobile';
import * as stylex from '@stylexjs/stylex';
@@ -25,6 +27,14 @@ const styles = stylex.create({
},
});
+const fallback = createStaticStyles(({ css, cssVar }) => ({
+ active: css`
+ svg {
+ fill: color-mix(in srgb, ${cssVar.colorPrimary} 33%, transparent);
+ }
+ `,
+}));
+
const NavBar = memo(() => {
const { t } = useTranslation('common');
const { activeKey } = useMobileNavigation();
@@ -37,10 +47,7 @@ const NavBar = memo(() => {
[
{
icon: (active: boolean) => (
- <Icon
- className={active ? 'lobe-nav-bar-c7ad71e3-active' : undefined}
- icon={MessageSquare}
- />
+ <Icon className={active ? fallback.active : undefined} icon={MessageSquare} />
),
key: SidebarTabKey.Chat,
onClick: () => {
@@ -50,7 +57,7 @@ const NavBar = memo(() => {
},
showMarket && {
icon: (active: boolean) => (
- <Icon className={active ? 'lobe-nav-bar-c7ad71e3-active' : undefined} icon={Compass} />
+ <Icon className={active ? fallback.active : undefined} icon={Compass} />
),
key: SidebarTabKey.Community,
onClick: () => {
@@ -60,7 +67,7 @@ const NavBar = memo(() => {
},
{
icon: (active: boolean) => (
- <Icon className={active ? 'lobe-nav-bar-c7ad71e3-active' : undefined} icon={User} />
+ <Icon className={active ? fallback.active : undefined} icon={User} />
),
key: SidebarTabKey.Me,
onClick: () => {