Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

refactor(app): remove theme studio, replaced by the Themes tab

Hampusd42eef23dadb
diff --git a/fluxer_app/src/features/theme_studio/ThemeStudio.module.css b/fluxer_app/src/features/theme_studio/ThemeStudio.module.css
deleted file mode 100644
index e1eff2788..000000000
--- a/fluxer_app/src/features/theme_studio/ThemeStudio.module.css
+++ /dev/null
@@ -1,182 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.studioRoot {
- --studio-bg-canvas: var(--background-primary);
- --studio-bg-editor: var(--background-primary);
- --studio-bg-sidebar: var(--background-secondary);
- --studio-bg-toolbar: var(--background-secondary);
- --studio-bg-panel-header: color-mix(in srgb, var(--background-secondary) 86%, var(--background-primary) 14%);
- --studio-bg-elevated: var(--background-secondary);
- --studio-bg-row-hover: var(--background-modifier-hover);
- --studio-bg-row-active: var(--background-modifier-selected);
- --studio-bg-input: var(--background-textarea);
- --studio-bg-input-hover: color-mix(in srgb, var(--background-textarea) 86%, var(--text-primary) 14%);
- --studio-bg-overlay: color-mix(in srgb, var(--background-secondary) 94%, transparent);
- --studio-bg-scrim: rgba(0, 0, 0, 0.48);
-
- --studio-border: var(--background-modifier-accent);
- --studio-border-strong: var(--border-color-hover);
- --studio-border-input: var(--border-color);
- --studio-border-focus: var(--focus-primary);
- --studio-border-accent: var(--brand-primary);
-
- --studio-fg-primary: var(--text-primary);
- --studio-fg-muted: var(--text-secondary);
- --studio-fg-subtle: var(--text-tertiary);
- --studio-fg-on-accent: var(--text-on-brand-primary);
- --studio-fg-on-danger: var(--text-on-dark);
-
- --studio-accent: var(--brand-primary);
- --studio-accent-hover: var(--brand-secondary);
- --studio-accent-soft: color-mix(in srgb, var(--brand-primary) 18%, transparent);
- --studio-focus: var(--focus-primary);
-
- --studio-button-primary: var(--brand-primary);
- --studio-button-primary-hover: var(--studio-accent-hover);
- --studio-button-secondary: var(--button-secondary-fill);
- --studio-button-secondary-hover: var(--button-secondary-active-fill);
-
- --studio-danger: var(--accent-danger);
- --studio-danger-hover: var(--button-danger-active-fill);
- --studio-danger-soft: color-mix(in srgb, var(--accent-danger) 14%, transparent);
- --studio-success: var(--accent-success);
- --studio-success-soft: color-mix(in srgb, var(--accent-success) 14%, transparent);
- --studio-warning: var(--accent-warning);
- --studio-warning-soft: color-mix(in srgb, var(--accent-warning) 14%, transparent);
-
- --studio-shadow-overlay: var(--shadow-xl);
- --studio-shadow-panel: var(--shadow-sm);
- --studio-shadow-popover: var(--shadow-lg);
-
- --studio-radius-sm: var(--radius-sm);
- --studio-radius-md: var(--radius-md);
- --studio-radius-lg: var(--radius-lg);
- --studio-radius-full: var(--radius-full);
-
- --studio-row-height: 2.125rem;
- --studio-row-height-compact: 1.75rem;
- --studio-row-height-lg: 2.5rem;
-
- --studio-toolbar-height: 2rem;
- --studio-sidebar-width: 14.25rem;
- --studio-sidebar-width-collapsed: 3rem;
-
- --studio-pad-x: 0.75rem;
- --studio-pad-y: 0.5rem;
-
- --studio-font-ui: var(--font-sans);
- --studio-font-mono: var(--font-mono);
-
- --studio-fs-xs: 0.6875rem;
- --studio-fs-sm: 0.75rem;
- --studio-fs-md: 0.8125rem;
- --studio-fs-lg: 0.9375rem;
-
- --studio-transition-fast: 90ms ease;
- --studio-transition-base: 140ms ease;
-}
-
-.studioRoot[data-base-theme='light'] {
- --studio-bg-input-hover: color-mix(in srgb, var(--background-textarea) 92%, var(--text-primary) 8%);
- --studio-bg-scrim: rgba(0, 0, 0, 0.32);
-}
-
-.studioRoot {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- width: 100%;
- height: 100%;
- min-height: 0;
- background: var(--studio-bg-canvas);
- color: var(--studio-fg-primary);
- font-family: var(--studio-font-ui);
- font-size: var(--studio-fs-md);
- line-height: 1.35;
- overflow: hidden;
- box-shadow: var(--studio-shadow-overlay);
- isolation: isolate;
- -webkit-app-region: no-drag;
-}
-
-.studioRoot.standaloneRoot {
- box-shadow: none;
-}
-
-.standaloneAppRoot {
- box-sizing: border-box;
- position: fixed;
- inset: 0;
- display: flex;
- flex-direction: column;
- min-height: 0;
- background: var(--background-primary);
- color: var(--text-primary);
- font-family: var(--font-sans);
- overflow: hidden;
-}
-
-.standaloneRoot {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
- background: var(--studio-bg-canvas);
- color: var(--studio-fg-primary);
- font-family: var(--studio-font-ui);
-}
-
-.standaloneWindowControls {
- margin-left: 0.5rem;
- display: flex;
- align-items: stretch;
- height: 100%;
- -webkit-app-region: no-drag;
-}
-
-.standaloneWindowControls * {
- -webkit-app-region: no-drag;
-}
-
-.standaloneWindowControls button {
- color: var(--studio-fg-muted);
-}
-
-.standaloneWindowControls button:not(:last-of-type):hover {
- background: var(--studio-bg-row-hover);
- color: var(--studio-fg-primary);
- border-color: var(--studio-border-strong);
-}
-
-.windowControlActive {
- background: var(--studio-bg-row-active);
- color: var(--studio-fg-primary);
-}
-
-.bodyRow {
- display: flex;
- flex: 1 1 auto;
- min-height: 0;
- min-width: 0;
- -webkit-app-region: no-drag;
-}
-
-.bodyRow * {
- -webkit-app-region: no-drag;
-}
-
-.workspace {
- flex: 1 1 auto;
- min-width: 0;
- min-height: 0;
- display: flex;
- flex-direction: column;
- background: var(--studio-bg-canvas);
- position: relative;
-}
-
-@media (max-width: 720px) {
- .studioRoot {
- --studio-sidebar-width: var(--studio-sidebar-width-collapsed);
- }
-}
diff --git a/fluxer_app/src/features/theme_studio/ThemeStudio.tsx b/fluxer_app/src/features/theme_studio/ThemeStudio.tsx
deleted file mode 100644
index 9c7585598..000000000
--- a/fluxer_app/src/features/theme_studio/ThemeStudio.tsx
+++ /dev/null
@@ -1,295 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import * as AccessibilityCommands from '@app/features/accessibility/commands/AccessibilityCommands';
-import Accessibility from '@app/features/accessibility/state/Accessibility';
-import {SETTINGS_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import Theme from '@app/features/theme/state/Theme';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import {AssetsSection} from '@app/features/theme_studio/sections/AssetsSection';
-import {LibrarySection} from '@app/features/theme_studio/sections/LibrarySection';
-import {QuickCssSection} from '@app/features/theme_studio/sections/QuickCssSection';
-import {SettingsSection} from '@app/features/theme_studio/sections/ThemeStudioSettingsSection';
-import {TokensSection} from '@app/features/theme_studio/sections/TokensSection';
-import {
- broadcastThemeStudioMessage,
- useThemeStudioBroadcast,
-} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import ThemeStudioState from '@app/features/theme_studio/state/ThemeStudioState';
-import styles from '@app/features/theme_studio/ThemeStudio.module.css';
-import {StudioSidebar, StudioSidebarFooterText, StudioSidebarItem} from '@app/features/theme_studio/ui/StudioSidebar';
-import {StudioToolbar} from '@app/features/theme_studio/ui/StudioToolbar';
-import {
- getThemeStudioBaseTheme,
- getThemeStudioFallbackDefaultVariables,
- pinThemeStudioDefaultVariables,
- type ThemeStudioBaseTheme,
-} from '@app/features/theme_studio/utils/ThemeStudioPinnedVariables';
-import {extractThemeVariableOverrides} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {ThemeTypes} from '@fluxer/constants/src/UserConstants';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import {
- FileCssIcon,
- GearIcon,
- ImageSquareIcon,
- PaintBrushBroadIcon,
- SlidersHorizontalIcon,
-} from '@phosphor-icons/react';
-import {clsx} from 'clsx';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import type {ReactNode} from 'react';
-import {useCallback, useEffect, useMemo, useRef} from 'react';
-
-const LIBRARY_DESCRIPTOR = msg({
- message: 'Library',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const TOKENS_DESCRIPTOR = msg({
- message: 'Tokens',
- comment: 'Short label in the theme studio. Keep it concise. Keep the tone plain and specific.',
-});
-const QUICK_CSS_DESCRIPTOR = msg({
- message: 'Quick CSS',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const ASSETS_DESCRIPTOR = msg({
- message: 'Assets',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-export const THEME_STUDIO_DESCRIPTOR = msg({
- message: 'Theme studio',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const THEME_STUDIO_NAVIGATION_DESCRIPTOR = msg({
- message: 'Theme studio navigation',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const DARK_BASE_DESCRIPTOR = msg({
- message: 'Dark base',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const LIGHT_BASE_DESCRIPTOR = msg({
- message: 'Light base',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const DARK_LEGACY_BASE_DESCRIPTOR = msg({
- message: 'Dark legacy base',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-const COAL_BASE_DESCRIPTOR = msg({
- message: 'Coal base',
- comment: 'Short label in the theme studio. Keep it concise.',
-});
-interface ThemeStudioProps {
- baseTheme?: ThemeStudioBaseTheme;
- defaultVariables?: Readonly<Record<string, string>>;
- windowControls?: ReactNode;
-}
-
-const ThemeStudioInner: React.FC<ThemeStudioProps> = observer(
- ({baseTheme: providedBaseTheme, defaultVariables, windowControls}) => {
- const {i18n} = useLingui();
- const studioRootRef = useRef<HTMLDivElement | null>(null);
- useEffect(() => {
- void ThemeLibrary.init();
- }, []);
- useThemeStudioBroadcast(
- useCallback((message) => {
- switch (message.type) {
- case 'customThemeCss':
- if ((Accessibility.customThemeCss ?? null) !== message.value) {
- AccessibilityCommands.update({customThemeCss: message.value});
- }
- return;
- case 'themeLibrary':
- void ThemeLibrary.reload();
- return;
- case 'studio:focus-popout':
- window.focus();
- return;
- case 'themePreference':
- if (message.snapshot) {
- Theme.applyPreferenceSnapshot(message.snapshot);
- }
- return;
- default:
- return;
- }
- }, []),
- );
- useEffect(() => {
- const handler = () => {
- broadcastThemeStudioMessage({type: 'studio:closed-popout'});
- };
- window.addEventListener('beforeunload', handler);
- return () => window.removeEventListener('beforeunload', handler);
- }, []);
- const overrideCount = useMemo(
- () => Object.keys(extractThemeVariableOverrides(Accessibility.customThemeCss ?? '')).length,
- [Accessibility.customThemeCss],
- );
- const enabledThemeCount = ThemeLibrary.enabledThemeIds.length;
- const effectiveTheme = Theme.effectiveTheme;
- const baseTheme = providedBaseTheme ?? getThemeStudioBaseTheme(effectiveTheme);
- const studioDefaultVariables = defaultVariables ?? getThemeStudioFallbackDefaultVariables(baseTheme);
- const studioDefaultVariableStyle = studioDefaultVariables as React.CSSProperties;
- useEffect(
- () => pinThemeStudioDefaultVariables(studioRootRef.current, studioDefaultVariables),
- [studioDefaultVariables],
- );
- const renderSection = (): ReactNode => {
- switch (ThemeStudioState.section) {
- case 'library':
- return (
- <LibrarySection baseTheme={baseTheme} data-flx="theme-studio.theme-studio.render-section.library-section" />
- );
- case 'tokens':
- return (
- <TokensSection
- defaultVariableValues={studioDefaultVariables}
- data-flx="theme-studio.theme-studio.render-section.tokens-section"
- />
- );
- case 'quickCss':
- return (
- <QuickCssSection
- baseTheme={baseTheme}
- data-flx="theme-studio.theme-studio.render-section.quick-css-section"
- />
- );
- case 'assets':
- return <AssetsSection data-flx="theme-studio.theme-studio.render-section.assets-section" />;
- case 'settings':
- return <SettingsSection data-flx="theme-studio.theme-studio.render-section.settings-section" />;
- default:
- return (
- <TokensSection
- defaultVariableValues={studioDefaultVariables}
- data-flx="theme-studio.theme-studio.render-section.tokens-section--2"
- />
- );
- }
- };
- const baseThemeLabel = useMemo(() => {
- switch (effectiveTheme) {
- case ThemeTypes.LIGHT:
- return i18n._(LIGHT_BASE_DESCRIPTOR);
- case ThemeTypes.DARK_LEGACY:
- return i18n._(DARK_LEGACY_BASE_DESCRIPTOR);
- case ThemeTypes.COAL:
- return i18n._(COAL_BASE_DESCRIPTOR);
- default:
- return i18n._(DARK_BASE_DESCRIPTOR);
- }
- }, [effectiveTheme, i18n.locale]);
- const sidebar = (
- <StudioSidebar
- ariaLabel={i18n._(THEME_STUDIO_NAVIGATION_DESCRIPTOR)}
- footer={
- <StudioSidebarFooterText data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-footer-text">
- {baseThemeLabel}
- </StudioSidebarFooterText>
- }
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar"
- >
- <StudioSidebarItem
- icon={
- <PaintBrushBroadIcon
- size={16}
- weight="duotone"
- data-flx="theme-studio.theme-studio.theme-studio-inner.paint-brush-broad-icon"
- />
- }
- label={i18n._(LIBRARY_DESCRIPTOR)}
- badge={enabledThemeCount > 0 ? enabledThemeCount : undefined}
- active={ThemeStudioState.section === 'library'}
- onClick={() => ThemeStudioState.setSection('library')}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-item.set-section"
- />
- <StudioSidebarItem
- icon={
- <SlidersHorizontalIcon
- size={16}
- weight="duotone"
- data-flx="theme-studio.theme-studio.theme-studio-inner.sliders-horizontal-icon"
- />
- }
- label={i18n._(TOKENS_DESCRIPTOR)}
- badge={overrideCount > 0 ? overrideCount : undefined}
- active={ThemeStudioState.section === 'tokens'}
- onClick={() => ThemeStudioState.setSection('tokens')}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-item.set-section--2"
- />
- <StudioSidebarItem
- icon={
- <FileCssIcon
- size={16}
- weight="duotone"
- data-flx="theme-studio.theme-studio.theme-studio-inner.file-css-icon"
- />
- }
- label={i18n._(QUICK_CSS_DESCRIPTOR)}
- active={ThemeStudioState.section === 'quickCss'}
- onClick={() => ThemeStudioState.setSection('quickCss')}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-item.set-section--3"
- />
- <StudioSidebarItem
- icon={
- <ImageSquareIcon
- size={16}
- weight="duotone"
- data-flx="theme-studio.theme-studio.theme-studio-inner.image-square-icon"
- />
- }
- label={i18n._(ASSETS_DESCRIPTOR)}
- badge={ThemeLibrary.assets.length + ThemeLibrary.localFiles.length || undefined}
- active={ThemeStudioState.section === 'assets'}
- onClick={() => ThemeStudioState.setSection('assets')}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-item.set-section--4"
- />
- <StudioSidebarItem
- icon={
- <GearIcon size={16} weight="duotone" data-flx="theme-studio.theme-studio.theme-studio-inner.gear-icon" />
- }
- label={i18n._(SETTINGS_DESCRIPTOR)}
- active={ThemeStudioState.section === 'settings'}
- onClick={() => ThemeStudioState.setSection('settings')}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-sidebar-item.set-section--5"
- />
- </StudioSidebar>
- );
- const toolbar = (
- <StudioToolbar
- draggable
- trailing={windowControls}
- trailingEdgeToEdge={windowControls != null}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-toolbar"
- />
- );
- return (
- <div
- ref={studioRootRef}
- className={clsx(styles.studioRoot, styles.standaloneRoot)}
- data-base-theme={baseTheme}
- style={studioDefaultVariableStyle}
- role="main"
- aria-label={i18n._(THEME_STUDIO_DESCRIPTOR)}
- data-flx="theme-studio.theme-studio.theme-studio-inner.studio-root"
- >
- {toolbar}
- <div className={styles.bodyRow} data-flx="theme-studio.theme-studio.theme-studio-inner.body-row">
- {sidebar}
- <div className={styles.workspace} data-flx="theme-studio.theme-studio.theme-studio-inner.workspace">
- {renderSection()}
- </div>
- </div>
- </div>
- );
- },
-);
-export const ThemeStudio: React.FC<ThemeStudioProps> = (props) => (
- <ThemeStudioInner data-flx="theme-studio.theme-studio.theme-studio-inner" {...props} />
-);
-
-ThemeStudio.displayName = 'ThemeStudio';
diff --git a/fluxer_app/src/features/theme_studio/ThemeStudioStandaloneApp.tsx b/fluxer_app/src/features/theme_studio/ThemeStudioStandaloneApp.tsx
deleted file mode 100644
index 0459d666b..000000000
--- a/fluxer_app/src/features/theme_studio/ThemeStudioStandaloneApp.tsx
+++ /dev/null
@@ -1,137 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {ModalStack} from '@app/features/app/components/dialogs/ModalStack';
-import {NativeWindowControls} from '@app/features/app/components/layout/NativeWindowControls';
-import {useNativePlatform} from '@app/features/app/hooks/useNativePlatform';
-import {usePlatformClasses} from '@app/features/app/hooks/usePlatformClasses';
-import {Logger} from '@app/features/platform/utils/AppLogger';
-import Theme from '@app/features/theme/state/Theme';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import {THEME_STUDIO_DESCRIPTOR, ThemeStudio} from '@app/features/theme_studio/ThemeStudio';
-import styles from '@app/features/theme_studio/ThemeStudio.module.css';
-import {
- getThemeStudioBaseTheme,
- getThemeStudioFallbackDefaultVariables,
- pinThemeStudioDefaultVariables,
- readThemeStudioComputedDefaultVariables,
-} from '@app/features/theme_studio/utils/ThemeStudioPinnedVariables';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {Toasts} from '@app/features/ui/toast/Toasts';
-import {getElectronAPI} from '@app/features/ui/utils/NativeUtils';
-import {useFluxerDocumentTitle} from '@app/features/window/hooks/useFluxerDocumentTitle';
-import {useNativeTitleBar} from '@app/features/window/hooks/useNativeTitleBar';
-import {NATIVE_TITLEBAR_CLASS} from '@fluxer/desktop_ipc/src/NativeTitlebarShell';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import {IconContext, PushPinIcon, PushPinSlashIcon} from '@phosphor-icons/react';
-import {clsx} from 'clsx';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useEffect, useMemo, useRef, useState} from 'react';
-
-const logger = new Logger('ThemeStudioStandaloneApp');
-const THEME_STUDIO_POPOUT_KEY = 'fluxer_theme_studio';
-const STAY_ON_TOP_DESCRIPTOR = msg({
- message: 'Stay on top',
- comment: 'Button label in the Theme Studio popout titlebar that pins the window above other windows.',
-});
-const REMOVE_FROM_TOP_DESCRIPTOR = msg({
- message: 'Remove from top',
- comment: 'Button label in the Theme Studio popout titlebar that unpins the window from staying above others.',
-});
-
-export const ThemeStudioStandaloneApp: React.FC = observer(() => {
- const {i18n} = useLingui();
- const standaloneRootRef = useRef<HTMLDivElement | null>(null);
- const effectiveTheme = Theme.effectiveTheme;
- const baseTheme = getThemeStudioBaseTheme(effectiveTheme);
- const fallbackDefaultVariables = useMemo(() => getThemeStudioFallbackDefaultVariables(baseTheme), [baseTheme]);
- const [standaloneDefaultVariables, setStandaloneDefaultVariables] =
- useState<Readonly<Record<string, string>>>(fallbackDefaultVariables);
- const {platform, isNative, isMacOS} = useNativePlatform();
- const useSystemTitleBar = useNativeTitleBar();
- const [isAlwaysOnTop, setIsAlwaysOnTop] = useState(true);
- useFluxerDocumentTitle(i18n._(THEME_STUDIO_DESCRIPTOR));
- usePlatformClasses(platform, isNative);
- useEffect(() => {
- const html = document.documentElement;
- html.classList.add(`theme-${effectiveTheme}`);
- return () => {
- html.classList.remove(`theme-${effectiveTheme}`);
- };
- }, [effectiveTheme]);
- useEffect(
- () =>
- ThemeLibrary.startLinkedFileSync({
- onThemesChanged: () => broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision}),
- }),
- [],
- );
- useEffect(() => {
- setStandaloneDefaultVariables(readThemeStudioComputedDefaultVariables(fallbackDefaultVariables));
- }, [fallbackDefaultVariables, effectiveTheme]);
- useEffect(
- () => pinThemeStudioDefaultVariables(standaloneRootRef.current, standaloneDefaultVariables),
- [standaloneDefaultVariables],
- );
- const handleToggleAlwaysOnTop = useCallback(() => {
- const nextAlwaysOnTop = !isAlwaysOnTop;
- void getElectronAPI()
- ?.popoutSetAlwaysOnTop?.(THEME_STUDIO_POPOUT_KEY, nextAlwaysOnTop)
- .then((changed) => {
- if (changed) {
- setIsAlwaysOnTop(nextAlwaysOnTop);
- }
- })
- .catch((error) => {
- logger.warn('Failed to toggle Theme Studio always-on-top', error);
- });
- }, [isAlwaysOnTop]);
- const pinLabel = isAlwaysOnTop ? i18n._(REMOVE_FROM_TOP_DESCRIPTOR) : i18n._(STAY_ON_TOP_DESCRIPTOR);
- const PinIcon = isAlwaysOnTop ? PushPinSlashIcon : PushPinIcon;
- return (
- <IconContext.Provider value={{color: 'currentColor', weight: 'fill'}}>
- <div
- ref={standaloneRootRef}
- className={styles.standaloneAppRoot}
- style={standaloneDefaultVariables as React.CSSProperties}
- data-flx="theme-studio.theme-studio-standalone-app.standalone-app-root"
- >
- <ThemeStudio
- baseTheme={baseTheme}
- defaultVariables={standaloneDefaultVariables}
- windowControls={
- isNative ? (
- <div
- className={styles.standaloneWindowControls}
- data-flx="theme-studio.theme-studio-standalone-app.window-controls"
- >
- <FocusRing offset={-2} data-flx="theme-studio.theme-studio-standalone-app.focus-ring.pin">
- <button
- type="button"
- tabIndex={-1}
- className={clsx(NATIVE_TITLEBAR_CLASS.control, isAlwaysOnTop && styles.windowControlActive)}
- onClick={handleToggleAlwaysOnTop}
- aria-pressed={isAlwaysOnTop}
- aria-label={pinLabel}
- title={pinLabel}
- data-flx="theme-studio.theme-studio-standalone-app.control-button.toggle-always-on-top"
- >
- <PinIcon weight="bold" data-flx="theme-studio.theme-studio-standalone-app.pin-icon" />
- </button>
- </FocusRing>
- {!isMacOS && !useSystemTitleBar && (
- <NativeWindowControls data-flx="theme-studio.theme-studio-standalone-app.native-window-controls" />
- )}
- </div>
- ) : null
- }
- data-flx="theme-studio.theme-studio-standalone-app.theme-studio"
- />
- <ModalStack data-flx="theme-studio.theme-studio-standalone-app.modal-stack" />
- <Toasts data-flx="theme-studio.theme-studio-standalone-app.toasts" />
- </div>
- </IconContext.Provider>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/commands/ThemeStudioCommands.ts b/fluxer_app/src/features/theme_studio/commands/ThemeStudioCommands.ts
deleted file mode 100644
index 04b4be63d..000000000
--- a/fluxer_app/src/features/theme_studio/commands/ThemeStudioCommands.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {Routes} from '@app/app/Routes';
-import {Logger} from '@app/features/platform/utils/AppLogger';
-import Theme from '@app/features/theme/state/Theme';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import ThemeStudioState from '@app/features/theme_studio/state/ThemeStudioState';
-import {getElectronAPI} from '@app/features/ui/utils/NativeUtils';
-
-const logger = new Logger('ThemeStudioCommands');
-const POPOUT_WINDOW_NAME = 'fluxer_theme_studio';
-const POPOUT_FEATURES = [
- 'popup=yes',
- 'width=1240',
- 'height=860',
- 'minWidth=900',
- 'minHeight=620',
- 'resizable=yes',
- 'scrollbars=no',
- 'location=no',
- 'toolbar=no',
- 'menubar=no',
- 'status=no',
- 'titlebar=no',
- 'personalbar=no',
-].join(',');
-
-export function openThemeStudio(): void {
- openThemeStudioPopout();
-}
-
-export function openThemeStudioPopout(): void {
- if (typeof window === 'undefined') return;
- const electronApi = getElectronAPI();
- if (electronApi?.focusThemeStudioPopout) {
- void electronApi
- .focusThemeStudioPopout()
- .then((focused) => {
- if (focused) {
- broadcastThemeStudioMessage({type: 'studio:focus-popout'});
- broadcastThemeStudioMessage({type: 'themePreference', snapshot: Theme.getPreferenceSnapshot()});
- return;
- }
- openThemeStudioPopoutWindow();
- })
- .catch((error) => {
- logger.warn('Failed to focus Theme Studio popout before opening', error);
- openThemeStudioPopoutWindow();
- });
- return;
- }
- openThemeStudioPopoutWindow();
-}
-
-function openThemeStudioPopoutWindow(): void {
- try {
- const existingPopup = ThemeStudioState.popupRef;
- if (existingPopup && !existingPopup.closed) {
- existingPopup.focus();
- broadcastThemeStudioMessage({type: 'studio:focus-popout'});
- broadcastThemeStudioMessage({type: 'themePreference', snapshot: Theme.getPreferenceSnapshot()});
- return;
- }
- if (existingPopup?.closed) {
- ThemeStudioState.clearPoppedOut();
- }
- const popup = window.open(Routes.THEME_STUDIO, POPOUT_WINDOW_NAME, POPOUT_FEATURES);
- if (popup) {
- popup.focus();
- ThemeStudioState.markPoppedOut(popup);
- broadcastThemeStudioMessage({type: 'themePreference', snapshot: Theme.getPreferenceSnapshot()});
- }
- } catch (error) {
- logger.warn('Failed to open Theme Studio popout', error);
- }
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/AssetsSection.module.css b/fluxer_app/src/features/theme_studio/sections/AssetsSection.module.css
deleted file mode 100644
index 4349acdee..000000000
--- a/fluxer_app/src/features/theme_studio/sections/AssetsSection.module.css
+++ /dev/null
@@ -1,45 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.toolbar {
- display: flex;
- gap: 0.5rem;
- align-items: center;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- flex-wrap: wrap;
- background: var(--studio-bg-panel-header);
-}
-
-.body {
- flex: 1 1 auto;
- min-height: 0;
- display: grid;
- grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
- gap: 0.75rem;
- padding: 0.875rem;
- overflow: auto;
- background: var(--studio-bg-editor);
-}
-
-@media (max-width: 720px) {
- .body {
- grid-template-columns: minmax(0, 1fr);
- }
-}
-
-.list {
- display: flex;
- flex-direction: column;
- gap: 0.0625rem;
-}
-
-.empty {
- padding: 1rem;
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/AssetsSection.tsx b/fluxer_app/src/features/theme_studio/sections/AssetsSection.tsx
deleted file mode 100644
index 4a42e697c..000000000
--- a/fluxer_app/src/features/theme_studio/sections/AssetsSection.tsx
+++ /dev/null
@@ -1,320 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import {createThemeAssetReference, createThemeLocalFileReference} from '@app/features/theme/utils/ThemeCssUtils';
-import styles from '@app/features/theme_studio/sections/AssetsSection.module.css';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import {StudioButton} from '@app/features/theme_studio/ui/StudioButton';
-import {StudioEmptyState} from '@app/features/theme_studio/ui/StudioEmptyState';
-import {StudioIconButton} from '@app/features/theme_studio/ui/StudioIconButton';
-import {StudioListItem} from '@app/features/theme_studio/ui/StudioListItem';
-import {StudioPanel} from '@app/features/theme_studio/ui/StudioPanel';
-import {showThemeStudioErrorModal} from '@app/features/theme_studio/utils/ThemeStudioErrorModalUtils';
-import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
-import {getElectronAPI, isDesktop} from '@app/features/ui/utils/NativeUtils';
-import {copyText} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {msg} from '@lingui/core/macro';
-import {Trans, useLingui} from '@lingui/react/macro';
-import {CopyIcon, FilePlusIcon, ImageIcon, TrashIcon, UploadSimpleIcon} from '@phosphor-icons/react';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useRef} from 'react';
-
-const UPLOADED_OTHER_DESCRIPTOR = msg({
- message: 'Uploaded {length, plural, one {# theme asset} other {# theme assets}}.',
- comment: 'Toast after uploading one or more Theme Studio asset files.',
-});
-const ADDED_OTHER_DESCRIPTOR = msg({
- message: 'Added {length, plural, one {# local file reference} other {# local file references}}.',
- comment: 'Toast after adding one or more desktop local file references for theme CSS.',
-});
-const REFERENCE_COPIED_DESCRIPTOR = msg({
- message: 'Reference copied.',
- comment: 'Short label in the theme studio assets section. Keep it concise.',
-});
-const WE_COULDN_T_COPY_THAT_REFERENCE_DESCRIPTOR = msg({
- message: "We couldn't copy that reference.",
- comment: 'Error message in the theme studio assets section.',
-});
-const UPLOADED_ASSETS_DESCRIPTOR = msg({
- message: 'Uploaded assets',
- comment: 'Button or menu action label in the theme studio assets section. Keep it concise.',
-});
-const NO_UPLOADED_ASSETS_DESCRIPTOR = msg({
- message: 'No assets yet',
- comment: 'Empty-state text in the theme studio assets section.',
-});
-const DROP_IMAGES_FONTS_OR_OTHER_FILES_HERE_TO_DESCRIPTOR = msg({
- message: 'Drop images, fonts, or other files here to use them inside your custom CSS.',
- comment: 'Description text in the theme studio assets section.',
-});
-const COPY_REFERENCE_FOR_DESCRIPTOR = msg({
- message: 'Copy reference for {fileName}',
- comment: 'Accessible label for copying a Theme Studio uploaded asset reference.',
-});
-const DELETE_DESCRIPTOR = msg({
- message: 'Delete {fileName}',
- comment: 'Accessible label for deleting a Theme Studio uploaded asset.',
-});
-const LOCAL_FILE_REFERENCES_DESCRIPTOR = msg({
- message: 'Local file references',
- comment: 'Short label in the theme studio assets section. Keep it concise.',
-});
-const NO_LOCAL_FILES_REFERENCED_DESCRIPTOR = msg({
- message: 'No local files referenced',
- comment: 'Empty-state text in the theme studio assets section.',
-});
-const ADD_FILES_FROM_YOUR_COMPUTER_TO_REFERENCE_THEM_DESCRIPTOR = msg({
- message: 'Add files from your computer to reference them in custom CSS without uploading.',
- comment: 'Button or menu action label in the theme studio assets section. Keep it concise.',
-});
-const AVAILABLE_IN_THE_DESKTOP_APP_DESCRIPTOR = msg({
- message: 'Available in the desktop app.',
- comment: 'Description text in the theme studio assets section.',
-});
-const COPY_REFERENCE_FOR_2_DESCRIPTOR = msg({
- message: 'Copy reference for {fileName}',
- comment: 'Accessible label for copying a Theme Studio local file reference.',
-});
-const DELETE_2_DESCRIPTOR = msg({
- message: 'Delete {fileName}',
- comment: 'Accessible label for deleting a Theme Studio local file reference.',
-});
-export const AssetsSection: React.FC = observer(() => {
- const {i18n} = useLingui();
- const assetInputRef = useRef<HTMLInputElement | null>(null);
- const handleAssetUpload = useCallback(
- (event: React.ChangeEvent<HTMLInputElement>) => {
- const files = [...(event.target.files ?? [])];
- event.target.value = '';
- if (files.length === 0) return;
- void ThemeLibrary.uploadAssets(files).then((assets) => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(i18n._(UPLOADED_OTHER_DESCRIPTOR, {length: assets.length}));
- });
- },
- [i18n],
- );
- const handleAddLocalFiles = useCallback(() => {
- void ThemeLibrary.addDesktopLocalFiles().then((files) => {
- if (files.length > 0) {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(i18n._(ADDED_OTHER_DESCRIPTOR, {length: files.length}));
- }
- });
- }, [i18n]);
- const handleCopyReference = useCallback(
- (reference: string) => {
- void copyText(reference)
- .then(() => ToastCommands.success(i18n._(REFERENCE_COPIED_DESCRIPTOR)))
- .catch(() =>
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(WE_COULDN_T_COPY_THAT_REFERENCE_DESCRIPTOR),
- 'theme-studio.assets-section.copy-reference-error-modal',
- ),
- );
- },
- [i18n],
- );
- const hasDesktopFileAccess = isDesktop() && Boolean(getElectronAPI()?.pickThemeLocalFiles);
- return (
- <div className={styles.section} data-flx="theme-studio.assets-section.section">
- <div className={styles.toolbar} data-flx="theme-studio.assets-section.toolbar">
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <UploadSimpleIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.assets-section.upload-simple-icon"
- />
- }
- onClick={() => assetInputRef.current?.click()}
- data-flx="theme-studio.assets-section.studio-button.click"
- >
- <Trans>Upload assets</Trans>
- </StudioButton>
- {hasDesktopFileAccess ? (
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <FilePlusIcon size={remFromPx(13)} weight="bold" data-flx="theme-studio.assets-section.file-plus-icon" />
- }
- onClick={handleAddLocalFiles}
- data-flx="theme-studio.assets-section.studio-button.add-local-files"
- >
- <Trans>Add local files</Trans>
- </StudioButton>
- ) : null}
- <input
- ref={assetInputRef}
- type="file"
- multiple
- hidden
- onChange={handleAssetUpload}
- aria-hidden
- data-flx="theme-studio.assets-section.input.asset-upload.file"
- />
- </div>
- <div className={styles.body} data-flx="theme-studio.assets-section.body">
- <StudioPanel title={i18n._(UPLOADED_ASSETS_DESCRIPTOR)} data-flx="theme-studio.assets-section.studio-panel">
- {ThemeLibrary.assets.length === 0 ? (
- <div className={styles.empty} data-flx="theme-studio.assets-section.empty">
- <StudioEmptyState
- icon={
- <ImageIcon size={remFromPx(20)} weight="duotone" data-flx="theme-studio.assets-section.image-icon" />
- }
- title={i18n._(NO_UPLOADED_ASSETS_DESCRIPTOR)}
- description={i18n._(DROP_IMAGES_FONTS_OR_OTHER_FILES_HERE_TO_DESCRIPTOR)}
- data-flx="theme-studio.assets-section.studio-empty-state"
- />
- </div>
- ) : (
- <div className={styles.list} data-flx="theme-studio.assets-section.list">
- {ThemeLibrary.assets.map((asset) => {
- const reference = createThemeAssetReference(asset.name);
- return (
- <StudioListItem
- key={asset.id}
- leading={
- <ImageIcon
- size={remFromPx(16)}
- weight="duotone"
- data-flx="theme-studio.assets-section.image-icon--2"
- />
- }
- label={asset.name}
- codeBody={reference}
- trailing={
- <>
- <StudioIconButton
- compact
- aria-label={i18n._(COPY_REFERENCE_FOR_DESCRIPTOR, {fileName: asset.name})}
- onClick={() => handleCopyReference(reference)}
- data-flx="theme-studio.assets-section.studio-icon-button.copy-reference"
- >
- <CopyIcon
- size={remFromPx(14)}
- weight="bold"
- data-flx="theme-studio.assets-section.copy-icon"
- />
- </StudioIconButton>
- <StudioIconButton
- compact
- tone="danger"
- aria-label={i18n._(DELETE_DESCRIPTOR, {fileName: asset.name})}
- onClick={() => {
- void ThemeLibrary.deleteAsset(asset.id).then(() => {
- broadcastThemeStudioMessage({
- type: 'themeLibrary',
- revision: ThemeLibrary.revision,
- });
- });
- }}
- data-flx="theme-studio.assets-section.studio-icon-button"
- >
- <TrashIcon
- size={remFromPx(14)}
- weight="bold"
- data-flx="theme-studio.assets-section.trash-icon"
- />
- </StudioIconButton>
- </>
- }
- data-flx="theme-studio.assets-section.studio-list-item"
- />
- );
- })}
- </div>
- )}
- </StudioPanel>
- <StudioPanel
- title={i18n._(LOCAL_FILE_REFERENCES_DESCRIPTOR)}
- data-flx="theme-studio.assets-section.studio-panel--2"
- >
- {ThemeLibrary.localFiles.length === 0 ? (
- <div className={styles.empty} data-flx="theme-studio.assets-section.empty--2">
- <StudioEmptyState
- icon={
- <FilePlusIcon
- size={remFromPx(20)}
- weight="duotone"
- data-flx="theme-studio.assets-section.file-plus-icon--2"
- />
- }
- title={i18n._(NO_LOCAL_FILES_REFERENCED_DESCRIPTOR)}
- description={
- hasDesktopFileAccess
- ? i18n._(ADD_FILES_FROM_YOUR_COMPUTER_TO_REFERENCE_THEM_DESCRIPTOR)
- : i18n._(AVAILABLE_IN_THE_DESKTOP_APP_DESCRIPTOR)
- }
- data-flx="theme-studio.assets-section.studio-empty-state--2"
- />
- </div>
- ) : (
- <div className={styles.list} data-flx="theme-studio.assets-section.list--2">
- {ThemeLibrary.localFiles.map((file) => {
- const reference = createThemeLocalFileReference(file.path);
- return (
- <StudioListItem
- key={file.id}
- leading={
- <FilePlusIcon
- size={remFromPx(16)}
- weight="duotone"
- data-flx="theme-studio.assets-section.file-plus-icon--3"
- />
- }
- label={file.name}
- codeBody={reference}
- trailing={
- <>
- <StudioIconButton
- compact
- aria-label={i18n._(COPY_REFERENCE_FOR_2_DESCRIPTOR, {fileName: file.name})}
- onClick={() => handleCopyReference(reference)}
- data-flx="theme-studio.assets-section.studio-icon-button.copy-reference--2"
- >
- <CopyIcon
- size={remFromPx(14)}
- weight="bold"
- data-flx="theme-studio.assets-section.copy-icon--2"
- />
- </StudioIconButton>
- <StudioIconButton
- compact
- tone="danger"
- aria-label={i18n._(DELETE_2_DESCRIPTOR, {fileName: file.name})}
- onClick={() => {
- void ThemeLibrary.deleteLocalFile(file.id).then(() => {
- broadcastThemeStudioMessage({
- type: 'themeLibrary',
- revision: ThemeLibrary.revision,
- });
- });
- }}
- data-flx="theme-studio.assets-section.studio-icon-button--2"
- >
- <TrashIcon
- size={remFromPx(14)}
- weight="bold"
- data-flx="theme-studio.assets-section.trash-icon--2"
- />
- </StudioIconButton>
- </>
- }
- data-flx="theme-studio.assets-section.studio-list-item--2"
- />
- );
- })}
- </div>
- )}
- </StudioPanel>
- </div>
- </div>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/sections/LibrarySection.module.css b/fluxer_app/src/features/theme_studio/sections/LibrarySection.module.css
deleted file mode 100644
index fe185faab..000000000
--- a/fluxer_app/src/features/theme_studio/sections/LibrarySection.module.css
+++ /dev/null
@@ -1,299 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.toolbar {
- display: flex;
- gap: 0.5rem;
- align-items: center;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- flex-wrap: wrap;
- background: var(--studio-bg-panel-header);
-}
-
-.toolbarSearch {
- flex: 1 1 auto;
- min-width: 0;
- max-width: 20rem;
-}
-
-.toolbarActions {
- display: flex;
- gap: 0.5rem;
- margin-left: auto;
- flex-wrap: wrap;
- justify-content: flex-end;
-}
-
-.split {
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.list {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
- overflow-y: auto;
- padding: 0.5rem;
- background: var(--studio-bg-sidebar);
-}
-
-.listEmpty {
- padding: 1.5rem 1rem;
-}
-
-.listItem {
- display: grid;
- grid-template-columns: minmax(0, 1fr) auto;
- align-items: center;
- gap: 0.375rem;
- padding: 0;
- border-radius: var(--studio-radius-md);
- transition: background var(--studio-transition-fast);
- background: transparent;
- border: 0.0625rem solid transparent;
-}
-
-.listItem:hover {
- background: var(--studio-bg-row-hover);
-}
-
-.listItemActive {
- background: var(--studio-bg-row-active);
- border-color: transparent;
-}
-
-.listItemActive:hover {
- background: var(--studio-bg-row-active);
-}
-
-.listItemMain {
- display: flex;
- flex-direction: column;
- min-width: 0;
-}
-
-.listItemButton {
- display: flex;
- min-width: 0;
- width: 100%;
- padding: 0.5625rem 0.625rem;
- background: transparent;
- border: 0;
- color: inherit;
- font: inherit;
- text-align: left;
- cursor: pointer;
- border-radius: var(--studio-radius-md);
-}
-
-.listItemName {
- display: block;
- font-size: var(--studio-fs-sm);
- font-weight: 400;
- color: var(--studio-fg-primary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.listItemMeta {
- display: block;
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-muted);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.editor {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
- min-width: 0;
-}
-
-.editorEmpty {
- flex: 1 1 auto;
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.editorTopBar {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 0.5rem;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- background: var(--studio-bg-panel-header);
-}
-
-.editorTitle {
- font-size: var(--studio-fs-md);
- font-weight: 500;
- color: var(--studio-fg-primary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.editorActions {
- display: flex;
- gap: 0.5rem;
- flex-shrink: 0;
-}
-
-.fields {
- display: grid;
- gap: 0.625rem;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- padding: 0.875rem 0.875rem 0.25rem;
-}
-
-.fieldFull {
- grid-column: span 2;
-}
-
-.field {
- display: flex;
- flex-direction: column;
- gap: 0.25rem;
- min-width: 0;
-}
-
-.fieldLabel {
- font-size: var(--studio-fs-xs);
- font-weight: 600;
- color: var(--studio-fg-muted);
- letter-spacing: 0;
-}
-
-.fieldInput {
- height: var(--studio-row-height);
- padding: 0 0.625rem;
- background: var(--studio-bg-input);
- border: 0.0625rem solid var(--studio-border-input);
- border-radius: var(--studio-radius-md);
- color: var(--studio-fg-primary);
- font: inherit;
- font-size: var(--studio-fs-sm);
- outline: none;
-}
-
-.fieldInput:focus {
- border-color: var(--studio-border-focus);
- box-shadow: 0 0 0 0.0625rem var(--studio-border-focus);
-}
-
-.cssWrap {
- flex: 1 1 auto;
- min-height: 0;
- padding: 0.625rem 0.875rem 0.875rem;
- display: flex;
- background: var(--studio-bg-editor);
-}
-
-.cssFrame {
- flex: 1 1 auto;
- position: relative;
- display: flex;
- min-width: 0;
- width: 100%;
- height: 100%;
- background: var(--studio-bg-editor);
- border: 0.0625rem solid var(--studio-border);
- border-radius: var(--studio-radius-lg);
- color: var(--studio-fg-primary);
- outline: none;
- overflow: hidden;
-}
-
-.cssEditor,
-.cssEditorLoading {
- position: absolute;
- inset: 0;
- width: 100%;
- height: 100%;
- min-width: 0;
- min-height: 0;
-}
-
-.cssEditor :global(.cm-editor) {
- height: 100%;
- border-radius: var(--studio-radius-lg);
- outline: none;
-}
-
-.cssEditor :global(.cm-editor.cm-focused) {
- outline: none;
-}
-
-.cssEditor :global(.cm-scroller) {
- overflow: auto;
-}
-
-.editorFooter {
- display: flex;
- gap: 0.5rem;
- padding: 0.75rem 0.875rem 0.875rem;
- border-top: 0.0625rem solid var(--studio-border);
- background: var(--studio-bg-panel-header);
-}
-
-.dirtyHint {
- display: inline-flex;
- align-items: center;
- gap: 0.375rem;
- color: var(--studio-fg-muted);
- font-size: var(--studio-fs-xs);
- margin-left: auto;
-}
-
-.enableSwitch {
- display: flex;
- align-items: center;
- padding-right: 0.625rem;
-}
-
-.listItemStatus {
- display: inline-flex;
- margin-right: 0.25rem;
- vertical-align: -0.0625rem;
- color: var(--studio-success);
-}
-
-.listItemStatusWarning {
- color: var(--studio-warning);
-}
-
-.linkedBanner {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- padding: 0.5rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-muted);
-}
-
-.linkedBannerWarning {
- background: var(--studio-warning-soft);
- color: var(--studio-fg-primary);
-}
-
-.linkedBannerText {
- flex: 1;
- min-width: 0;
- overflow-wrap: anywhere;
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/LibrarySection.tsx b/fluxer_app/src/features/theme_studio/sections/LibrarySection.tsx
deleted file mode 100644
index e35084af7..000000000
--- a/fluxer_app/src/features/theme_studio/sections/LibrarySection.tsx
+++ /dev/null
@@ -1,820 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
-import {CANCEL_DESCRIPTOR, DESCRIPTION_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import {createDefaultLoadableComponent} from '@app/features/platform/components/loadable/LoadableComponent';
-import {downloadTextFile} from '@app/features/platform/utils/DownloadFile';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import {upsertThemeCssHeader} from '@app/features/theme/utils/ThemeCssUtils';
-import styles from '@app/features/theme_studio/sections/LibrarySection.module.css';
-import type {QuickCssEditorProps} from '@app/features/theme_studio/sections/QuickCssEditor';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import ThemeStudioState from '@app/features/theme_studio/state/ThemeStudioState';
-import {StudioButton} from '@app/features/theme_studio/ui/StudioButton';
-import {StudioEmptyState} from '@app/features/theme_studio/ui/StudioEmptyState';
-import {StudioSearchInput} from '@app/features/theme_studio/ui/StudioSearchInput';
-import {StudioSplit} from '@app/features/theme_studio/ui/StudioSplit';
-import {showThemeStudioErrorModal} from '@app/features/theme_studio/utils/ThemeStudioErrorModalUtils';
-import type {ThemeStudioBaseTheme} from '@app/features/theme_studio/utils/ThemeStudioPinnedVariables';
-import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
-import {modal} from '@app/features/ui/commands/ModalCommands';
-import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
-import {Switch} from '@app/features/ui/components/form/FormSwitch';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {getElectronAPI, isDesktop} from '@app/features/ui/utils/NativeUtils';
-import {
- createThemeExportFileName,
- parseTagInput,
- readFileText,
-} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {msg} from '@lingui/core/macro';
-import {Trans, useLingui} from '@lingui/react/macro';
-import {
- CopyIcon,
- DownloadSimpleIcon,
- FileCssIcon,
- FilePlusIcon,
- FloppyDiskIcon,
- FolderOpenIcon,
- LinkBreakIcon,
- LinkSimpleIcon,
- TrashIcon,
- UploadSimpleIcon,
- WarningCircleIcon,
-} from '@phosphor-icons/react';
-import {clsx} from 'clsx';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useEffect, useId, useMemo, useRef, useState} from 'react';
-
-const THEME_SAVED_DESCRIPTOR = msg({
- message: 'Theme saved.',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const DELETE_THEME_DESCRIPTOR = msg({
- message: 'Delete theme?',
- comment: 'Confirmation prompt in the theme studio library section. Keep the tone plain and specific.',
-});
-const THIS_REMOVES_FROM_THIS_DEVICE_DESCRIPTOR = msg({
- message: 'This removes "{themeName}" from this device.',
- comment: 'Confirmation text before deleting a saved local theme from Theme Studio.',
-});
-const DELETE_THEME_2_DESCRIPTOR = msg({
- message: 'Delete theme',
- comment:
- 'Button or menu action label in the theme studio library section. Keep it concise. Keep the tone plain and specific.',
-});
-const IMPORTED_OTHER_DESCRIPTOR = msg({
- message: 'Imported {length, plural, one {# theme file} other {# theme files}}.',
- comment: 'Toast after importing one or more CSS files into the theme library.',
-});
-const IMPORTED_OTHER_2_DESCRIPTOR = msg({
- message: 'Imported {length, plural, one {# theme file} other {# theme files}}.',
- comment: 'Toast after importing one or more CSS files from a local theme folder.',
-});
-const IMPORTED_OTHER_AND_OTHER_DESCRIPTOR = msg({
- message:
- 'Imported {themes, plural, one {# theme} other {# themes}} and {assets, plural, one {# asset} other {# assets}}.',
- comment: 'Toast after importing a Theme Studio library export file.',
-});
-const WE_COULDN_T_IMPORT_THAT_THEME_LIBRARY_FILE_DESCRIPTOR = msg({
- message: "We couldn't import that theme library file.",
- comment: 'Error message in the theme studio library section.',
-});
-const SEARCH_THEMES_DESCRIPTOR = msg({
- message: 'Search themes…',
- comment: 'Button or menu action label in the theme studio library section. Keep it concise.',
-});
-const NO_THEMES_MATCH_YOUR_SEARCH_DESCRIPTOR = msg({
- message: 'No themes match your search.',
- comment: 'Empty-state text in the theme studio library section.',
-});
-const NO_THEMES_SAVED_YET_DESCRIPTOR = msg({
- message: 'No themes saved yet.',
- comment: 'Empty-state text in the theme studio library section.',
-});
-const TRY_A_DIFFERENT_NAME_OR_CLEAR_THE_SEARCH_DESCRIPTOR = msg({
- message: 'Try a different name or clear the search.',
- comment: 'Description text in the theme studio library section.',
-});
-const IMPORT_A_CSS_FILE_TO_GET_STARTED_OR_DESCRIPTOR = msg({
- message: 'Import a .css file to get started, or paste your own CSS in Quick CSS.',
- comment: 'Description text in the theme studio library section.',
-});
-const ENABLE_DESCRIPTOR = msg({
- message: 'Enable {themeName}',
- comment: 'Accessible label for the switch that enables a saved theme file.',
-});
-const NAME_DESCRIPTOR = msg({
- message: 'Name',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const AUTHOR_DESCRIPTOR = msg({
- message: 'Author',
- comment: 'Short label in the theme studio library section. Keep it concise. Keep the tone plain and specific.',
-});
-const VERSION_DESCRIPTOR = msg({
- message: 'Version',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const TAGS_DESCRIPTOR = msg({
- message: 'Tags',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const COMMA_SEPARATED_DESCRIPTOR = msg({
- message: 'comma, separated',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const THEME_CSS_DESCRIPTOR = msg({
- message: 'Theme CSS',
- comment: 'Short label in the theme studio library section. Keep it concise.',
-});
-const NO_THEME_SELECTED_DESCRIPTOR = msg({
- message: 'No theme selected.',
- comment: 'Empty-state text in the theme studio library section.',
-});
-const PICK_A_THEME_ON_THE_LEFT_TO_EDIT_DESCRIPTOR = msg({
- message: 'Pick a theme on the left to edit its name, metadata, and CSS. Or import a new one.',
- comment: 'Description text in the theme studio library section.',
-});
-const LINKED_THEME_FILES_DESCRIPTOR = msg({
- message:
- 'Linked {length, plural, one {# theme file} other {# theme files}}. Changes you save to them apply right away.',
- comment:
- 'Toast after importing CSS files or a folder on the desktop app. The themes stay linked to the files on disk and update when the file is saved.',
-});
-const LINKED_FILE_DESCRIPTOR = msg({
- message: 'Linked to a file',
- comment:
- 'Accessible label for the icon next to a theme in the Theme Studio library that is linked to a CSS file on disk and updates live.',
-});
-const LINKED_FILE_UNAVAILABLE_DESCRIPTOR = msg({
- message: 'Linked file unavailable',
- comment:
- 'Accessible label for the warning icon next to a linked theme in the Theme Studio library when its CSS file is missing or cannot be read.',
-});
-const LINKED_FILE_LIVE_DESCRIPTOR = msg({
- message: 'Linked to {path}. Edit the file in any editor and saved changes apply here right away.',
- comment:
- 'Banner above a linked theme in the Theme Studio library. {path} is the full path of the CSS file on disk. The theme cannot be edited in the studio while linked.',
-});
-const LINKED_FILE_PATH_DESCRIPTOR = msg({
- message: 'Linked to {path}.',
- comment:
- 'Banner above a linked theme in the Theme Studio library while the app is still checking its CSS file, or when this version of the desktop app cannot follow file changes. {path} is the full path of the CSS file on disk.',
-});
-const LINKED_FILE_MISSING_DESCRIPTOR = msg({
- message: "Can't find {path}. Using the last loaded version.",
- comment:
- 'Banner above a linked theme in the Theme Studio library when its CSS file was moved or deleted. {path} is the full path of the CSS file.',
-});
-const LINKED_FILE_UNREADABLE_DESCRIPTOR = msg({
- message: "Can't read {path}. Using the last loaded version.",
- comment:
- 'Banner above a linked theme in the Theme Studio library when its CSS file exists but cannot be read, for example because it is too large or access was removed. {path} is the full path of the CSS file.',
-});
-
-function LibraryCssEditorLoading() {
- return (
- <div
- className={styles.cssEditorLoading}
- aria-hidden="true"
- data-flx="theme-studio.library-section.css-editor-loading"
- />
- );
-}
-
-const LibraryCssEditor = createDefaultLoadableComponent<QuickCssEditorProps>({
- displayName: 'LibraryCssEditor',
- LoadingComponent: LibraryCssEditorLoading,
- load: () => import('@app/features/theme_studio/sections/QuickCssEditor'),
-});
-
-interface LibrarySectionProps {
- baseTheme: ThemeStudioBaseTheme;
-}
-
-export const LibrarySection: React.FC<LibrarySectionProps> = observer(({baseTheme}) => {
- const {i18n} = useLingui();
- const cssImportRef = useRef<HTMLInputElement | null>(null);
- const libraryImportRef = useRef<HTMLInputElement | null>(null);
- const [selectedThemeId, setSelectedThemeId] = useState<string | null>(null);
- const [draftName, setDraftName] = useState('');
- const [draftDescription, setDraftDescription] = useState('');
- const [draftAuthor, setDraftAuthor] = useState('');
- const [draftVersion, setDraftVersion] = useState('');
- const [draftTags, setDraftTags] = useState('');
- const [draftCss, setDraftCss] = useState('');
- const themeLibraryRevision = ThemeLibrary.revision;
- useEffect(() => {
- void ThemeLibrary.init();
- }, []);
- const searchQuery = ThemeStudioState.librarySearch.trim().toLowerCase();
- const filteredThemes = useMemo(() => {
- if (searchQuery.length === 0) return ThemeLibrary.themes;
- return ThemeLibrary.themes.filter((theme) => {
- return (
- theme.name.toLowerCase().includes(searchQuery) ||
- theme.description.toLowerCase().includes(searchQuery) ||
- theme.tags.some((tag) => tag.toLowerCase().includes(searchQuery)) ||
- theme.fileName.toLowerCase().includes(searchQuery)
- );
- });
- }, [searchQuery, themeLibraryRevision]);
- const selectedTheme = ThemeLibrary.themes.find((theme) => theme.id === selectedThemeId) ?? null;
- useEffect(() => {
- ThemeLibrary.setFocusedThemeId(selectedThemeId);
- }, [selectedThemeId]);
- useEffect(
- () => () => {
- ThemeLibrary.setFocusedThemeId(null);
- },
- [],
- );
- useEffect(() => {
- if (selectedThemeId && ThemeLibrary.themes.some((theme) => theme.id === selectedThemeId)) return;
- setSelectedThemeId(ThemeLibrary.themes[0]?.id ?? null);
- }, [selectedThemeId, themeLibraryRevision]);
- useEffect(() => {
- if (!selectedTheme) {
- setDraftName('');
- setDraftDescription('');
- setDraftAuthor('');
- setDraftVersion('');
- setDraftTags('');
- setDraftCss('');
- return;
- }
- setDraftName(selectedTheme.name);
- setDraftDescription(selectedTheme.description);
- setDraftAuthor(selectedTheme.author);
- setDraftVersion(selectedTheme.version);
- setDraftTags(selectedTheme.tags.join(', '));
- setDraftCss(selectedTheme.css);
- }, [selectedTheme?.id, selectedTheme?.updatedAt]);
- const hasDirty = useMemo(() => {
- if (!selectedTheme) return false;
- return (
- draftName.trim() !== selectedTheme.name ||
- draftDescription !== selectedTheme.description ||
- draftAuthor !== selectedTheme.author ||
- draftVersion !== selectedTheme.version ||
- draftTags !== selectedTheme.tags.join(', ') ||
- draftCss !== selectedTheme.css
- );
- }, [selectedTheme, draftName, draftDescription, draftAuthor, draftVersion, draftTags, draftCss]);
- const handleSelect = useCallback((id: string) => setSelectedThemeId(id), []);
- const handleSave = useCallback(() => {
- if (!selectedTheme || (selectedTheme.linkedPath && ThemeLibrary.canWatchLinkedFiles)) return;
- const metadata = {
- name: draftName.trim() || selectedTheme.name,
- description: draftDescription,
- author: draftAuthor,
- version: draftVersion,
- tags: parseTagInput(draftTags),
- };
- void ThemeLibrary.updateThemeDetails(selectedTheme.id, {
- ...metadata,
- css: upsertThemeCssHeader(draftCss, metadata),
- }).then(() => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(i18n._(THEME_SAVED_DESCRIPTOR));
- });
- }, [selectedTheme, draftName, draftDescription, draftAuthor, draftVersion, draftTags, draftCss, i18n]);
- const handleDuplicate = useCallback(() => {
- if (!selectedTheme) return;
- void ThemeLibrary.duplicateTheme(selectedTheme.id).then((theme) => {
- if (theme) {
- setSelectedThemeId(theme.id);
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- }
- });
- }, [selectedTheme]);
- const handleExportSelected = useCallback(() => {
- if (!selectedTheme) return;
- downloadTextFile(selectedTheme.css, createThemeExportFileName(selectedTheme), 'text/css;charset=utf-8');
- }, [selectedTheme]);
- const handleDelete = useCallback(() => {
- if (!selectedTheme) return;
- ModalCommands.push(
- modal(() => (
- <ConfirmModal
- title={i18n._(DELETE_THEME_DESCRIPTOR)}
- description={i18n._(THIS_REMOVES_FROM_THIS_DEVICE_DESCRIPTOR, {themeName: selectedTheme.name})}
- primaryText={i18n._(DELETE_THEME_2_DESCRIPTOR)}
- primaryVariant="danger"
- secondaryText={i18n._(CANCEL_DESCRIPTOR)}
- onPrimary={() => {
- void ThemeLibrary.deleteTheme(selectedTheme.id).then(() => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- });
- }}
- data-flx="theme-studio.library-section.handle-delete.confirm-modal"
- />
- )),
- );
- }, [selectedTheme, i18n]);
- const handleImportCss = useCallback(
- (event: React.ChangeEvent<HTMLInputElement>) => {
- const files = [...(event.target.files ?? [])];
- event.target.value = '';
- if (files.length === 0) return;
- void ThemeLibrary.importCssFiles(files).then((themes) => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(i18n._(IMPORTED_OTHER_DESCRIPTOR, {length: themes.length}));
- });
- },
- [i18n],
- );
- const handleImportDesktopCss = useCallback(() => {
- void ThemeLibrary.importDesktopCssFiles().then((themes) => {
- if (themes.length > 0) {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(i18n._(LINKED_THEME_FILES_DESCRIPTOR, {length: themes.length}));
- }
- });
- }, [i18n]);
- const handleImportDirectory = useCallback(() => {
- void ThemeLibrary.importDesktopThemeDirectory().then((themes) => {
- if (themes.length > 0) {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- const descriptor = themes.some((theme) => theme.linkedPath)
- ? LINKED_THEME_FILES_DESCRIPTOR
- : IMPORTED_OTHER_2_DESCRIPTOR;
- ToastCommands.success(i18n._(descriptor, {length: themes.length}));
- }
- });
- }, [i18n]);
- const handleLinkFile = useCallback(() => {
- if (!selectedTheme) return;
- void ThemeLibrary.linkThemeToDesktopFile(selectedTheme.id).then((theme) => {
- if (!theme) return;
- if (theme.id !== selectedTheme.id) {
- setSelectedThemeId(theme.id);
- return;
- }
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- });
- }, [selectedTheme]);
- const handleUnlink = useCallback(() => {
- if (!selectedTheme) return;
- void ThemeLibrary.unlinkTheme(selectedTheme.id).then(() => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- });
- }, [selectedTheme]);
- const handleImportLibrary = useCallback(
- (event: React.ChangeEvent<HTMLInputElement>) => {
- const file = event.target.files?.[0];
- event.target.value = '';
- if (!file) return;
- void readFileText(file)
- .then((text) => ThemeLibrary.importExportPayload(JSON.parse(text)))
- .then((result) => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- ToastCommands.success(
- i18n._(IMPORTED_OTHER_AND_OTHER_DESCRIPTOR, {themes: result.themes, assets: result.assets}),
- );
- })
- .catch(() =>
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(WE_COULDN_T_IMPORT_THAT_THEME_LIBRARY_FILE_DESCRIPTOR),
- 'theme-studio.library-section.import-library-error-modal',
- ),
- );
- },
- [i18n],
- );
- const handleExportLibrary = useCallback(() => {
- void ThemeLibrary.buildExportPayload().then((payload) => {
- downloadTextFile(JSON.stringify(payload, null, 2), 'fluxer-theme-library.json', 'application/json;charset=utf-8');
- });
- }, []);
- const hasDesktopFileAccess = isDesktop() && Boolean(getElectronAPI()?.pickThemeLocalFiles);
- const canLinkFiles = isDesktop() && Boolean(getElectronAPI()?.pickThemeLinkedFiles);
- const selectedLinkedPath = selectedTheme?.linkedPath;
- const isSelectedLinked = Boolean(selectedLinkedPath) && ThemeLibrary.canWatchLinkedFiles;
- const selectedLinkedStatus =
- selectedLinkedPath && isSelectedLinked ? ThemeLibrary.linkedFileStatus.get(selectedLinkedPath) : undefined;
- const selectedLinkedProblem = selectedLinkedStatus !== undefined && selectedLinkedStatus !== 'live';
- const LinkedBannerIcon = selectedLinkedProblem ? WarningCircleIcon : LinkSimpleIcon;
- return (
- <div className={styles.section} data-flx="theme-studio.library-section.section">
- <div className={styles.toolbar} data-flx="theme-studio.library-section.toolbar">
- <div className={styles.toolbarSearch} data-flx="theme-studio.library-section.toolbar-search">
- <StudioSearchInput
- value={ThemeStudioState.librarySearch}
- onChange={(value) => ThemeStudioState.setLibrarySearch(value)}
- placeholder={i18n._(SEARCH_THEMES_DESCRIPTOR)}
- data-flx="theme-studio.library-section.studio-search-input.set-library-search"
- />
- </div>
- <div className={styles.toolbarActions} data-flx="theme-studio.library-section.toolbar-actions">
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={<FileCssIcon size={13} weight="bold" data-flx="theme-studio.library-section.file-css-icon" />}
- onClick={canLinkFiles ? handleImportDesktopCss : () => cssImportRef.current?.click()}
- data-flx="theme-studio.library-section.studio-button.click"
- >
- <Trans>Import CSS</Trans>
- </StudioButton>
- {hasDesktopFileAccess ? (
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <FolderOpenIcon size={13} weight="bold" data-flx="theme-studio.library-section.folder-open-icon" />
- }
- onClick={handleImportDirectory}
- data-flx="theme-studio.library-section.studio-button.import-directory"
- >
- <Trans>Import folder</Trans>
- </StudioButton>
- ) : null}
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <UploadSimpleIcon size={13} weight="bold" data-flx="theme-studio.library-section.upload-simple-icon" />
- }
- onClick={() => libraryImportRef.current?.click()}
- data-flx="theme-studio.library-section.studio-button.click--2"
- >
- <Trans>Import library</Trans>
- </StudioButton>
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <DownloadSimpleIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.library-section.download-simple-icon"
- />
- }
- onClick={handleExportLibrary}
- data-flx="theme-studio.library-section.studio-button.export-library"
- >
- <Trans>Export library</Trans>
- </StudioButton>
- </div>
- <input
- ref={cssImportRef}
- type="file"
- accept=".css,text/css,text/plain"
- multiple
- hidden
- onChange={handleImportCss}
- aria-hidden
- data-flx="theme-studio.library-section.input.import-css.file"
- />
- <input
- ref={libraryImportRef}
- type="file"
- accept=".json,application/json,text/plain"
- hidden
- onChange={handleImportLibrary}
- aria-hidden
- data-flx="theme-studio.library-section.input.import-library.file"
- />
- </div>
- <StudioSplit
- className={styles.split}
- orientation="horizontal"
- initialSize={280}
- minSize={200}
- maxSize={460}
- storageKey="ThemeStudio:librarySplit"
- first={
- <div className={styles.list} data-flx="theme-studio.library-section.list">
- {filteredThemes.length === 0 ? (
- <div className={styles.listEmpty} data-flx="theme-studio.library-section.list-empty">
- <StudioEmptyState
- icon={
- <FileCssIcon size={20} weight="duotone" data-flx="theme-studio.library-section.file-css-icon--2" />
- }
- title={
- searchQuery.length > 0
- ? i18n._(NO_THEMES_MATCH_YOUR_SEARCH_DESCRIPTOR)
- : i18n._(NO_THEMES_SAVED_YET_DESCRIPTOR)
- }
- description={
- searchQuery.length > 0
- ? i18n._(TRY_A_DIFFERENT_NAME_OR_CLEAR_THE_SEARCH_DESCRIPTOR)
- : i18n._(IMPORT_A_CSS_FILE_TO_GET_STARTED_OR_DESCRIPTOR)
- }
- data-flx="theme-studio.library-section.studio-empty-state"
- />
- </div>
- ) : (
- filteredThemes.map((theme) => {
- const enabled = ThemeLibrary.enabledThemeIds.includes(theme.id);
- const linkedStatus = theme.linkedPath ? ThemeLibrary.linkedFileStatus.get(theme.linkedPath) : undefined;
- const linkedProblem = linkedStatus !== undefined && linkedStatus !== 'live';
- return (
- <div
- key={theme.id}
- className={clsx(styles.listItem, theme.id === selectedThemeId && styles.listItemActive)}
- data-flx="theme-studio.library-section.list-item"
- >
- <FocusRing offset={-2} data-flx="theme-studio.library-section.focus-ring">
- <button
- type="button"
- className={styles.listItemButton}
- aria-pressed={theme.id === selectedThemeId}
- onClick={() => handleSelect(theme.id)}
- data-flx="theme-studio.library-section.list-item-button.select"
- >
- <span className={styles.listItemMain} data-flx="theme-studio.library-section.list-item-main">
- <span className={styles.listItemName} data-flx="theme-studio.library-section.list-item-name">
- {theme.name || theme.fileName}
- </span>
- <span className={styles.listItemMeta} data-flx="theme-studio.library-section.list-item-meta">
- {theme.linkedPath ? (
- <span
- className={clsx(styles.listItemStatus, linkedProblem && styles.listItemStatusWarning)}
- role="img"
- aria-label={i18n._(
- linkedProblem ? LINKED_FILE_UNAVAILABLE_DESCRIPTOR : LINKED_FILE_DESCRIPTOR,
- )}
- data-flx="theme-studio.library-section.list-item-status"
- >
- {linkedProblem ? (
- <WarningCircleIcon
- size={11}
- weight="bold"
- aria-hidden
- data-flx="theme-studio.library-section.list-item-status-warning-icon"
- />
- ) : (
- <LinkSimpleIcon
- size={11}
- weight="bold"
- aria-hidden
- data-flx="theme-studio.library-section.list-item-status-link-icon"
- />
- )}
- </span>
- ) : null}
- <span data-flx="theme-studio.library-section.list-item-file-name">{theme.fileName}</span>
- </span>
- </span>
- </button>
- </FocusRing>
- <div className={styles.enableSwitch} data-flx="theme-studio.library-section.enable-switch">
- <Switch
- compact
- ariaLabel={i18n._(ENABLE_DESCRIPTOR, {themeName: theme.name || theme.fileName})}
- value={enabled}
- onChange={(value) => {
- void ThemeLibrary.setThemeEnabled(theme.id, value).then(() => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- });
- }}
- data-flx="theme-studio.library-section.switch"
- />
- </div>
- </div>
- );
- })
- )}
- </div>
- }
- second={
- selectedTheme ? (
- <div className={styles.editor} data-flx="theme-studio.library-section.editor">
- <div className={styles.editorTopBar} data-flx="theme-studio.library-section.editor-top-bar">
- <div className={styles.editorTitle} data-flx="theme-studio.library-section.editor-title">
- {selectedTheme.name || selectedTheme.fileName}
- </div>
- <div className={styles.editorActions} data-flx="theme-studio.library-section.editor-actions">
- {canLinkFiles && !selectedLinkedPath ? (
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <LinkSimpleIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.library-section.link-simple-icon"
- />
- }
- disabled={hasDirty}
- onClick={handleLinkFile}
- data-flx="theme-studio.library-section.studio-button.link-file"
- >
- <Trans comment="Button in the Theme Studio library that links an existing theme to a CSS file on disk so saved changes to the file apply live.">
- Link file
- </Trans>
- </StudioButton>
- ) : null}
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <DownloadSimpleIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.library-section.download-simple-icon--2"
- />
- }
- onClick={handleExportSelected}
- data-flx="theme-studio.library-section.studio-button.export-selected"
- >
- <Trans>Export</Trans>
- </StudioButton>
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={<CopyIcon size={13} weight="bold" data-flx="theme-studio.library-section.copy-icon" />}
- onClick={handleDuplicate}
- data-flx="theme-studio.library-section.studio-button.duplicate"
- >
- <Trans>Duplicate</Trans>
- </StudioButton>
- <StudioButton
- variant="danger"
- compact
- leadingIcon={
- <TrashIcon size={13} weight="bold" data-flx="theme-studio.library-section.trash-icon" />
- }
- onClick={handleDelete}
- data-flx="theme-studio.library-section.studio-button.delete"
- >
- <Trans>Delete</Trans>
- </StudioButton>
- </div>
- </div>
- {selectedLinkedPath ? (
- <div
- className={clsx(styles.linkedBanner, selectedLinkedProblem && styles.linkedBannerWarning)}
- data-flx="theme-studio.library-section.linked-banner"
- >
- <LinkedBannerIcon
- size={14}
- weight="bold"
- aria-hidden
- data-flx="theme-studio.library-section.linked-banner-icon"
- />
- <span className={styles.linkedBannerText} data-flx="theme-studio.library-section.linked-banner-text">
- {i18n._(
- selectedLinkedStatus === 'missing'
- ? LINKED_FILE_MISSING_DESCRIPTOR
- : selectedLinkedProblem
- ? LINKED_FILE_UNREADABLE_DESCRIPTOR
- : selectedLinkedStatus === 'live'
- ? LINKED_FILE_LIVE_DESCRIPTOR
- : LINKED_FILE_PATH_DESCRIPTOR,
- {path: selectedLinkedPath},
- )}
- </span>
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <LinkBreakIcon size={13} weight="bold" data-flx="theme-studio.library-section.link-break-icon" />
- }
- onClick={handleUnlink}
- data-flx="theme-studio.library-section.studio-button.unlink"
- >
- <Trans comment="Button in the Theme Studio library that stops a theme following its CSS file on disk and turns it back into an editable copy.">
- Unlink
- </Trans>
- </StudioButton>
- </div>
- ) : null}
- <div className={styles.fields} data-flx="theme-studio.library-section.fields">
- <LibraryField
- label={i18n._(NAME_DESCRIPTOR)}
- value={draftName}
- onChange={setDraftName}
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-field.set-draft-name"
- />
- <LibraryField
- label={i18n._(AUTHOR_DESCRIPTOR)}
- value={draftAuthor}
- onChange={setDraftAuthor}
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-field.set-draft-author"
- />
- <LibraryField
- label={i18n._(VERSION_DESCRIPTOR)}
- value={draftVersion}
- onChange={setDraftVersion}
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-field.set-draft-version"
- />
- <LibraryField
- label={i18n._(TAGS_DESCRIPTOR)}
- value={draftTags}
- onChange={setDraftTags}
- placeholder={i18n._(COMMA_SEPARATED_DESCRIPTOR)}
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-field.set-draft-tags"
- />
- <LibraryField
- label={i18n._(DESCRIPTION_DESCRIPTOR)}
- value={draftDescription}
- onChange={setDraftDescription}
- fullWidth
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-field.set-draft-description"
- />
- </div>
- <div className={styles.cssWrap} data-flx="theme-studio.library-section.css-wrap">
- <div className={styles.cssFrame} data-flx="theme-studio.library-section.css-frame">
- <LibraryCssEditor
- ariaLabel={i18n._(THEME_CSS_DESCRIPTOR)}
- baseTheme={baseTheme}
- className={styles.cssEditor}
- value={draftCss}
- onChange={setDraftCss}
- readOnly={isSelectedLinked}
- data-flx="theme-studio.library-section.library-css-editor.set-draft-css"
- />
- </div>
- </div>
- {isSelectedLinked ? null : (
- <div className={styles.editorFooter} data-flx="theme-studio.library-section.editor-footer">
- <StudioButton
- variant="primary"
- leadingIcon={
- <FloppyDiskIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.library-section.floppy-disk-icon"
- />
- }
- disabled={!hasDirty}
- onClick={handleSave}
- data-flx="theme-studio.library-section.studio-button.save"
- >
- <Trans>Save theme</Trans>
- </StudioButton>
- {hasDirty ? (
- <span className={styles.dirtyHint} data-flx="theme-studio.library-section.dirty-hint">
- <Trans>Unsaved changes</Trans>
- </span>
- ) : null}
- </div>
- )}
- </div>
- ) : (
- <div className={styles.editorEmpty} data-flx="theme-studio.library-section.editor-empty">
- <StudioEmptyState
- icon={
- <FilePlusIcon size={20} weight="duotone" data-flx="theme-studio.library-section.file-plus-icon" />
- }
- title={i18n._(NO_THEME_SELECTED_DESCRIPTOR)}
- description={i18n._(PICK_A_THEME_ON_THE_LEFT_TO_EDIT_DESCRIPTOR)}
- data-flx="theme-studio.library-section.studio-empty-state--2"
- />
- </div>
- )
- }
- data-flx="theme-studio.library-section.split"
- />
- </div>
- );
-});
-
-interface LibraryFieldProps {
- label: string;
- value: string;
- onChange: (value: string) => void;
- placeholder?: string;
- fullWidth?: boolean;
- readOnly?: boolean;
-}
-
-const LibraryField: React.FC<LibraryFieldProps> = ({label, value, onChange, placeholder, fullWidth, readOnly}) => {
- const inputId = useId();
- return (
- <div
- className={clsx(styles.field, fullWidth && styles.fieldFull)}
- data-flx="theme-studio.library-section.library-field.field"
- >
- <label
- className={styles.fieldLabel}
- htmlFor={inputId}
- data-flx="theme-studio.library-section.library-field.field-label"
- >
- {label}
- </label>
- <FocusRing within offset={-1} data-flx="theme-studio.library-section.library-field.focus-ring">
- <input
- id={inputId}
- type="text"
- className={styles.fieldInput}
- value={value}
- placeholder={placeholder}
- readOnly={readOnly}
- onChange={(event) => onChange(event.target.value)}
- data-flx="theme-studio.library-section.library-field.field-input.change.text"
- />
- </FocusRing>
- </div>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/sections/QuickCssSection.module.css b/fluxer_app/src/features/theme_studio/sections/QuickCssSection.module.css
deleted file mode 100644
index e1c7c6764..000000000
--- a/fluxer_app/src/features/theme_studio/sections/QuickCssSection.module.css
+++ /dev/null
@@ -1,87 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.toolbar {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- flex-wrap: wrap;
- background: var(--studio-bg-panel-header);
-}
-
-.toolbarActions {
- display: flex;
- gap: 0.5rem;
- margin-left: auto;
-}
-
-.editorWrap {
- flex: 1 1 auto;
- min-width: 0;
- min-height: 0;
- padding: 0.875rem 0.875rem 0.625rem;
- display: flex;
- background: var(--studio-bg-editor);
-}
-
-.editorFrame {
- flex: 1 1 auto;
- position: relative;
- display: flex;
- min-width: 0;
- min-height: 0;
- width: 100%;
- height: 100%;
- background: var(--studio-bg-editor);
- border: 0.0625rem solid var(--studio-border);
- border-radius: var(--studio-radius-lg);
- color: var(--studio-fg-primary);
- outline: none;
- overflow: hidden;
-}
-
-.editor,
-.editorLoading {
- position: absolute;
- inset: 0;
- width: 100%;
- height: 100%;
- min-width: 0;
- min-height: 0;
-}
-
-.editor :global(.cm-editor) {
- height: 100%;
- border-radius: var(--studio-radius-lg);
- outline: none;
-}
-
-.editor :global(.cm-editor.cm-focused) {
- outline: none;
-}
-
-.editor :global(.cm-scroller) {
- overflow: auto;
-}
-
-.footer {
- display: flex;
- align-items: center;
- gap: 0.75rem;
- padding: 0 0.875rem 0.75rem;
- color: var(--studio-fg-muted);
- font-size: var(--studio-fs-xs);
- background: var(--studio-bg-editor);
-}
-
-.spacer {
- flex: 1 1 auto;
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/QuickCssSection.tsx b/fluxer_app/src/features/theme_studio/sections/QuickCssSection.tsx
deleted file mode 100644
index d2c442c24..000000000
--- a/fluxer_app/src/features/theme_studio/sections/QuickCssSection.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import * as AccessibilityCommands from '@app/features/accessibility/commands/AccessibilityCommands';
-import Accessibility from '@app/features/accessibility/state/Accessibility';
-import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
-import {CANCEL_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import {createDefaultLoadableComponent} from '@app/features/platform/components/loadable/LoadableComponent';
-import {downloadTextFile} from '@app/features/platform/utils/DownloadFile';
-import {ShareThemeModal} from '@app/features/theme/components/modals/ShareThemeModal';
-import type {QuickCssEditorProps} from '@app/features/theme_studio/sections/QuickCssEditor';
-import styles from '@app/features/theme_studio/sections/QuickCssSection.module.css';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import {StudioButton} from '@app/features/theme_studio/ui/StudioButton';
-import {showThemeStudioErrorModal} from '@app/features/theme_studio/utils/ThemeStudioErrorModalUtils';
-import type {ThemeStudioBaseTheme} from '@app/features/theme_studio/utils/ThemeStudioPinnedVariables';
-import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
-import {modal} from '@app/features/ui/commands/ModalCommands';
-import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
-import {copyText, readFileText} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {msg} from '@lingui/core/macro';
-import {Plural, Trans, useLingui} from '@lingui/react/macro';
-import {
- ArrowCounterClockwiseIcon,
- CopyIcon,
- DownloadSimpleIcon,
- ShareNetworkIcon,
- UploadSimpleIcon,
-} from '@phosphor-icons/react';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useEffect, useRef, useState} from 'react';
-
-const QUICK_CSS_REPLACED_FROM_DESCRIPTOR = msg({
- message: 'Quick CSS replaced from {fileName}.',
- comment: 'Toast after importing a CSS file into the Quick CSS editor.',
-});
-const WE_COULDN_T_READ_THAT_CSS_FILE_DESCRIPTOR = msg({
- message: "We couldn't read that CSS file.",
- comment: 'Error message in the theme studio quick css section.',
-});
-const QUICK_CSS_COPIED_TO_CLIPBOARD_DESCRIPTOR = msg({
- message: 'Quick CSS copied to clipboard.',
- comment: 'Description text in the theme studio quick css section.',
-});
-const WE_COULDN_T_COPY_THAT_DESCRIPTOR = msg({
- message: "We couldn't copy that.",
- comment: 'Error message in the theme studio quick css section.',
-});
-const ADD_SOME_CSS_BEFORE_SHARING_DESCRIPTOR = msg({
- message: 'Add some CSS before sharing.',
- comment: 'Button or menu action label in the theme studio quick css section. Keep it concise.',
-});
-const CLEAR_QUICK_CSS_DESCRIPTOR = msg({
- message: 'Clear quick CSS?',
- comment: 'Confirmation prompt in the theme studio quick css section.',
-});
-const THIS_REMOVES_ALL_CUSTOM_CSS_OVERRIDES_THEME_FILES_DESCRIPTOR = msg({
- message: 'This removes all custom CSS overrides. Theme files in your library are not affected.',
- comment: 'Description text in the theme studio quick css section. Keep the tone plain and specific.',
-});
-const CLEAR_DESCRIPTOR = msg({
- message: 'Clear',
- comment: 'Button or menu action label in the theme studio quick css section. Keep it concise.',
-});
-const QUICK_CSS_EDITOR_DESCRIPTOR = msg({
- message: 'Quick CSS editor',
- comment: 'Short label in the theme studio quick css section. Keep it concise.',
-});
-
-function QuickCssEditorLoading() {
- return (
- <div className={styles.editorLoading} aria-hidden="true" data-flx="theme-studio.quick-css-section.editor-loading" />
- );
-}
-
-const QuickCssEditor = createDefaultLoadableComponent<QuickCssEditorProps>({
- displayName: 'QuickCssEditor',
- LoadingComponent: QuickCssEditorLoading,
- load: () => import('@app/features/theme_studio/sections/QuickCssEditor'),
-});
-
-interface QuickCssSectionProps {
- baseTheme: ThemeStudioBaseTheme;
-}
-
-export const QuickCssSection: React.FC<QuickCssSectionProps> = observer(({baseTheme}) => {
- const {i18n} = useLingui();
- const customThemeCss = Accessibility.customThemeCss ?? '';
- const [draft, setDraft] = useState(customThemeCss);
- const fileInputRef = useRef<HTMLInputElement | null>(null);
- useEffect(() => {
- setDraft(customThemeCss);
- }, [customThemeCss]);
- const flush = useCallback((next: string) => {
- const trimmed = next.trim().length === 0 ? null : next;
- if (trimmed === (Accessibility.customThemeCss ?? null)) return;
- AccessibilityCommands.update({customThemeCss: trimmed});
- broadcastThemeStudioMessage({type: 'customThemeCss', value: trimmed});
- }, []);
- const handleChange = useCallback(
- (next: string) => {
- setDraft(next);
- flush(next);
- },
- [flush],
- );
- const handleImport = (event: React.ChangeEvent<HTMLInputElement>) => {
- const file = event.target.files?.[0];
- event.target.value = '';
- if (!file) return;
- void readFileText(file)
- .then((text) => {
- setDraft(text);
- flush(text);
- ToastCommands.success(i18n._(QUICK_CSS_REPLACED_FROM_DESCRIPTOR, {fileName: file.name}));
- })
- .catch(() =>
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(WE_COULDN_T_READ_THAT_CSS_FILE_DESCRIPTOR),
- 'theme-studio.quick-css-section.import-error-modal',
- ),
- );
- };
- const handleDownload = () => {
- downloadTextFile(draft, 'quick.css', 'text/css;charset=utf-8');
- };
- const handleCopy = () => {
- void copyText(draft)
- .then(() => ToastCommands.success(i18n._(QUICK_CSS_COPIED_TO_CLIPBOARD_DESCRIPTOR)))
- .catch(() =>
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(WE_COULDN_T_COPY_THAT_DESCRIPTOR),
- 'theme-studio.quick-css-section.copy-error-modal',
- ),
- );
- };
- const handleShare = () => {
- if (draft.trim().length === 0) {
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(ADD_SOME_CSS_BEFORE_SHARING_DESCRIPTOR),
- 'theme-studio.quick-css-section.share-empty-error-modal',
- );
- return;
- }
- ModalCommands.push(
- modal(() => (
- <ShareThemeModal themeCss={draft} data-flx="theme-studio.quick-css-section.handle-share.share-theme-modal" />
- )),
- );
- };
- const handleClear = () => {
- if (draft.trim().length === 0) return;
- ModalCommands.push(
- modal(() => (
- <ConfirmModal
- title={i18n._(CLEAR_QUICK_CSS_DESCRIPTOR)}
- description={i18n._(THIS_REMOVES_ALL_CUSTOM_CSS_OVERRIDES_THEME_FILES_DESCRIPTOR)}
- primaryText={i18n._(CLEAR_DESCRIPTOR)}
- primaryVariant="danger"
- secondaryText={i18n._(CANCEL_DESCRIPTOR)}
- onPrimary={() => {
- setDraft('');
- flush('');
- }}
- data-flx="theme-studio.quick-css-section.handle-clear.confirm-modal"
- />
- )),
- );
- };
- const characterCount = draft.length;
- const lineCount = characterCount === 0 ? 0 : draft.split('\n').length;
- return (
- <div className={styles.section} data-flx="theme-studio.quick-css-section.section">
- <div className={styles.toolbar} data-flx="theme-studio.quick-css-section.toolbar">
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <UploadSimpleIcon size={13} weight="bold" data-flx="theme-studio.quick-css-section.upload-simple-icon" />
- }
- onClick={() => fileInputRef.current?.click()}
- data-flx="theme-studio.quick-css-section.studio-button.click"
- >
- <Trans>Import CSS</Trans>
- </StudioButton>
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <DownloadSimpleIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.quick-css-section.download-simple-icon"
- />
- }
- onClick={handleDownload}
- data-flx="theme-studio.quick-css-section.studio-button.download"
- >
- <Trans>Download</Trans>
- </StudioButton>
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={<CopyIcon size={13} weight="bold" data-flx="theme-studio.quick-css-section.copy-icon" />}
- onClick={handleCopy}
- data-flx="theme-studio.quick-css-section.studio-button.copy"
- >
- <Trans>Copy</Trans>
- </StudioButton>
- <StudioButton
- variant="primary"
- compact
- leadingIcon={
- <ShareNetworkIcon size={13} weight="bold" data-flx="theme-studio.quick-css-section.share-network-icon" />
- }
- onClick={handleShare}
- data-flx="theme-studio.quick-css-section.studio-button.share"
- >
- <Trans>Share</Trans>
- </StudioButton>
- <div className={styles.toolbarActions} data-flx="theme-studio.quick-css-section.toolbar-actions">
- <StudioButton
- variant="danger"
- compact
- leadingIcon={
- <ArrowCounterClockwiseIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.quick-css-section.arrow-counter-clockwise-icon"
- />
- }
- onClick={handleClear}
- data-flx="theme-studio.quick-css-section.studio-button.clear"
- >
- <Trans>Clear</Trans>
- </StudioButton>
- </div>
- <input
- ref={fileInputRef}
- type="file"
- accept=".css,text/css,text/plain"
- hidden
- onChange={handleImport}
- aria-hidden
- data-flx="theme-studio.quick-css-section.input.import.file"
- />
- </div>
- <div className={styles.editorWrap} data-flx="theme-studio.quick-css-section.editor-wrap">
- <div className={styles.editorFrame} data-flx="theme-studio.quick-css-section.editor-frame">
- <QuickCssEditor
- ariaLabel={i18n._(QUICK_CSS_EDITOR_DESCRIPTOR)}
- baseTheme={baseTheme}
- className={styles.editor}
- value={draft}
- onChange={handleChange}
- data-flx="theme-studio.quick-css-section.editor.change"
- />
- </div>
- </div>
- <div className={styles.footer} data-flx="theme-studio.quick-css-section.footer">
- <span data-flx="theme-studio.quick-css-section.span">
- <Plural value={lineCount} one="# line" other="# lines" data-flx="theme-studio.quick-css-section.plural" />
- </span>
- <span data-flx="theme-studio.quick-css-section.span--2">
- <Plural
- value={characterCount}
- one="# character"
- other="# characters"
- data-flx="theme-studio.quick-css-section.plural--2"
- />
- </span>
- <span className={styles.spacer} data-flx="theme-studio.quick-css-section.spacer" />
- <span data-flx="theme-studio.quick-css-section.span--3">
- <Trans>Changes apply instantly to the live client.</Trans>
- </span>
- </div>
- </div>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.module.css b/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.module.css
deleted file mode 100644
index 9b15ed2f7..000000000
--- a/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.module.css
+++ /dev/null
@@ -1,98 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
- overflow-y: auto;
- padding: 1.25rem 1.5rem 1.75rem;
- gap: 1rem;
- background: var(--studio-bg-editor);
-}
-
-.group {
- display: flex;
- flex-direction: column;
- gap: 0.5rem;
-}
-
-.groupTitle {
- font-size: var(--studio-fs-xs);
- font-weight: 700;
- letter-spacing: 0;
- color: var(--studio-fg-subtle);
- margin: 0.375rem 0 0.3125rem;
-}
-
-.card {
- display: flex;
- flex-direction: column;
- background: var(--studio-bg-elevated);
- border: 0.0625rem solid var(--studio-border);
- border-radius: var(--studio-radius-lg);
- overflow: hidden;
- box-shadow: var(--studio-shadow-panel);
-}
-
-.row {
- display: flex;
- align-items: center;
- gap: 0.75rem;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
-}
-
-.row:last-child {
- border-bottom: none;
-}
-
-.rowText {
- flex: 1 1 auto;
- min-width: 0;
-}
-
-.rowLabel {
- margin: 0;
- font-size: var(--studio-fs-sm);
- font-weight: 500;
- color: var(--studio-fg-primary);
-}
-
-.rowDescription {
- margin: 0.125rem 0 0;
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-muted);
- line-height: 1.5;
-}
-
-.rowControl {
- display: flex;
- align-items: center;
- gap: 0.375rem;
- flex-shrink: 0;
-}
-
-.dangerCard {
- border-color: color-mix(in srgb, var(--studio-danger) 36%, var(--studio-border));
-}
-
-.notice {
- padding: 0.75rem 0.875rem;
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-muted);
- line-height: 1.5;
- border-top: 0.0625rem solid var(--studio-border);
-}
-
-.noticeList {
- margin: 0;
- padding-left: 1.125rem;
- display: flex;
- flex-direction: column;
- gap: 0.25rem;
-}
-
-.noticeList li::marker {
- color: var(--studio-fg-subtle);
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.tsx b/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.tsx
deleted file mode 100644
index 71af7159a..000000000
--- a/fluxer_app/src/features/theme_studio/sections/ThemeStudioSettingsSection.tsx
+++ /dev/null
@@ -1,418 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import * as AccessibilityCommands from '@app/features/accessibility/commands/AccessibilityCommands';
-import Accessibility from '@app/features/accessibility/state/Accessibility';
-import {ConfirmModal} from '@app/features/app/components/dialogs/ConfirmModal';
-import {useNativePlatform} from '@app/features/app/hooks/useNativePlatform';
-import RuntimeConfig from '@app/features/app/state/RuntimeConfig';
-import {CANCEL_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import {ShareThemeModal} from '@app/features/theme/components/modals/ShareThemeModal';
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import Theme from '@app/features/theme/state/Theme';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import styles from '@app/features/theme_studio/sections/ThemeStudioSettingsSection.module.css';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import {StudioButton} from '@app/features/theme_studio/ui/StudioButton';
-import {showThemeStudioErrorModal} from '@app/features/theme_studio/utils/ThemeStudioErrorModalUtils';
-import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
-import {modal} from '@app/features/ui/commands/ModalCommands';
-import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
-import {Switch} from '@app/features/ui/components/form/FormSwitch';
-import {
- getCachedDesktopWindowBehaviorSettings,
- getDesktopWindowBehaviorSettings,
- relaunchDesktopApp,
- setDesktopWindowBehaviorSettings,
-} from '@app/features/ui/utils/DesktopWindowBehaviorUtils';
-import {isDesktop} from '@app/features/ui/utils/NativeUtils';
-import type {DesktopWindowBehaviorSettings} from '@app/types/electron.d';
-import {msg} from '@lingui/core/macro';
-import {Trans, useLingui} from '@lingui/react/macro';
-import {ArrowCounterClockwiseIcon, ShareNetworkIcon, TrashIcon} from '@phosphor-icons/react';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useCallback, useEffect, useState} from 'react';
-
-const SYNC_CUSTOM_CSS_DESCRIPTOR = msg({
- message: 'Sync custom CSS?',
- comment: 'Confirmation prompt in the theme studio settings section.',
-});
-const SYNC_CUSTOM_CSS_DESCRIPTION_DESCRIPTOR = msg({
- message:
- 'Only the CSS text is synced across devices. Uploaded assets, desktop file references, fonts, and media stay on this device.',
- comment: 'Label in the theme studio settings section.',
-});
-const SYNC_CSS_TEXT_DESCRIPTOR = msg({
- message: 'Sync CSS text',
- comment: 'Short label in the theme studio settings section. Keep it concise.',
-});
-const RESTART_DESCRIPTOR = msg({
- message: 'Restart {productName}?',
- comment: 'Confirmation title after changing desktop transparency in Theme Studio.',
-});
-const TRANSPARENCY_RESTART_DESCRIPTION_DESCRIPTOR = msg({
- message: 'Desktop window transparency changes apply after restarting the app.',
- comment: 'Description text in the theme studio settings section.',
-});
-const RESTART_NOW_DESCRIPTOR = msg({
- message: 'Restart now',
- comment: 'Short label in the theme studio settings section. Keep it concise.',
-});
-const LATER_DESCRIPTOR = msg({
- message: 'Later',
- comment: 'Short label in the theme studio settings section. Keep it concise.',
-});
-const NO_THEME_OVERRIDES_TO_SHARE_DESCRIPTOR = msg({
- message: "You don't have any custom theme overrides to share yet.",
- comment: 'Description text in the theme studio settings section.',
-});
-const RESET_CUSTOM_THEME_DATA_DESCRIPTOR = msg({
- message: 'Reset custom theme data?',
- comment: 'Confirmation prompt in the theme studio settings section.',
-});
-const RESET_CUSTOM_THEME_DATA_DESCRIPTION_DESCRIPTOR = msg({
- message: 'This clears quick CSS, imported themes, uploaded assets, and local file references on this device.',
- comment: 'Description text in the theme studio settings section.',
-});
-const RESET_DATA_DESCRIPTOR = msg({
- message: 'Reset data',
- comment: 'Button or menu action label in the theme studio settings section. Keep it concise.',
-});
-const SYNC_CUSTOM_CSS_ACROSS_DEVICES_DESCRIPTOR = msg({
- message: 'Sync custom CSS across devices',
- comment: 'Label in the theme studio settings section.',
-});
-const SYNC_BASE_THEME_ACROSS_DEVICES_DESCRIPTOR = msg({
- message: 'Sync base theme across devices',
- comment: 'Label in the theme studio settings section.',
-});
-const ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR = msg({
- message: 'Allow transparent desktop window',
- comment: 'Label in the theme studio settings section.',
-});
-const TOKEN_OVERRIDES_CLEARED_DESCRIPTOR = msg({
- message: 'Token overrides cleared.',
- comment: 'Short label in the theme studio settings section. Keep it concise. Keep the tone plain and specific.',
-});
-export const SettingsSection: React.FC = observer(() => {
- const {i18n} = useLingui();
- const {isLinux, isWindows} = useNativePlatform();
- const [desktopWindowBehavior, setDesktopWindowBehavior] = useState<DesktopWindowBehaviorSettings | null>(
- getCachedDesktopWindowBehaviorSettings(),
- );
- const [desktopBusy, setDesktopBusy] = useState(false);
- useEffect(() => {
- if (!isDesktop()) return;
- void getDesktopWindowBehaviorSettings().then((settings) => setDesktopWindowBehavior(settings));
- }, []);
- const handleSyncCustomCss = useCallback(
- (value: boolean) => {
- if (!value) {
- Accessibility.updateSettings({customThemeCssSyncAcrossDevices: false});
- return;
- }
- ModalCommands.push(
- modal(() => (
- <ConfirmModal
- title={i18n._(SYNC_CUSTOM_CSS_DESCRIPTOR)}
- description={i18n._(SYNC_CUSTOM_CSS_DESCRIPTION_DESCRIPTOR)}
- primaryText={i18n._(SYNC_CSS_TEXT_DESCRIPTOR)}
- secondaryText={i18n._(CANCEL_DESCRIPTOR)}
- onPrimary={() => Accessibility.updateSettings({customThemeCssSyncAcrossDevices: true})}
- data-flx="theme-studio.settings-section.handle-sync-custom-css.confirm-modal"
- />
- )),
- );
- },
- [i18n],
- );
- const handleAllowTransparency = useCallback(
- (value: boolean) => {
- if (!desktopWindowBehavior) return;
- setDesktopBusy(true);
- void setDesktopWindowBehaviorSettings({allowTransparency: value})
- .then((nextSettings) => {
- if (nextSettings) {
- setDesktopWindowBehavior(nextSettings);
- }
- ModalCommands.push(
- modal(() => (
- <ConfirmModal
- title={i18n._(RESTART_DESCRIPTOR, {productName: RuntimeConfig.productName})}
- description={i18n._(TRANSPARENCY_RESTART_DESCRIPTION_DESCRIPTOR)}
- primaryText={i18n._(RESTART_NOW_DESCRIPTOR)}
- secondaryText={i18n._(LATER_DESCRIPTOR)}
- onPrimary={async () => relaunchDesktopApp()}
- data-flx="theme-studio.settings-section.handle-allow-transparency.confirm-modal"
- />
- )),
- );
- })
- .finally(() => setDesktopBusy(false));
- },
- [desktopWindowBehavior, i18n],
- );
- const handleShareTheme = useCallback(() => {
- const css = [ThemeLibrary.activeThemeCss, Accessibility.customThemeCss ?? '']
- .map((value) => value.trim())
- .filter(Boolean)
- .join('\n\n');
- if (!css.trim()) {
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(NO_THEME_OVERRIDES_TO_SHARE_DESCRIPTOR),
- 'theme-studio.settings-section.share-theme-empty-error-modal',
- );
- return;
- }
- ModalCommands.push(
- modal(() => (
- <ShareThemeModal themeCss={css} data-flx="theme-studio.settings-section.handle-share-theme.share-theme-modal" />
- )),
- );
- }, [i18n]);
- const handleResetData = useCallback(() => {
- ModalCommands.push(
- modal(() => (
- <ConfirmModal
- title={i18n._(RESET_CUSTOM_THEME_DATA_DESCRIPTOR)}
- description={i18n._(RESET_CUSTOM_THEME_DATA_DESCRIPTION_DESCRIPTOR)}
- primaryText={i18n._(RESET_DATA_DESCRIPTOR)}
- primaryVariant="danger"
- secondaryText={i18n._(CANCEL_DESCRIPTOR)}
- onPrimary={() => {
- AccessibilityCommands.update({customThemeCss: null});
- void ThemeLibrary.resetLibrary().then(() => {
- broadcastThemeStudioMessage({type: 'themeLibrary', revision: ThemeLibrary.revision});
- });
- broadcastThemeStudioMessage({type: 'customThemeCss', value: null});
- }}
- data-flx="theme-studio.settings-section.handle-reset-data.confirm-modal"
- />
- )),
- );
- }, [i18n]);
- return (
- <div className={styles.section} data-flx="theme-studio.settings-section.section">
- <div className={styles.group} data-flx="theme-studio.settings-section.group">
- <h3 className={styles.groupTitle} data-flx="theme-studio.settings-section.group-title">
- <Trans>Sync</Trans>
- </h3>
- <div className={styles.card} data-flx="theme-studio.settings-section.card">
- <div className={styles.row} data-flx="theme-studio.settings-section.row">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label">
- <Trans>Sync custom CSS across devices</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description">
- <Trans>
- Only the CSS text is synced. Uploaded assets and local file references stay on this device.
- </Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control">
- <Switch
- ariaLabel={i18n._(SYNC_CUSTOM_CSS_ACROSS_DEVICES_DESCRIPTOR)}
- value={Accessibility.customThemeCssSyncAcrossDevices}
- onChange={handleSyncCustomCss}
- data-flx="theme-studio.settings-section.switch.sync-custom-css"
- />
- </div>
- </div>
- <div className={styles.row} data-flx="theme-studio.settings-section.row--2">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text--2">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label--2">
- <Trans>Sync base theme across devices</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description--2">
- <Trans>
- Mirror of the Appearance tab toggle for light/dark/coal preference. Disable for a per-device base
- theme.
- </Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control--2">
- <Switch
- ariaLabel={i18n._(SYNC_BASE_THEME_ACROSS_DEVICES_DESCRIPTOR)}
- value={Theme.syncAcrossDevices}
- disabled
- onChange={() => {}}
- data-flx="theme-studio.settings-section.switch"
- />
- </div>
- </div>
- </div>
- </div>
-
- {isDesktop() && desktopWindowBehavior ? (
- <div className={styles.group} data-flx="theme-studio.settings-section.group--2">
- <h3 className={styles.groupTitle} data-flx="theme-studio.settings-section.group-title--2">
- <Trans>Desktop</Trans>
- </h3>
- <div className={styles.card} data-flx="theme-studio.settings-section.card--2">
- <div className={styles.row} data-flx="theme-studio.settings-section.row--3">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text--3">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label--3">
- <Trans>Allow transparent desktop window</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description--3">
- <Trans>Lets custom CSS reveal transparent window regions after restarting the desktop app.</Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control--3">
- <Switch
- ariaLabel={i18n._(ALLOW_TRANSPARENT_DESKTOP_WINDOW_DESCRIPTOR)}
- value={desktopWindowBehavior.allowTransparency}
- disabled={desktopBusy}
- onChange={handleAllowTransparency}
- data-flx="theme-studio.settings-section.switch.allow-transparency"
- />
- </div>
- </div>
- {isLinux && desktopWindowBehavior.allowTransparency ? (
- <div className={styles.notice} data-flx="theme-studio.settings-section.linux-transparency-notice">
- <ul className={styles.noticeList} data-flx="theme-studio.settings-section.notice-list--linux">
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li">
- <Trans>
- Resizing, maximizing, and window snapping depend on the compositor. Wayland without client-side
- decorations may not provide handles. Launch with --ozone-platform=x11 if the window feels stuck.
- </Trans>
- </li>
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li--2">
- <Trans>
- Hardware acceleration can cause rendering glitches with transparent windows. Try --disable-gpu if
- you see flicker or smearing.
- </Trans>
- </li>
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li--3">
- <Trans>
- Docked DevTools and windows partially off-screen can render a gray background instead of staying
- transparent.
- </Trans>
- </li>
- </ul>
- </div>
- ) : null}
- {isWindows && desktopWindowBehavior.allowTransparency ? (
- <div className={styles.notice} data-flx="theme-studio.settings-section.windows-transparency-notice">
- <ul className={styles.noticeList} data-flx="theme-studio.settings-section.notice-list--windows">
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li--4">
- <Trans>Aero Snap and Snap Layouts can stop working while transparency is enabled.</Trans>
- </li>
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li--5">
- <Trans>
- Windows cut off at the top or bottom of the screen, and docked DevTools, can render a gray
- background instead of staying transparent.
- </Trans>
- </li>
- <li data-flx="theme-studio.theme-studio-settings-section.settings-section.li--6">
- <Trans>
- Text is rendered with grayscale antialiasing instead of ClearType while transparency is enabled,
- so it will look softer.
- </Trans>
- </li>
- </ul>
- </div>
- ) : null}
- </div>
- </div>
- ) : null}
-
- <div className={styles.group} data-flx="theme-studio.settings-section.group--3">
- <h3 className={styles.groupTitle} data-flx="theme-studio.settings-section.group-title--3">
- <Trans>Share</Trans>
- </h3>
- <div className={styles.card} data-flx="theme-studio.settings-section.card--3">
- <div className={styles.row} data-flx="theme-studio.settings-section.row--4">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text--4">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label--4">
- <Trans>Share active custom theme</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description--4">
- <Trans>Generate a shareable link or copy your combined custom CSS.</Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control--4">
- <StudioButton
- variant="primary"
- leadingIcon={
- <ShareNetworkIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.settings-section.share-network-icon"
- />
- }
- onClick={handleShareTheme}
- data-flx="theme-studio.settings-section.studio-button.share-theme"
- >
- <Trans>Share theme</Trans>
- </StudioButton>
- </div>
- </div>
- </div>
- </div>
-
- <div className={styles.group} data-flx="theme-studio.settings-section.group--4">
- <h3 className={styles.groupTitle} data-flx="theme-studio.settings-section.group-title--4">
- <Trans>Danger zone</Trans>
- </h3>
- <div className={`${styles.card} ${styles.dangerCard}`} data-flx="theme-studio.settings-section.card--4">
- <div className={styles.row} data-flx="theme-studio.settings-section.row--5">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text--5">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label--5">
- <Trans>Reset custom theme data</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description--5">
- <Trans>
- Clears quick CSS, imported themes, uploaded assets, and local file references on this device.
- </Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control--5">
- <StudioButton
- variant="dangerSolid"
- leadingIcon={
- <TrashIcon size={remFromPx(13)} weight="bold" data-flx="theme-studio.settings-section.trash-icon" />
- }
- onClick={handleResetData}
- data-flx="theme-studio.settings-section.studio-button.reset-data"
- >
- <Trans>Reset data</Trans>
- </StudioButton>
- </div>
- </div>
- <div className={styles.row} data-flx="theme-studio.settings-section.row--6">
- <div className={styles.rowText} data-flx="theme-studio.settings-section.row-text--6">
- <p className={styles.rowLabel} data-flx="theme-studio.settings-section.row-label--6">
- <Trans>Clear all token overrides</Trans>
- </p>
- <p className={styles.rowDescription} data-flx="theme-studio.settings-section.row-description--6">
- <Trans>Removes every per-variable override but keeps your library and assets intact.</Trans>
- </p>
- </div>
- <div className={styles.rowControl} data-flx="theme-studio.settings-section.row-control--6">
- <StudioButton
- variant="danger"
- leadingIcon={
- <ArrowCounterClockwiseIcon
- size={13}
- weight="bold"
- data-flx="theme-studio.settings-section.arrow-counter-clockwise-icon"
- />
- }
- onClick={() => {
- AccessibilityCommands.update({customThemeCss: null});
- broadcastThemeStudioMessage({type: 'customThemeCss', value: null});
- ToastCommands.success(i18n._(TOKEN_OVERRIDES_CLEARED_DESCRIPTOR));
- }}
- data-flx="theme-studio.settings-section.studio-button.update"
- >
- <Trans>Clear overrides</Trans>
- </StudioButton>
- </div>
- </div>
- </div>
- </div>
- </div>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/sections/TokensSection.module.css b/fluxer_app/src/features/theme_studio/sections/TokensSection.module.css
deleted file mode 100644
index b9f9b9ec8..000000000
--- a/fluxer_app/src/features/theme_studio/sections/TokensSection.module.css
+++ /dev/null
@@ -1,59 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- min-height: 0;
-}
-
-.toolbar {
- display: flex;
- gap: 0.5rem;
- align-items: center;
- padding: 0.75rem 0.875rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- background: var(--studio-bg-panel-header);
- position: sticky;
- top: 0;
- z-index: 1;
-}
-
-.searchWrap {
- flex: 1 1 auto;
- min-width: 0;
- max-width: 26.25rem;
-}
-
-.toolbarActions {
- display: flex;
- gap: 0.5rem;
- margin-left: auto;
-}
-
-.body {
- flex: 1 1 auto;
- min-height: 0;
- overflow-y: auto;
- padding-bottom: 1.125rem;
-}
-
-.searchEmpty {
- padding: 2.5rem 1.5rem;
-}
-
-.summary {
- display: flex;
- gap: 0.75rem;
- padding: 0.5rem 0.875rem;
- color: var(--studio-fg-muted);
- font-size: var(--studio-fs-xs);
- border-bottom: 0.0625rem solid var(--studio-border);
- background: var(--studio-bg-editor);
- flex-wrap: wrap;
-}
-
-.summary strong {
- color: var(--studio-fg-primary);
- font-weight: 600;
-}
diff --git a/fluxer_app/src/features/theme_studio/sections/TokensSection.tsx b/fluxer_app/src/features/theme_studio/sections/TokensSection.tsx
deleted file mode 100644
index 413492e8a..000000000
--- a/fluxer_app/src/features/theme_studio/sections/TokensSection.tsx
+++ /dev/null
@@ -1,282 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import * as AccessibilityCommands from '@app/features/accessibility/commands/AccessibilityCommands';
-import Accessibility from '@app/features/accessibility/state/Accessibility';
-import {ShareThemeModal} from '@app/features/theme/components/modals/ShareThemeModal';
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import ThemeLibrary from '@app/features/theme/state/ThemeLibrary';
-import {
- DEFAULT_EXPANDED_GROUP_IDS,
- getTokenGroupLabelDescriptor,
- getTokenVariableDefinition,
- humanizeVariableName,
- TOKEN_GROUPS,
-} from '@app/features/theme_studio/sections/TokenGroups';
-import styles from '@app/features/theme_studio/sections/TokensSection.module.css';
-import {broadcastThemeStudioMessage} from '@app/features/theme_studio/state/ThemeStudioBroadcast';
-import ThemeStudioState from '@app/features/theme_studio/state/ThemeStudioState';
-import {StudioButton} from '@app/features/theme_studio/ui/StudioButton';
-import {StudioEmptyState} from '@app/features/theme_studio/ui/StudioEmptyState';
-import {StudioSearchInput} from '@app/features/theme_studio/ui/StudioSearchInput';
-import {StudioSection} from '@app/features/theme_studio/ui/StudioSection';
-import {StudioTokenColor, StudioTokenFont, StudioTokenValue} from '@app/features/theme_studio/ui/StudioToken';
-import {showThemeStudioErrorModal} from '@app/features/theme_studio/utils/ThemeStudioErrorModalUtils';
-import * as ModalCommands from '@app/features/ui/commands/ModalCommands';
-import {modal} from '@app/features/ui/commands/ModalCommands';
-import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
-import {
- extractThemeVariableOverrides,
- updateCssForVariable,
-} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {msg} from '@lingui/core/macro';
-import {Plural, Trans, useLingui} from '@lingui/react/macro';
-import {ArrowCounterClockwiseIcon, ShareNetworkIcon} from '@phosphor-icons/react';
-import {observer} from 'mobx-react-lite';
-import type React from 'react';
-import {useEffect, useMemo} from 'react';
-
-const TOKEN_OVERRIDES_CLEARED_DESCRIPTOR = msg({
- message: 'Token overrides cleared.',
- comment: 'Short label in the theme studio tokens section. Keep it concise. Keep the tone plain and specific.',
-});
-const YOU_DON_T_HAVE_ANY_CUSTOM_THEME_OVERRIDES_DESCRIPTOR = msg({
- message: "You don't have any custom theme overrides to share yet.",
- comment: 'Description text in the theme studio tokens section. Keep the tone plain and specific.',
-});
-const SEARCH_TOKENS_DESCRIPTOR = msg({
- message: 'Search tokens…',
- comment:
- 'Button or menu action label in the theme studio tokens section. Keep it concise. Keep the tone plain and specific.',
-});
-const NO_TOKENS_MATCH_DESCRIPTOR = msg({
- message: 'No tokens match "{searchQuery}".',
- comment: 'Empty search result title in Theme Studio token search.',
-});
-const TRY_A_DIFFERENT_VARIABLE_NAME_OR_CLEAR_THE_DESCRIPTOR = msg({
- message: 'Try a different variable name or clear the search.',
- comment: 'Accessible label in the theme studio tokens section. Keep it concise. Keep the tone plain and specific.',
-});
-
-interface TokensSectionProps {
- defaultVariableValues: Readonly<Record<string, string>>;
-}
-
-export const TokensSection: React.FC<TokensSectionProps> = observer(({defaultVariableValues}) => {
- const {i18n} = useLingui();
- const customThemeCss = Accessibility.customThemeCss ?? '';
- const overrides = useMemo(() => extractThemeVariableOverrides(customThemeCss), [customThemeCss]);
- const searchQuery = ThemeStudioState.tokenSearch.trim().toLowerCase();
- useEffect(() => {
- if (!ThemeStudioState.hasInitializedExpansion) {
- ThemeStudioState.expandAllGroups(DEFAULT_EXPANDED_GROUP_IDS);
- }
- }, []);
- const handleVariableChange = (variableName: string, nextValue: string | null) => {
- const updated =
- nextValue === null
- ? updateCssForVariable(customThemeCss, variableName, null)
- : updateCssForVariable(customThemeCss, variableName, nextValue);
- AccessibilityCommands.update({customThemeCss: updated.length === 0 ? null : updated});
- broadcastThemeStudioMessage({type: 'customThemeCss', value: updated.length === 0 ? null : updated});
- };
- const overrideCount = Object.keys(overrides).length;
- const tokenGroupCount = TOKEN_GROUPS.length;
- const tokenCount = TOKEN_GROUPS.reduce((count, group) => count + group.variables.length, 0);
- const handleResetAll = () => {
- if (overrideCount === 0) return;
- AccessibilityCommands.update({customThemeCss: null});
- broadcastThemeStudioMessage({type: 'customThemeCss', value: null});
- ToastCommands.success(i18n._(TOKEN_OVERRIDES_CLEARED_DESCRIPTOR));
- };
- const handleShare = () => {
- const css = [ThemeLibrary.activeThemeCss, customThemeCss]
- .map((value) => value.trim())
- .filter(Boolean)
- .join('\n\n');
- if (!css.trim()) {
- showThemeStudioErrorModal(
- i18n,
- () => i18n._(YOU_DON_T_HAVE_ANY_CUSTOM_THEME_OVERRIDES_DESCRIPTOR),
- 'theme-studio.tokens-section.share-empty-error-modal',
- );
- return;
- }
- ModalCommands.push(
- modal(() => (
- <ShareThemeModal themeCss={css} data-flx="theme-studio.tokens-section.handle-share.share-theme-modal" />
- )),
- );
- };
- const groups = useMemo(() => {
- if (searchQuery.length === 0) {
- return TOKEN_GROUPS.map((group) => ({group, vars: [...group.variables]}));
- }
- return TOKEN_GROUPS.map((group) => {
- const vars = group.variables.filter((variable) => {
- const human = humanizeVariableName(variable);
- const definition = getTokenVariableDefinition(variable);
- return [variable, human, definition?.groupLabel, definition?.source, definition?.kind].some(
- (value) => value?.toLowerCase().includes(searchQuery) ?? false,
- );
- });
- return {group, vars};
- }).filter((entry) => entry.vars.length > 0);
- }, [searchQuery]);
- const noResults = groups.length === 0;
- return (
- <div className={styles.section} data-flx="theme-studio.tokens-section.section">
- <div className={styles.toolbar} data-flx="theme-studio.tokens-section.toolbar">
- <div className={styles.searchWrap} data-flx="theme-studio.tokens-section.search-wrap">
- <StudioSearchInput
- value={ThemeStudioState.tokenSearch}
- onChange={(value) => ThemeStudioState.setTokenSearch(value)}
- placeholder={i18n._(SEARCH_TOKENS_DESCRIPTOR)}
- data-flx="theme-studio.tokens-section.studio-search-input.set-token-search"
- />
- </div>
- <div className={styles.toolbarActions} data-flx="theme-studio.tokens-section.toolbar-actions">
- <StudioButton
- variant="secondary"
- compact
- leadingIcon={
- <ArrowCounterClockwiseIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.tokens-section.arrow-counter-clockwise-icon"
- />
- }
- disabled={overrideCount === 0}
- onClick={handleResetAll}
- data-flx="theme-studio.tokens-section.studio-button.reset-all"
- >
- <Trans>Reset all</Trans>
- </StudioButton>
- <StudioButton
- variant="primary"
- compact
- leadingIcon={
- <ShareNetworkIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.tokens-section.share-network-icon"
- />
- }
- onClick={handleShare}
- data-flx="theme-studio.tokens-section.studio-button.share"
- >
- <Trans>Share active theme</Trans>
- </StudioButton>
- </div>
- </div>
- <div className={styles.summary} data-flx="theme-studio.tokens-section.summary">
- <span data-flx="theme-studio.tokens-section.span">
- <Plural
- value={overrideCount}
- one="# override"
- other="# overrides"
- data-flx="theme-studio.tokens-section.plural"
- />
- </span>
- <span data-flx="theme-studio.tokens-section.span--2">
- <Plural
- value={tokenGroupCount}
- one="# group"
- other="# groups"
- data-flx="theme-studio.tokens-section.plural--2"
- />
- </span>
- <span data-flx="theme-studio.tokens-section.span--3">
- <Plural value={tokenCount} one="# token" other="# tokens" data-flx="theme-studio.tokens-section.plural--3" />
- </span>
- </div>
- <div className={styles.body} data-flx="theme-studio.tokens-section.body">
- {noResults ? (
- <div className={styles.searchEmpty} data-flx="theme-studio.tokens-section.search-empty">
- <StudioEmptyState
- title={i18n._(NO_TOKENS_MATCH_DESCRIPTOR, {searchQuery: ThemeStudioState.tokenSearch})}
- description={i18n._(TRY_A_DIFFERENT_VARIABLE_NAME_OR_CLEAR_THE_DESCRIPTOR)}
- actions={
- <StudioButton
- variant="secondary"
- compact
- onClick={() => ThemeStudioState.setTokenSearch('')}
- data-flx="theme-studio.tokens-section.studio-button.set-token-search"
- >
- <Trans>Clear search</Trans>
- </StudioButton>
- }
- data-flx="theme-studio.tokens-section.studio-empty-state"
- />
- </div>
- ) : (
- groups.map(({group, vars}) => {
- const isOpen = searchQuery.length > 0 || ThemeStudioState.isGroupExpanded(group.id);
- const groupLabelDescriptor = getTokenGroupLabelDescriptor(group.id);
- return (
- <StudioSection
- key={group.id}
- title={groupLabelDescriptor == null ? group.fallbackLabel : i18n._(groupLabelDescriptor)}
- count={vars.length}
- open={isOpen}
- onToggle={(next) => {
- if (searchQuery.length > 0) return;
- ThemeStudioState.toggleGroup(group.id, next);
- }}
- data-flx="theme-studio.tokens-section.studio-section"
- >
- {vars.map((variableName) => {
- const definition = getTokenVariableDefinition(variableName);
- const overrideValue = overrides[variableName] ?? '';
- const defaultValue = defaultVariableValues[variableName] ?? '';
- const label = humanizeVariableName(variableName);
- const overridden = overrideValue.length > 0;
- if (definition?.kind === 'font') {
- return (
- <StudioTokenFont
- key={variableName}
- variableName={variableName}
- label={label}
- currentValue={overrideValue}
- defaultValue={defaultValue}
- overridden={overridden}
- onChange={(next) => handleVariableChange(variableName, next)}
- data-flx="theme-studio.tokens-section.studio-token-font.variable-change"
- />
- );
- }
- if (definition?.kind !== 'color') {
- return (
- <StudioTokenValue
- key={variableName}
- variableName={variableName}
- label={label}
- kind={definition?.kind ?? 'other'}
- currentValue={overrideValue}
- defaultValue={defaultValue}
- overridden={overridden}
- onChange={(next) => handleVariableChange(variableName, next)}
- data-flx="theme-studio.tokens-section.studio-token-value.variable-change"
- />
- );
- }
- return (
- <StudioTokenColor
- key={variableName}
- variableName={variableName}
- label={label}
- currentValue={overrideValue || defaultValue}
- defaultValue={defaultValue}
- overridden={overridden}
- onChange={(next) => handleVariableChange(variableName, next)}
- data-flx="theme-studio.tokens-section.studio-token-color.variable-change"
- />
- );
- })}
- </StudioSection>
- );
- })
- )}
- </div>
- </div>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/state/ThemeStudioBroadcast.ts b/fluxer_app/src/features/theme_studio/state/ThemeStudioBroadcast.ts
deleted file mode 100644
index 7e6edc332..000000000
--- a/fluxer_app/src/features/theme_studio/state/ThemeStudioBroadcast.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {Logger} from '@app/features/platform/utils/AppLogger';
-import {randomUuid} from '@app/features/platform/utils/RandomUuid';
-import type {ThemePreferenceSnapshot} from '@app/features/theme/state/Theme';
-import {useEffect} from 'react';
-
-const CHANNEL_NAME = 'fluxer-theme-studio';
-const logger = new Logger('ThemeStudioBroadcast');
-
-export type ThemeStudioBroadcastInput =
- | {type: 'customThemeCss'; value: string | null}
- | {type: 'themeLibrary'; revision: number}
- | {type: 'themePreference'; snapshot: ThemePreferenceSnapshot}
- | {type: 'studio:closed-popout'}
- | {type: 'studio:focus-popout'};
-export type ThemeStudioBroadcastMessage = ThemeStudioBroadcastInput & {origin: string};
-
-const senderId = randomUuid();
-
-let channel: BroadcastChannel | null = null;
-
-const listeners = new Set<(message: ThemeStudioBroadcastMessage) => void>();
-const ensureChannel = (): BroadcastChannel | null => {
- if (channel) return channel;
- if (typeof BroadcastChannel === 'undefined') {
- logger.debug('BroadcastChannel not supported in this environment');
- return null;
- }
- try {
- channel = new BroadcastChannel(CHANNEL_NAME);
- channel.onmessage = (event: MessageEvent<ThemeStudioBroadcastMessage>) => {
- const message = event.data;
- if (!message || message.origin === senderId) return;
- for (const listener of listeners) {
- try {
- listener(message);
- } catch (error) {
- logger.warn('Listener threw on broadcast message', error);
- }
- }
- };
- } catch (error) {
- logger.warn('Failed to create BroadcastChannel', error);
- channel = null;
- }
- return channel;
-};
-
-export function broadcastThemeStudioMessage(message: ThemeStudioBroadcastInput): void {
- const ch = ensureChannel();
- if (!ch) return;
- try {
- ch.postMessage({...message, origin: senderId});
- } catch (error) {
- logger.warn('Failed to broadcast theme studio message', error);
- }
-}
-
-function subscribeThemeStudioBroadcast(listener: (message: ThemeStudioBroadcastMessage) => void): () => void {
- ensureChannel();
- listeners.add(listener);
- return () => {
- listeners.delete(listener);
- };
-}
-
-export function useThemeStudioBroadcast(listener: (message: ThemeStudioBroadcastMessage) => void): void {
- useEffect(() => {
- const dispose = subscribeThemeStudioBroadcast(listener);
- return dispose;
- }, [listener]);
-}
diff --git a/fluxer_app/src/features/theme_studio/state/ThemeStudioState.ts b/fluxer_app/src/features/theme_studio/state/ThemeStudioState.ts
deleted file mode 100644
index c364ad668..000000000
--- a/fluxer_app/src/features/theme_studio/state/ThemeStudioState.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import AppStorage from '@app/features/platform/state/PersistentStorage';
-import {makeAutoObservable} from 'mobx';
-
-type ThemeStudioSection = 'library' | 'tokens' | 'quickCss' | 'assets' | 'settings';
-
-const SECTION_STORAGE_KEY = 'ThemeStudio:section';
-const EXPANDED_GROUPS_STORAGE_KEY = 'ThemeStudio:expandedGroups';
-const readStoredSection = (): ThemeStudioSection => {
- if (typeof window === 'undefined') return 'tokens';
- try {
- const raw = AppStorage.getItem(SECTION_STORAGE_KEY);
- if (raw === 'library' || raw === 'tokens' || raw === 'quickCss' || raw === 'assets' || raw === 'settings') {
- return raw;
- }
- } catch {}
- return 'tokens';
-};
-const readStoredExpandedGroups = (): Array<string> | null => {
- if (typeof window === 'undefined') return null;
- try {
- const raw = AppStorage.getItem(EXPANDED_GROUPS_STORAGE_KEY);
- if (raw === null) return null;
- const parsed: unknown = JSON.parse(raw);
- if (Array.isArray(parsed) && parsed.every((value) => typeof value === 'string')) {
- return parsed;
- }
- } catch {}
- return null;
-};
-
-class ThemeStudioState {
- section: ThemeStudioSection = readStoredSection();
- tokenSearch = '';
- librarySearch = '';
- expandedGroups: Set<string> = new Set(readStoredExpandedGroups() ?? []);
- hasInitializedExpansion: boolean = readStoredExpandedGroups() !== null;
- popupRef: Window | null = null;
-
- constructor() {
- makeAutoObservable(this, {popupRef: false}, {autoBind: true});
- }
-
- setSection(next: ThemeStudioSection): void {
- this.section = next;
- if (typeof window === 'undefined') return;
- try {
- AppStorage.setItem(SECTION_STORAGE_KEY, next);
- } catch {}
- }
-
- setTokenSearch(value: string): void {
- this.tokenSearch = value;
- }
-
- setLibrarySearch(value: string): void {
- this.librarySearch = value;
- }
-
- isGroupExpanded(groupId: string): boolean {
- return this.expandedGroups.has(groupId);
- }
-
- toggleGroup(groupId: string, expanded?: boolean): void {
- const next = new Set(this.expandedGroups);
- const shouldExpand = expanded ?? !next.has(groupId);
- if (shouldExpand) {
- next.add(groupId);
- } else {
- next.delete(groupId);
- }
- this.expandedGroups = next;
- this.hasInitializedExpansion = true;
- this.persistExpansion();
- }
-
- expandAllGroups(groupIds: ReadonlyArray<string>): void {
- this.expandedGroups = new Set(groupIds);
- this.hasInitializedExpansion = true;
- this.persistExpansion();
- }
-
- private persistExpansion(): void {
- if (typeof window === 'undefined') return;
- try {
- AppStorage.setItem(EXPANDED_GROUPS_STORAGE_KEY, JSON.stringify([...this.expandedGroups]));
- } catch {}
- }
-
- markPoppedOut(popupRef: Window | null): void {
- this.popupRef = popupRef;
- }
-
- clearPoppedOut(): void {
- this.popupRef = null;
- }
-}
-
-export default new ThemeStudioState();
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioButton.module.css b/fluxer_app/src/features/theme_studio/ui/StudioButton.module.css
deleted file mode 100644
index 1ace2a0c6..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioButton.module.css
+++ /dev/null
@@ -1,95 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.button {
- --bg: transparent;
- --bg-hover: var(--studio-bg-row-hover);
- --bg-active: var(--studio-bg-row-active);
- --fg: var(--studio-fg-primary);
- --border: transparent;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- gap: 0.375rem;
- height: var(--studio-row-height);
- padding: 0 0.75rem;
- font: inherit;
- font-size: var(--studio-fs-sm);
- font-weight: 500;
- color: var(--fg);
- background: var(--bg);
- border: 0.0625rem solid var(--border);
- border-radius: var(--studio-radius-md);
- cursor: pointer;
- user-select: none;
- white-space: nowrap;
- transition:
- background var(--studio-transition-fast),
- border-color var(--studio-transition-fast),
- color var(--studio-transition-fast);
-}
-
-.button:hover:not(:disabled) {
- background: var(--bg-hover);
-}
-
-.button:active:not(:disabled) {
- background: var(--bg-active);
-}
-
-.button:disabled {
- opacity: 0.45;
- cursor: not-allowed;
-}
-
-.compact {
- height: var(--studio-row-height-compact);
- padding: 0 0.625rem;
- font-size: var(--studio-fs-xs);
-}
-
-.primary {
- --bg: var(--studio-button-primary);
- --bg-hover: var(--studio-button-primary-hover);
- --bg-active: var(--studio-button-primary-hover);
- --fg: var(--studio-fg-on-accent);
-}
-
-.secondary {
- --bg: var(--studio-button-secondary);
- --bg-hover: var(--studio-button-secondary-hover);
- --bg-active: var(--studio-button-secondary-hover);
- --fg: var(--button-secondary-text);
- --border: var(--studio-border);
-}
-
-.ghost {
- --bg: transparent;
-}
-
-.danger {
- --bg: var(--studio-danger-soft);
- --fg: var(--studio-danger);
- --border: transparent;
-}
-
-.danger:hover:not(:disabled) {
- background: var(--studio-danger-soft);
- color: var(--studio-danger);
-}
-
-.dangerSolid {
- --bg: var(--studio-danger);
- --bg-hover: var(--studio-danger-hover);
- --fg: var(--studio-fg-on-danger);
-}
-
-.leadingIcon {
- display: inline-flex;
- align-items: center;
-}
-
-.label {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioButton.tsx b/fluxer_app/src/features/theme_studio/ui/StudioButton.tsx
deleted file mode 100644
index 891073cce..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioButton.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioButton.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {clsx} from 'clsx';
-import {type ButtonHTMLAttributes, forwardRef, type ReactNode} from 'react';
-
-type StudioButtonVariant = 'primary' | 'secondary' | 'ghost' | 'danger' | 'dangerSolid';
-
-interface StudioButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
- variant?: StudioButtonVariant;
- compact?: boolean;
- leadingIcon?: ReactNode;
-}
-
-export const StudioButton = forwardRef<HTMLButtonElement, StudioButtonProps>(function StudioButton(
- {variant = 'ghost', compact = false, leadingIcon, className, children, type = 'button', ...rest},
- ref,
-) {
- return (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-button.focus-ring">
- <button
- ref={ref}
- type={type}
- className={clsx(styles.button, styles[variant], compact && styles.compact, className)}
- data-flx="theme-studio.ui.studio-button.button"
- {...rest}
- >
- {leadingIcon ? (
- <span className={styles.leadingIcon} data-flx="theme-studio.ui.studio-button.leading-icon">
- {leadingIcon}
- </span>
- ) : null}
- {children !== undefined && children !== null && children !== false ? (
- <span className={styles.label} data-flx="theme-studio.ui.studio-button.label">
- {children}
- </span>
- ) : null}
- </button>
- </FocusRing>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.module.css b/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.module.css
deleted file mode 100644
index 966b797fb..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.module.css
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 2.25rem 1.5rem;
- gap: 0.75rem;
- color: var(--studio-fg-muted);
- text-align: center;
- min-height: 7.5rem;
-}
-
-.icon {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 2.25rem;
- height: 2.25rem;
- border-radius: var(--studio-radius-lg);
- background: var(--studio-button-secondary);
- color: var(--studio-fg-subtle);
-}
-
-.title {
- margin: 0;
- font-size: var(--studio-fs-md);
- font-weight: 600;
- color: var(--studio-fg-primary);
-}
-
-.description {
- margin: 0;
- max-width: 36ch;
- font-size: var(--studio-fs-sm);
- line-height: 1.5;
-}
-
-.actions {
- margin-top: 0.375rem;
- display: flex;
- gap: 0.375rem;
- flex-wrap: wrap;
- justify-content: center;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.tsx b/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.tsx
deleted file mode 100644
index 5bd04b76e..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioEmptyState.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioEmptyState.module.css';
-import type React from 'react';
-import type {ReactNode} from 'react';
-
-interface StudioEmptyStateProps {
- icon?: ReactNode;
- title: ReactNode;
- description?: ReactNode;
- actions?: ReactNode;
-}
-
-export const StudioEmptyState: React.FC<StudioEmptyStateProps> = ({icon, title, description, actions}) => (
- <div className={styles.empty} data-flx="theme-studio.ui.studio-empty-state.empty">
- {icon ? (
- <div className={styles.icon} data-flx="theme-studio.ui.studio-empty-state.icon">
- {icon}
- </div>
- ) : null}
- <h4 className={styles.title} data-flx="theme-studio.ui.studio-empty-state.title">
- {title}
- </h4>
- {description ? (
- <p className={styles.description} data-flx="theme-studio.ui.studio-empty-state.description">
- {description}
- </p>
- ) : null}
- {actions ? (
- <div className={styles.actions} data-flx="theme-studio.ui.studio-empty-state.actions">
- {actions}
- </div>
- ) : null}
- </div>
-);
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioIconButton.module.css b/fluxer_app/src/features/theme_studio/ui/StudioIconButton.module.css
deleted file mode 100644
index c8defe816..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioIconButton.module.css
+++ /dev/null
@@ -1,46 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.button {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- height: var(--studio-row-height);
- width: var(--studio-row-height);
- padding: 0;
- background: transparent;
- border: 0.0625rem solid transparent;
- border-radius: var(--studio-radius-md);
- color: var(--studio-fg-muted);
- cursor: pointer;
- transition:
- background var(--studio-transition-fast),
- color var(--studio-transition-fast);
-}
-
-.button:hover:not(:disabled) {
- background: var(--studio-bg-row-hover);
- color: var(--studio-fg-primary);
-}
-
-.button:active:not(:disabled) {
- background: var(--studio-bg-row-active);
-}
-
-.button:disabled {
- opacity: 0.4;
- cursor: not-allowed;
-}
-
-.compact {
- height: var(--studio-row-height-compact);
- width: var(--studio-row-height-compact);
-}
-
-.danger {
- color: var(--studio-danger);
-}
-
-.danger:hover:not(:disabled) {
- background: var(--studio-danger-soft);
- color: var(--studio-danger);
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioIconButton.tsx b/fluxer_app/src/features/theme_studio/ui/StudioIconButton.tsx
deleted file mode 100644
index c4c663d23..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioIconButton.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioIconButton.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {clsx} from 'clsx';
-import {type ButtonHTMLAttributes, forwardRef} from 'react';
-
-interface StudioIconButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
- compact?: boolean;
- tone?: 'default' | 'danger';
-}
-
-export const StudioIconButton = forwardRef<HTMLButtonElement, StudioIconButtonProps>(function StudioIconButton(
- {compact = false, tone = 'default', className, type = 'button', children, ...rest},
- ref,
-) {
- return (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-icon-button.focus-ring">
- <button
- ref={ref}
- type={type}
- className={clsx(styles.button, compact && styles.compact, tone === 'danger' && styles.danger, className)}
- data-flx="theme-studio.ui.studio-icon-button.button"
- {...rest}
- >
- {children}
- </button>
- </FocusRing>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioListItem.module.css b/fluxer_app/src/features/theme_studio/ui/StudioListItem.module.css
deleted file mode 100644
index c6cffc10e..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioListItem.module.css
+++ /dev/null
@@ -1,60 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.item {
- display: flex;
- align-items: center;
- gap: 0.625rem;
- padding: 0.5rem 0.75rem;
- min-height: 2.625rem;
- background: transparent;
- border: none;
- color: var(--studio-fg-primary);
- cursor: default;
- text-align: left;
- font: inherit;
- width: 100%;
- border-radius: var(--studio-radius-md);
- transition: background var(--studio-transition-fast);
- min-width: 0;
-}
-
-.leading {
- display: inline-flex;
- align-items: center;
- color: var(--studio-fg-muted);
- flex-shrink: 0;
-}
-
-.text {
- display: flex;
- flex-direction: column;
- gap: 0.0625rem;
- min-width: 0;
- flex: 1 1 auto;
-}
-
-.label {
- font-size: var(--studio-fs-sm);
- font-weight: 400;
- color: var(--studio-fg-primary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.trailing {
- display: inline-flex;
- align-items: center;
- gap: 0.25rem;
- color: var(--studio-fg-muted);
- flex-shrink: 0;
-}
-
-.code {
- font-family: var(--studio-font-mono);
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-subtle);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioListItem.tsx b/fluxer_app/src/features/theme_studio/ui/StudioListItem.tsx
deleted file mode 100644
index 09d9e874e..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioListItem.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioListItem.module.css';
-import type React from 'react';
-import type {ReactNode} from 'react';
-
-interface StudioListItemProps {
- leading?: ReactNode;
- label: ReactNode;
- trailing?: ReactNode;
- codeBody?: ReactNode;
-}
-
-export const StudioListItem: React.FC<StudioListItemProps> = ({leading, label, trailing, codeBody}) => {
- const body = (
- <>
- {leading ? (
- <span className={styles.leading} data-flx="theme-studio.ui.studio-list-item.leading">
- {leading}
- </span>
- ) : null}
- <span className={styles.text} data-flx="theme-studio.ui.studio-list-item.text">
- <span className={styles.label} data-flx="theme-studio.ui.studio-list-item.label">
- {label}
- </span>
-
- {codeBody ? (
- <code className={styles.code} data-flx="theme-studio.ui.studio-list-item.code">
- {codeBody}
- </code>
- ) : null}
- </span>
- {trailing ? (
- <span className={styles.trailing} data-flx="theme-studio.ui.studio-list-item.trailing">
- {trailing}
- </span>
- ) : null}
- </>
- );
-
- return (
- <div className={styles.item} data-flx="theme-studio.ui.studio-list-item.item">
- {body}
- </div>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioPanel.module.css b/fluxer_app/src/features/theme_studio/ui/StudioPanel.module.css
deleted file mode 100644
index 17691ac08..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioPanel.module.css
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.panel {
- display: flex;
- flex-direction: column;
- min-width: 0;
- min-height: 0;
- background: var(--studio-bg-elevated);
- border: 0.0625rem solid var(--studio-border);
- border-radius: var(--studio-radius-lg);
- overflow: hidden;
- box-shadow: var(--studio-shadow-panel);
-}
-
-.panelHeader {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 0.75rem;
- padding: 0.625rem 0.75rem;
- border-bottom: 0.0625rem solid var(--studio-border);
- background: var(--studio-bg-panel-header);
- flex-shrink: 0;
- min-height: 2.5rem;
-}
-
-.panelTitle {
- margin: 0;
- font-size: var(--studio-fs-sm);
- font-weight: 600;
- color: var(--studio-fg-primary);
- letter-spacing: 0;
- font-feature-settings: 'cv11';
-}
-
-.panelBody {
- flex: 1 1 auto;
- min-height: 0;
- overflow: auto;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioPanel.tsx b/fluxer_app/src/features/theme_studio/ui/StudioPanel.tsx
deleted file mode 100644
index afe79b1fe..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioPanel.tsx
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioPanel.module.css';
-import type React from 'react';
-import type {ReactNode} from 'react';
-
-interface StudioPanelProps {
- title?: ReactNode;
- children: ReactNode;
-}
-
-export const StudioPanel: React.FC<StudioPanelProps> = ({title, children}) => {
- const hasHeader = title !== undefined;
- return (
- <section className={styles.panel} data-flx="theme-studio.ui.studio-panel.panel">
- {hasHeader ? (
- <div className={styles.panelHeader} data-flx="theme-studio.ui.studio-panel.panel-header">
- <div data-flx="theme-studio.ui.studio-panel.div">
- {title ? (
- <h4 className={styles.panelTitle} data-flx="theme-studio.ui.studio-panel.panel-title">
- {title}
- </h4>
- ) : null}
- </div>
- </div>
- ) : null}
- <div className={styles.panelBody} data-flx="theme-studio.ui.studio-panel.panel-body">
- {children}
- </div>
- </section>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.module.css b/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.module.css
deleted file mode 100644
index 452194d97..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.module.css
+++ /dev/null
@@ -1,61 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.wrapper {
- display: flex;
- align-items: center;
- gap: 0.375rem;
- height: var(--studio-row-height);
- padding: 0 0.625rem;
- background: var(--studio-bg-input);
- border: 0.0625rem solid var(--studio-border-input);
- border-radius: var(--studio-radius-md);
- color: var(--studio-fg-muted);
- transition:
- border-color var(--studio-transition-fast),
- background var(--studio-transition-fast);
- min-width: 0;
-}
-
-.wrapper:hover {
- background: var(--studio-bg-input-hover);
-}
-
-.icon {
- display: inline-flex;
- flex-shrink: 0;
- color: var(--studio-fg-subtle);
-}
-
-.input {
- flex: 1 1 auto;
- min-width: 0;
- background: transparent;
- border: none;
- outline: none;
- color: var(--studio-fg-primary);
- font: inherit;
- font-size: var(--studio-fs-sm);
- padding: 0;
-}
-
-.input::placeholder {
- color: var(--studio-fg-subtle);
-}
-
-.clear {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 1.125rem;
- height: 1.125rem;
- border-radius: var(--studio-radius-sm);
- background: transparent;
- border: none;
- color: var(--studio-fg-subtle);
- cursor: pointer;
-}
-
-.clear:hover {
- background: var(--studio-bg-row-hover);
- color: var(--studio-fg-primary);
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.tsx b/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.tsx
deleted file mode 100644
index ef0ea15b9..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSearchInput.tsx
+++ /dev/null
@@ -1,79 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {CLEAR_SEARCH_DESCRIPTOR} from '@app/features/i18n/utils/CommonMessageDescriptors';
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import styles from '@app/features/theme_studio/ui/StudioSearchInput.module.css';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import {MagnifyingGlassIcon, XCircleIcon} from '@phosphor-icons/react';
-import {forwardRef, type InputHTMLAttributes, useImperativeHandle, useRef} from 'react';
-
-const SEARCH_DESCRIPTOR = msg({
- message: 'Search…',
- comment: 'Button or menu action label in the theme studio studio search input. Keep it concise.',
-});
-const SEARCH_2_DESCRIPTOR = msg({
- message: 'Search',
- comment: 'Button or menu action label in the theme studio studio search input. Keep it concise.',
-});
-
-export interface StudioSearchInputHandle {
- focus: () => void;
-}
-
-interface StudioSearchInputProps
- extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'type' | 'className'> {
- value: string;
- onChange: (next: string) => void;
-}
-
-export const StudioSearchInput = forwardRef<StudioSearchInputHandle, StudioSearchInputProps>(function StudioSearchInput(
- {value, onChange, placeholder, ...rest},
- ref,
-) {
- const {i18n} = useLingui();
- const inputRef = useRef<HTMLInputElement | null>(null);
- useImperativeHandle(ref, () => ({
- focus: () => inputRef.current?.focus(),
- }));
- return (
- <label className={styles.wrapper} data-flx="theme-studio.ui.studio-search-input.wrapper">
- <span className={styles.icon} data-flx="theme-studio.ui.studio-search-input.icon">
- <MagnifyingGlassIcon
- size={remFromPx(14)}
- weight="bold"
- data-flx="theme-studio.ui.studio-search-input.magnifying-glass-icon"
- />
- </span>
- <input
- ref={inputRef}
- type="search"
- className={styles.input}
- value={value}
- placeholder={placeholder ?? i18n._(SEARCH_DESCRIPTOR)}
- onChange={(event) => onChange(event.target.value)}
- aria-label={i18n._(SEARCH_2_DESCRIPTOR)}
- data-flx="theme-studio.ui.studio-search-input.input.change.search"
- {...rest}
- />
- {value.length > 0 ? (
- <button
- type="button"
- aria-label={i18n._(CLEAR_SEARCH_DESCRIPTOR)}
- className={styles.clear}
- onClick={() => {
- onChange('');
- inputRef.current?.focus();
- }}
- data-flx="theme-studio.ui.studio-search-input.clear.change.button"
- >
- <XCircleIcon
- size={remFromPx(14)}
- weight="fill"
- data-flx="theme-studio.ui.studio-search-input.x-circle-icon"
- />
- </button>
- ) : null}
- </label>
- );
-});
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSection.module.css b/fluxer_app/src/features/theme_studio/ui/StudioSection.module.css
deleted file mode 100644
index 78032fd92..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSection.module.css
+++ /dev/null
@@ -1,64 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.section {
- display: flex;
- flex-direction: column;
- border-bottom: 0.0625rem solid var(--studio-border);
-}
-
-.section:last-child {
- border-bottom: none;
-}
-
-.trigger {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- width: 100%;
- min-height: 2.25rem;
- padding: 0 0.875rem;
- background: transparent;
- border: none;
- color: var(--studio-fg-primary);
- font: inherit;
- font-size: var(--studio-fs-xs);
- font-weight: 600;
- cursor: pointer;
- text-align: left;
- user-select: none;
- transition: background var(--studio-transition-fast);
-}
-
-.trigger:hover {
- background: var(--studio-bg-row-hover);
-}
-
-.chevron {
- display: inline-flex;
- transition: transform var(--studio-transition-base);
- color: var(--studio-fg-muted);
-}
-
-.chevronOpen {
- transform: rotate(90deg);
-}
-
-.title {
- flex: 1 1 auto;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.count {
- color: var(--studio-fg-subtle);
- font-weight: 500;
- font-size: 0.65625rem;
-}
-
-.body {
- display: flex;
- flex-direction: column;
- padding-bottom: 0.25rem;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSection.tsx b/fluxer_app/src/features/theme_studio/ui/StudioSection.tsx
deleted file mode 100644
index deace9fda..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSection.tsx
+++ /dev/null
@@ -1,62 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import styles from '@app/features/theme_studio/ui/StudioSection.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {CaretRightIcon} from '@phosphor-icons/react';
-import {clsx} from 'clsx';
-import type React from 'react';
-import type {ReactNode} from 'react';
-import {useCallback, useId} from 'react';
-
-interface StudioSectionProps {
- title: ReactNode;
- count?: number;
- open: boolean;
- onToggle: (next: boolean) => void;
- children?: ReactNode;
-}
-
-export const StudioSection: React.FC<StudioSectionProps> = ({title, count, open, onToggle, children}) => {
- const id = useId();
- const handleToggle = useCallback(() => onToggle(!open), [open, onToggle]);
- return (
- <div className={styles.section} data-flx="theme-studio.ui.studio-section.section">
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-section.focus-ring">
- <button
- type="button"
- className={styles.trigger}
- aria-expanded={open}
- aria-controls={id}
- onClick={handleToggle}
- data-flx="theme-studio.ui.studio-section.trigger.toggle.button"
- >
- <span
- className={clsx(styles.chevron, open && styles.chevronOpen)}
- data-flx="theme-studio.ui.studio-section.chevron"
- >
- <CaretRightIcon
- size={remFromPx(12)}
- weight="bold"
- data-flx="theme-studio.ui.studio-section.caret-right-icon"
- />
- </span>
-
- <span className={styles.title} data-flx="theme-studio.ui.studio-section.title">
- {title}
- </span>
- {count !== undefined ? (
- <span className={styles.count} data-flx="theme-studio.ui.studio-section.count">
- {count}
- </span>
- ) : null}
- </button>
- </FocusRing>
- {open ? (
- <div id={id} className={styles.body} data-flx="theme-studio.ui.studio-section.body">
- {children}
- </div>
- ) : null}
- </div>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSidebar.module.css b/fluxer_app/src/features/theme_studio/ui/StudioSidebar.module.css
deleted file mode 100644
index da6a1c9ef..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSidebar.module.css
+++ /dev/null
@@ -1,127 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.sidebar {
- display: flex;
- flex-direction: column;
- flex-shrink: 0;
- width: var(--studio-sidebar-width);
- background: var(--studio-bg-sidebar);
- border-right: 0.0625rem solid var(--studio-border);
- overflow: hidden;
- -webkit-app-region: no-drag;
-}
-
-.sidebar * {
- -webkit-app-region: no-drag;
-}
-
-.nav {
- display: flex;
- flex-direction: column;
- gap: 0.125rem;
- padding: 0.625rem 0.5rem 0.75rem;
- overflow-y: auto;
-}
-
-.item {
- display: flex;
- align-items: center;
- gap: 0.625rem;
- width: 100%;
- height: var(--studio-row-height);
- padding: 0 0.625rem;
- background: transparent;
- border: none;
- border-radius: var(--studio-radius-md);
- color: var(--studio-fg-muted);
- font: inherit;
- font-size: var(--studio-fs-sm);
- font-weight: 500;
- cursor: pointer;
- text-align: left;
- transition:
- background var(--studio-transition-fast),
- color var(--studio-transition-fast);
-}
-
-.item:hover {
- background: var(--studio-bg-row-hover);
- color: var(--studio-fg-primary);
-}
-
-.itemActive {
- background: var(--studio-bg-row-active);
- color: var(--studio-fg-primary);
-}
-
-.itemActive:hover {
- background: var(--studio-bg-row-active);
-}
-
-.itemIcon {
- display: inline-flex;
- flex-shrink: 0;
- width: 1.125rem;
- height: 1.125rem;
- align-items: center;
- justify-content: center;
-}
-
-.itemLabel {
- flex: 1 1 auto;
- min-width: 0;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.itemBadge {
- flex-shrink: 0;
- min-width: 1.375rem;
- padding: 0 0.375rem;
- height: 1.25rem;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- border-radius: var(--studio-radius-full, 624.9375rem);
- background: var(--studio-button-secondary);
- color: var(--studio-fg-muted);
- font-size: 0.65625rem;
- font-weight: 600;
-}
-
-.itemActive .itemBadge {
- background: var(--studio-accent);
- color: var(--studio-fg-on-accent);
-}
-
-.footer {
- margin-top: auto;
- padding: 0.625rem 1rem;
- border-top: 0.0625rem solid var(--studio-border);
- display: flex;
- gap: 0.375rem;
- align-items: center;
- justify-content: space-between;
-}
-
-.footerText {
- font-size: var(--studio-fs-xs);
- color: var(--studio-fg-subtle);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-@media (max-width: 720px) {
- .item {
- justify-content: center;
- padding: 0;
- }
-
- .itemLabel,
- .itemBadge,
- .footerText {
- display: none;
- }
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSidebar.tsx b/fluxer_app/src/features/theme_studio/ui/StudioSidebar.tsx
deleted file mode 100644
index e50eda2f2..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSidebar.tsx
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioSidebar.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {clsx} from 'clsx';
-import type React from 'react';
-import type {ReactNode} from 'react';
-
-interface StudioSidebarProps {
- ariaLabel: string;
- footer?: ReactNode;
- children: ReactNode;
-}
-
-export const StudioSidebar: React.FC<StudioSidebarProps> = ({ariaLabel, footer, children}) => (
- <aside className={styles.sidebar} aria-label={ariaLabel} data-flx="theme-studio.ui.studio-sidebar.sidebar">
- <nav className={styles.nav} data-flx="theme-studio.ui.studio-sidebar.nav">
- {children}
- </nav>
- {footer ? (
- <div className={styles.footer} data-flx="theme-studio.ui.studio-sidebar.footer">
- {footer}
- </div>
- ) : null}
- </aside>
-);
-
-interface StudioSidebarItemProps {
- icon: ReactNode;
- label: ReactNode;
- badge?: ReactNode;
- active?: boolean;
- onClick: () => void;
-}
-
-export const StudioSidebarItem: React.FC<StudioSidebarItemProps> = ({icon, label, badge, active, onClick}) => (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-item.focus-ring">
- <button
- type="button"
- className={clsx(styles.item, active && styles.itemActive)}
- aria-current={active ? 'page' : undefined}
- onClick={onClick}
- data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-item.item.click.button"
- >
- <span className={styles.itemIcon} data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-item.item-icon">
- {icon}
- </span>
- <span className={styles.itemLabel} data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-item.item-label">
- {label}
- </span>
- {badge !== undefined && badge !== null ? (
- <span className={styles.itemBadge} data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-item.item-badge">
- {badge}
- </span>
- ) : null}
- </button>
- </FocusRing>
-);
-export const StudioSidebarFooterText: React.FC<{children: ReactNode}> = ({children}) => (
- <span className={styles.footerText} data-flx="theme-studio.ui.studio-sidebar.studio-sidebar-footer-text.footer-text">
- {children}
- </span>
-);
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSplit.module.css b/fluxer_app/src/features/theme_studio/ui/StudioSplit.module.css
deleted file mode 100644
index 2d141bc99..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSplit.module.css
+++ /dev/null
@@ -1,72 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.root {
- display: flex;
- flex: 1 1 auto;
- min-width: 0;
- min-height: 0;
- width: 100%;
- height: 100%;
-}
-
-.horizontal {
- flex-direction: row;
-}
-
-.vertical {
- flex-direction: column;
-}
-
-.pane {
- display: flex;
- flex-direction: column;
- min-width: 0;
- min-height: 0;
- overflow: hidden;
-}
-
-.paneFlex {
- flex: 1 1 auto;
-}
-
-.handle {
- flex-shrink: 0;
- position: relative;
- background: var(--studio-border);
- transition: background var(--studio-transition-fast);
-}
-
-.handleHorizontal {
- width: 0.0625rem;
- cursor: col-resize;
-}
-
-.handleVertical {
- height: 0.0625rem;
- cursor: row-resize;
-}
-
-.handle::before {
- content: '';
- position: absolute;
- inset: -0.125rem;
- background: transparent;
- transition: background var(--studio-transition-fast);
-}
-
-.handle:hover::before,
-.handleActive::before {
- background: color-mix(in srgb, var(--studio-accent) 38%, transparent);
-}
-
-@media (max-width: 720px) {
- .horizontal {
- flex-direction: column;
- }
-
- .handleHorizontal {
- width: 100%;
- height: 0.0625rem;
- cursor: row-resize;
- }
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioSplit.tsx b/fluxer_app/src/features/theme_studio/ui/StudioSplit.tsx
deleted file mode 100644
index fa8fa9b35..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioSplit.tsx
+++ /dev/null
@@ -1,149 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import AppStorage from '@app/features/platform/state/PersistentStorage';
-import styles from '@app/features/theme_studio/ui/StudioSplit.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import {clsx} from 'clsx';
-import type React from 'react';
-import type {ReactNode} from 'react';
-import {useCallback, useEffect, useRef, useState} from 'react';
-
-const RESIZE_PANELS_DESCRIPTOR = msg({
- message: 'Resize panels',
- comment: 'Accessible label for the draggable divider between two Theme Studio panes.',
-});
-
-interface StudioSplitProps {
- orientation?: 'horizontal' | 'vertical';
- initialSize?: number;
- minSize?: number;
- maxSize?: number;
- first: ReactNode;
- second: ReactNode;
- storageKey?: string;
- className?: string;
-}
-
-const readStoredSize = (key: string | undefined): number | null => {
- if (!key) return null;
- if (typeof window === 'undefined') return null;
- try {
- const raw = AppStorage.getItem(key);
- if (raw === null) return null;
- const parsed = Number(raw);
- return Number.isFinite(parsed) ? parsed : null;
- } catch {
- return null;
- }
-};
-const writeStoredSize = (key: string | undefined, value: number) => {
- if (!key) return;
- if (typeof window === 'undefined') return;
- try {
- AppStorage.setItem(key, String(Math.round(value)));
- } catch {}
-};
-export const StudioSplit: React.FC<StudioSplitProps> = ({
- orientation = 'horizontal',
- initialSize = 320,
- minSize = 200,
- maxSize = 720,
- first,
- second,
- storageKey,
- className,
-}) => {
- const {i18n} = useLingui();
- const containerRef = useRef<HTMLDivElement | null>(null);
- const [size, setSize] = useState<number>(() => readStoredSize(storageKey) ?? initialSize);
- const [dragging, setDragging] = useState(false);
- const clampSize = useCallback((next: number) => Math.max(minSize, Math.min(maxSize, next)), [minSize, maxSize]);
- useEffect(() => {
- writeStoredSize(storageKey, size);
- }, [storageKey, size]);
- const onPointerDown = useCallback((event: React.PointerEvent) => {
- if (event.pointerType === 'mouse' && event.button !== 0) return;
- event.preventDefault();
- event.currentTarget.setPointerCapture?.(event.pointerId);
- setDragging(true);
- }, []);
- const onPointerMove = useCallback(
- (event: React.PointerEvent) => {
- if (!dragging) return;
- const rect = containerRef.current?.getBoundingClientRect();
- if (!rect) return;
- const next = orientation === 'horizontal' ? event.clientX - rect.left : event.clientY - rect.top;
- setSize(clampSize(next));
- },
- [dragging, orientation, clampSize],
- );
- const onPointerUp = useCallback((event: React.PointerEvent) => {
- event.currentTarget.releasePointerCapture?.(event.pointerId);
- setDragging(false);
- }, []);
- const onKeyDown = useCallback(
- (event: React.KeyboardEvent<HTMLDivElement>) => {
- const step = event.shiftKey ? 40 : 10;
- let nextSize: number | null = null;
- switch (event.key) {
- case 'ArrowLeft':
- case 'ArrowUp':
- nextSize = size - step;
- break;
- case 'ArrowRight':
- case 'ArrowDown':
- nextSize = size + step;
- break;
- case 'Home':
- nextSize = minSize;
- break;
- case 'End':
- nextSize = maxSize;
- break;
- default:
- return;
- }
- event.preventDefault();
- setSize(clampSize(nextSize));
- },
- [size, minSize, maxSize, clampSize],
- );
- const firstStyle = orientation === 'horizontal' ? {width: size, flexShrink: 0} : {height: size, flexShrink: 0};
- return (
- <div
- ref={containerRef}
- className={clsx(styles.root, styles[orientation], className)}
- onPointerMove={onPointerMove}
- data-flx="theme-studio.ui.studio-split.root"
- >
- <div className={styles.pane} style={firstStyle} data-flx="theme-studio.ui.studio-split.pane">
- {first}
- </div>
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-split.focus-ring">
- <div
- role="separator"
- tabIndex={0}
- aria-orientation={orientation === 'horizontal' ? 'vertical' : 'horizontal'}
- aria-label={i18n._(RESIZE_PANELS_DESCRIPTOR)}
- aria-valuemin={minSize}
- aria-valuemax={maxSize}
- aria-valuenow={Math.round(size)}
- className={clsx(
- styles.handle,
- orientation === 'horizontal' ? styles.handleHorizontal : styles.handleVertical,
- dragging && styles.handleActive,
- )}
- onPointerDown={onPointerDown}
- onPointerUp={onPointerUp}
- onKeyDown={onKeyDown}
- data-flx="theme-studio.ui.studio-split.handle.key-down"
- />
- </FocusRing>
- <div className={clsx(styles.pane, styles.paneFlex)} data-flx="theme-studio.ui.studio-split.pane--2">
- {second}
- </div>
- </div>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioToken.module.css b/fluxer_app/src/features/theme_studio/ui/StudioToken.module.css
deleted file mode 100644
index f3e10f4ea..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioToken.module.css
+++ /dev/null
@@ -1,157 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.row {
- display: grid;
- grid-template-columns: 1.75rem minmax(0, 1fr) auto auto;
- align-items: center;
- gap: 0.5rem;
- padding: 0.4375rem 0.875rem;
- min-height: 2.875rem;
- transition: background var(--studio-transition-fast);
- border-bottom: 0.0625rem solid transparent;
-}
-
-.row:hover {
- background: var(--studio-bg-row-hover);
-}
-
-.overridden {
- background: var(--studio-accent-soft);
-}
-
-.swatchButton {
- width: 1.5rem;
- height: 1.5rem;
- padding: 0;
- border-radius: var(--studio-radius-md);
- border: 0.0625rem solid var(--studio-border-strong);
- background: var(--swatch-bg, transparent);
- cursor: pointer;
- display: inline-flex;
- align-items: center;
- justify-content: center;
- flex-shrink: 0;
-}
-
-.swatchButton:hover {
- border-color: var(--studio-border-focus);
-}
-
-.fontSwatch {
- font-family: var(--swatch-font, var(--studio-font-ui));
- font-size: 0.6875rem;
- font-weight: 600;
- color: var(--studio-fg-primary);
- background: var(--studio-bg-input);
- letter-spacing: 0;
-}
-
-.valueSwatch {
- font-family: var(--studio-font-mono);
- font-size: 0.5625rem;
- font-weight: 700;
- color: var(--studio-fg-muted);
- background: var(--studio-bg-input);
- letter-spacing: 0;
- text-transform: uppercase;
-}
-
-.label {
- display: flex;
- flex-direction: column;
- gap: 0.0625rem;
- min-width: 0;
-}
-
-.labelText {
- font-size: var(--studio-fs-sm);
- color: var(--studio-fg-primary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- text-transform: capitalize;
-}
-
-.variableName {
- font-family: var(--studio-font-mono);
- font-size: 0.65625rem;
- color: var(--studio-fg-subtle);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.valueInput {
- font-family: var(--studio-font-mono);
- font-size: var(--studio-fs-xs);
- background: var(--studio-bg-input);
- color: var(--studio-fg-primary);
- border: 0.0625rem solid var(--studio-border-input);
- border-radius: var(--studio-radius-md);
- padding: 0.1875rem 0.375rem;
- width: 5.5rem;
- height: 1.5rem;
- text-align: center;
- letter-spacing: 0;
-}
-
-.fontInput {
- width: 12.5rem;
- text-align: left;
- font-family: var(--studio-font-mono);
-}
-
-.genericInput {
- width: clamp(8.75rem, 26vw, 16.25rem);
- text-align: left;
-}
-
-.valueInput:focus {
- outline: none;
- border-color: var(--studio-border-focus);
- box-shadow: 0 0 0 0.0625rem var(--studio-border-focus);
-}
-
-.resetButton {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 1.375rem;
- height: 1.375rem;
- background: transparent;
- border: none;
- border-radius: var(--studio-radius-md);
- color: var(--studio-fg-muted);
- cursor: pointer;
-}
-
-.resetButton:hover {
- background: var(--studio-bg-row-hover);
- color: var(--studio-fg-primary);
-}
-
-.resetSpacer {
- width: 1.375rem;
- height: 1.375rem;
-}
-
-.pickerPopover {
- background: var(--studio-bg-elevated);
- border: 0.0625rem solid var(--studio-border-strong);
- border-radius: var(--studio-radius-lg);
- box-shadow: var(--studio-shadow-popover);
- padding: 0;
- color: var(--studio-fg-primary);
- z-index: 12000;
-}
-
-@media (max-width: 720px) {
- .row {
- grid-template-columns: 1.75rem minmax(0, 1fr) minmax(5.5rem, 1fr) auto;
- }
-
- .fontInput,
- .genericInput {
- width: 100%;
- }
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioToken.tsx b/fluxer_app/src/features/theme_studio/ui/StudioToken.tsx
deleted file mode 100644
index 74512a4d6..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioToken.tsx
+++ /dev/null
@@ -1,404 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {ColorPickerPopover} from '@app/features/app/components/floating/ColorPickerPopover';
-import {remFromPx} from '@app/features/theme/layout/RemFromPx';
-import type {ThemeVariableKind} from '@app/features/theme/variables/ThemeVariableManifest';
-import styles from '@app/features/theme_studio/ui/StudioToken.module.css';
-import FocusRing from '@app/features/ui/focus_ring/FocusRing';
-import {
- cssColorStringToHex,
- stripCssColorPriority,
-} from '@app/features/user/components/modals/tabs/appearance_tab/theme/ThemeUtils';
-import {msg} from '@lingui/core/macro';
-import {useLingui} from '@lingui/react/macro';
-import {ArrowCounterClockwiseIcon} from '@phosphor-icons/react';
-import {clsx} from 'clsx';
-import type React from 'react';
-import {useCallback, useEffect, useState} from 'react';
-import {Button as AriaButton, Dialog, DialogTrigger, Popover} from 'react-aria-components';
-
-const EDIT_COLOR_FOR_DESCRIPTOR = msg({
- message: 'Edit color for {tokenLabel}',
- comment: 'Accessible label for a Theme Studio color-token swatch button.',
-});
-const COLOR_PICKER_FOR_DESCRIPTOR = msg({
- message: 'Color picker for {tokenLabel}',
- comment: 'Accessible label for a Theme Studio color picker popover.',
-});
-const RESET_TO_DEFAULT_DESCRIPTOR = msg({
- message: 'Reset {tokenLabel} to default',
- comment: 'Accessible label for resetting a Theme Studio token value to its default.',
-});
-const VALUE_FOR_DESCRIPTOR = msg({
- message: 'Value for {tokenLabel}',
- comment: 'Accessible label for editing a Theme Studio token value.',
-});
-const HEX_VALUE_FOR_DESCRIPTOR = msg({
- message: 'Hex value for {tokenLabel}',
- comment: 'Accessible label for editing a Theme Studio color token hex value.',
-});
-
-interface StudioTokenColorProps {
- variableName: string;
- label: string;
- currentValue: string;
- defaultValue: string;
- overridden: boolean;
- onChange: (hex: string | null) => void;
-}
-
-export const StudioTokenColor: React.FC<StudioTokenColorProps> = ({
- variableName,
- label,
- currentValue,
- defaultValue,
- overridden,
- onChange,
-}) => {
- const {i18n} = useLingui();
- const [open, setOpen] = useState(false);
- const colorValue = currentValue || defaultValue;
- const swatchCss = stripCssColorPriority(colorValue) || 'transparent';
- const initialHex = cssColorStringToHex(colorValue) ?? '#000000';
- const handlePickerChange = useCallback(
- (hex: string) => {
- onChange(hex.toLowerCase());
- },
- [onChange],
- );
- const handleReset = useCallback(() => {
- onChange(null);
- setOpen(false);
- }, [onChange]);
- return (
- <div
- className={clsx(styles.row, overridden && styles.overridden)}
- data-flx="theme-studio.ui.studio-token.studio-token-color.row"
- >
- <DialogTrigger
- isOpen={open}
- onOpenChange={setOpen}
- data-flx="theme-studio.ui.studio-token.studio-token-color.dialog-trigger"
- >
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-color.focus-ring">
- <AriaButton
- className={styles.swatchButton}
- style={{backgroundColor: swatchCss}}
- aria-label={i18n._(EDIT_COLOR_FOR_DESCRIPTOR, {tokenLabel: label})}
- data-flx="theme-studio.ui.studio-token.studio-token-color.swatch-button"
- />
- </FocusRing>
- <Popover
- placement="bottom start"
- offset={8}
- className={styles.pickerPopover}
- data-flx="theme-studio.ui.studio-token.studio-token-color.picker-popover"
- >
- <Dialog
- aria-label={i18n._(COLOR_PICKER_FOR_DESCRIPTOR, {tokenLabel: label})}
- data-flx="theme-studio.ui.studio-token.studio-token-color.dialog"
- >
- <ColorPickerPopover
- color={initialHex}
- onChange={handlePickerChange}
- onReset={handleReset}
- data-flx="theme-studio.ui.studio-token.studio-token-color.color-picker-popover.picker-change"
- />
- </Dialog>
- </Popover>
- </DialogTrigger>
- <span className={styles.label} data-flx="theme-studio.ui.studio-token.studio-token-color.label">
- <span className={styles.labelText} data-flx="theme-studio.ui.studio-token.studio-token-color.label-text">
- {label}
- </span>
- <span className={styles.variableName} data-flx="theme-studio.ui.studio-token.studio-token-color.variable-name">
- {variableName}
- </span>
- </span>
- <HexInput
- label={label}
- value={colorValue}
- placeholder={defaultValue}
- onCommit={onChange}
- data-flx="theme-studio.ui.studio-token.studio-token-color.hex-input"
- />
- {overridden ? (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-color.focus-ring--2">
- <button
- type="button"
- className={styles.resetButton}
- aria-label={i18n._(RESET_TO_DEFAULT_DESCRIPTOR, {tokenLabel: label})}
- onClick={() => onChange(null)}
- data-flx="theme-studio.ui.studio-token.studio-token-color.reset-button.change"
- >
- <ArrowCounterClockwiseIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.ui.studio-token.studio-token-color.arrow-counter-clockwise-icon"
- />
- </button>
- </FocusRing>
- ) : (
- <span className={styles.resetSpacer} data-flx="theme-studio.ui.studio-token.studio-token-color.reset-spacer" />
- )}
- </div>
- );
-};
-
-interface StudioTokenFontProps {
- variableName: string;
- label: string;
- currentValue: string;
- defaultValue: string;
- overridden: boolean;
- onChange: (value: string | null) => void;
-}
-
-export const StudioTokenFont: React.FC<StudioTokenFontProps> = ({
- variableName,
- label,
- currentValue,
- defaultValue,
- overridden,
- onChange,
-}) => {
- const {i18n} = useLingui();
- const [draft, setDraft] = useState(currentValue);
- useEffect(() => {
- setDraft(currentValue);
- }, [currentValue]);
- const commit = useCallback(() => {
- const trimmed = draft.trim();
- if (trimmed === currentValue) return;
- onChange(trimmed.length === 0 ? null : trimmed);
- }, [draft, currentValue, onChange]);
- const previewFamily = currentValue || defaultValue || 'inherit';
- return (
- <div
- className={clsx(styles.row, overridden && styles.overridden)}
- data-flx="theme-studio.ui.studio-token.studio-token-font.row"
- >
- <span
- className={clsx(styles.swatchButton, styles.fontSwatch)}
- style={{fontFamily: previewFamily}}
- aria-hidden
- data-flx="theme-studio.ui.studio-token.studio-token-font.swatch-button"
- >
- Aa
- </span>
- <span className={styles.label} data-flx="theme-studio.ui.studio-token.studio-token-font.label">
- <span className={styles.labelText} data-flx="theme-studio.ui.studio-token.studio-token-font.label-text">
- {label}
- </span>
- <span className={styles.variableName} data-flx="theme-studio.ui.studio-token.studio-token-font.variable-name">
- {variableName}
- </span>
- </span>
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-font.focus-ring">
- <input
- type="text"
- className={clsx(styles.valueInput, styles.fontInput)}
- value={draft}
- placeholder={defaultValue}
- spellCheck={false}
- onChange={(event) => setDraft(event.target.value)}
- onBlur={commit}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.preventDefault();
- commit();
- event.currentTarget.blur();
- }
- }}
- aria-label={i18n._(VALUE_FOR_DESCRIPTOR, {tokenLabel: label})}
- data-flx="theme-studio.ui.studio-token.studio-token-font.value-input.set-draft.text"
- />
- </FocusRing>
- {overridden ? (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-font.focus-ring--2">
- <button
- type="button"
- className={styles.resetButton}
- aria-label={i18n._(RESET_TO_DEFAULT_DESCRIPTOR, {tokenLabel: label})}
- onClick={() => onChange(null)}
- data-flx="theme-studio.ui.studio-token.studio-token-font.reset-button.change"
- >
- <ArrowCounterClockwiseIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.ui.studio-token.studio-token-font.arrow-counter-clockwise-icon"
- />
- </button>
- </FocusRing>
- ) : (
- <span className={styles.resetSpacer} data-flx="theme-studio.ui.studio-token.studio-token-font.reset-spacer" />
- )}
- </div>
- );
-};
-
-interface StudioTokenValueProps {
- variableName: string;
- label: string;
- kind: ThemeVariableKind;
- currentValue: string;
- defaultValue: string;
- overridden: boolean;
- onChange: (value: string | null) => void;
-}
-
-function getKindMarker(kind: ThemeVariableKind): string {
- switch (kind) {
- case 'dimension':
- return 'px';
- case 'number':
- return '#';
- case 'shadow':
- return 'sh';
- case 'transition':
- return 'ms';
- case 'other':
- return '{}';
- default:
- return 'var';
- }
-}
-
-export const StudioTokenValue: React.FC<StudioTokenValueProps> = ({
- variableName,
- label,
- kind,
- currentValue,
- defaultValue,
- overridden,
- onChange,
-}) => {
- const {i18n} = useLingui();
- const [draft, setDraft] = useState(currentValue);
- useEffect(() => {
- setDraft(currentValue);
- }, [currentValue]);
- const commit = useCallback(() => {
- const trimmed = draft.trim();
- if (trimmed === currentValue) return;
- onChange(trimmed.length === 0 ? null : trimmed);
- }, [draft, currentValue, onChange]);
- return (
- <div
- className={clsx(styles.row, overridden && styles.overridden)}
- data-flx="theme-studio.ui.studio-token.studio-token-value.row"
- >
- <span
- className={clsx(styles.swatchButton, styles.valueSwatch)}
- aria-hidden
- data-flx="theme-studio.ui.studio-token.studio-token-value.swatch-button"
- >
- {getKindMarker(kind)}
- </span>
- <span className={styles.label} data-flx="theme-studio.ui.studio-token.studio-token-value.label">
- <span className={styles.labelText} data-flx="theme-studio.ui.studio-token.studio-token-value.label-text">
- {label}
- </span>
- <span className={styles.variableName} data-flx="theme-studio.ui.studio-token.studio-token-value.variable-name">
- {variableName}
- </span>
- </span>
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-value.focus-ring">
- <input
- type="text"
- className={clsx(styles.valueInput, styles.genericInput)}
- value={draft}
- placeholder={defaultValue}
- spellCheck={false}
- onChange={(event) => setDraft(event.target.value)}
- onBlur={commit}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.preventDefault();
- commit();
- event.currentTarget.blur();
- }
- }}
- aria-label={i18n._(VALUE_FOR_DESCRIPTOR, {tokenLabel: label})}
- data-flx="theme-studio.ui.studio-token.studio-token-value.value-input.set-draft.text"
- />
- </FocusRing>
- {overridden ? (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.studio-token-value.focus-ring--2">
- <button
- type="button"
- className={styles.resetButton}
- aria-label={i18n._(RESET_TO_DEFAULT_DESCRIPTOR, {tokenLabel: label})}
- onClick={() => onChange(null)}
- data-flx="theme-studio.ui.studio-token.studio-token-value.reset-button.change"
- >
- <ArrowCounterClockwiseIcon
- size={remFromPx(13)}
- weight="bold"
- data-flx="theme-studio.ui.studio-token.studio-token-value.arrow-counter-clockwise-icon"
- />
- </button>
- </FocusRing>
- ) : (
- <span className={styles.resetSpacer} data-flx="theme-studio.ui.studio-token.studio-token-value.reset-spacer" />
- )}
- </div>
- );
-};
-
-interface HexInputProps {
- label: string;
- value: string;
- placeholder: string;
- onCommit: (hex: string | null) => void;
-}
-
-const HexInput: React.FC<HexInputProps> = ({label, value, placeholder, onCommit}) => {
- const {i18n} = useLingui();
- const initial = cssColorStringToHex(value) ?? value;
- const [draft, setDraft] = useState(initial);
- useEffect(() => {
- setDraft(cssColorStringToHex(value) ?? value);
- }, [value]);
- const placeholderHex = cssColorStringToHex(placeholder) ?? placeholder;
- const commit = useCallback(() => {
- const trimmed = draft.trim();
- if (trimmed.length === 0) {
- onCommit(null);
- return;
- }
- const nextHex = cssColorStringToHex(trimmed);
- if (nextHex !== null) {
- const currentHex = cssColorStringToHex(value);
- if (currentHex !== null && nextHex.toLowerCase() === currentHex.toLowerCase()) {
- setDraft(nextHex);
- return;
- }
- onCommit(nextHex.toLowerCase());
- } else {
- setDraft(initial);
- }
- }, [draft, initial, onCommit, value]);
- return (
- <FocusRing offset={-2} data-flx="theme-studio.ui.studio-token.hex-input.focus-ring">
- <input
- type="text"
- className={styles.valueInput}
- value={draft}
- placeholder={placeholderHex}
- spellCheck={false}
- onChange={(event) => setDraft(event.target.value)}
- onBlur={commit}
- onKeyDown={(event) => {
- if (event.key === 'Enter') {
- event.preventDefault();
- commit();
- event.currentTarget.blur();
- }
- }}
- aria-label={i18n._(HEX_VALUE_FOR_DESCRIPTOR, {tokenLabel: label})}
- data-flx="theme-studio.ui.studio-token.hex-input.value-input.set-draft.text"
- />
- </FocusRing>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioToolbar.module.css b/fluxer_app/src/features/theme_studio/ui/StudioToolbar.module.css
deleted file mode 100644
index 7bf429f73..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioToolbar.module.css
+++ /dev/null
@@ -1,52 +0,0 @@
-/* SPDX-License-Identifier: AGPL-3.0-or-later */
-
-.toolbar {
- display: flex;
- align-items: center;
- gap: 0.5rem;
- height: var(--studio-toolbar-height);
- padding: 0 0.5rem 0 0.75rem;
- background: var(--studio-bg-toolbar);
- border-bottom: 0.0625rem solid var(--studio-border);
- flex-shrink: 0;
- color: var(--studio-fg-primary);
-}
-
-.toolbar[data-draggable='true'] {
- -webkit-app-region: drag;
-}
-
-.toolbar[data-trailing-edge-to-edge='true'] {
- padding-right: 0;
-}
-
-:global(html.platform-native.platform-macos) .toolbar[data-draggable='true'] {
- padding-left: max(
- 0.75rem,
- calc(var(--traffic-lights-backdrop-width, var(--layout-guild-list-width, 4.75rem)) + 0.5rem)
- );
-}
-
-.toolbar[data-draggable='true'] button,
-.toolbar[data-draggable='true'] a,
-.toolbar[data-draggable='true'] input,
-.toolbar[data-draggable='true'] [data-no-drag] {
- -webkit-app-region: no-drag;
-}
-
-.leading,
-.trailing {
- display: flex;
- align-items: center;
- gap: 0.25rem;
- flex-shrink: 0;
-}
-
-.spacer {
- flex: 1 1 auto;
- min-width: 0;
-}
-
-.toolbar[data-trailing-edge-to-edge='true'] .trailing {
- height: 100%;
-}
diff --git a/fluxer_app/src/features/theme_studio/ui/StudioToolbar.tsx b/fluxer_app/src/features/theme_studio/ui/StudioToolbar.tsx
deleted file mode 100644
index e6fd68801..000000000
--- a/fluxer_app/src/features/theme_studio/ui/StudioToolbar.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import styles from '@app/features/theme_studio/ui/StudioToolbar.module.css';
-import type React from 'react';
-import type {ReactNode} from 'react';
-
-interface StudioToolbarProps {
- trailing?: ReactNode;
- draggable?: boolean;
- trailingEdgeToEdge?: boolean;
-}
-
-export const StudioToolbar: React.FC<StudioToolbarProps> = ({
- trailing,
- draggable = false,
- trailingEdgeToEdge = false,
-}) => {
- const hasTrailing = trailing !== undefined && trailing !== null && trailing !== false;
- return (
- <header
- className={styles.toolbar}
- data-draggable={draggable ? 'true' : undefined}
- data-trailing-edge-to-edge={trailingEdgeToEdge ? 'true' : undefined}
- data-flx="theme-studio.ui.studio-toolbar.toolbar"
- >
- <div className={styles.spacer} data-flx="theme-studio.ui.studio-toolbar.spacer" />
- {hasTrailing ? (
- <div className={styles.trailing} data-flx="theme-studio.ui.studio-toolbar.trailing">
- {trailing}
- </div>
- ) : null}
- </header>
- );
-};
diff --git a/fluxer_app/src/features/theme_studio/utils/ThemeStudioPinnedVariables.ts b/fluxer_app/src/features/theme_studio/utils/ThemeStudioPinnedVariables.ts
deleted file mode 100644
index 5d7240d22..000000000
--- a/fluxer_app/src/features/theme_studio/utils/ThemeStudioPinnedVariables.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-or-later
-
-import {
- THEME_STUDIO_DARK_DEFAULT_VARIABLE_VALUES,
- THEME_STUDIO_LIGHT_DEFAULT_VARIABLE_VALUES,
- THEME_VARIABLE_NAMES,
-} from '@app/features/theme/variables/ThemeVariableManifest';
-import {ThemeTypes} from '@fluxer/constants/src/UserConstants';
-
-export type ThemeStudioBaseTheme = 'dark' | 'light';
-
-export function getThemeStudioBaseTheme(effectiveTheme: string): ThemeStudioBaseTheme {
- return effectiveTheme === ThemeTypes.LIGHT ? 'light' : 'dark';
-}
-
-export function getThemeStudioFallbackDefaultVariables(
- baseTheme: ThemeStudioBaseTheme,
-): Readonly<Record<string, string>> {
- return baseTheme === 'light' ? THEME_STUDIO_LIGHT_DEFAULT_VARIABLE_VALUES : THEME_STUDIO_DARK_DEFAULT_VARIABLE_VALUES;
-}
-
-export function readThemeStudioComputedDefaultVariables(
- fallbackVariables: Readonly<Record<string, string>>,
-): Readonly<Record<string, string>> {
- if (typeof window === 'undefined') return fallbackVariables;
- const computedStyle = window.getComputedStyle(document.documentElement);
- const values: Record<string, string> = {...fallbackVariables};
- for (const name of THEME_VARIABLE_NAMES) {
- const value = computedStyle.getPropertyValue(name).trim();
- if (value.length > 0) {
- values[name] = value;
- }
- }
- return values;
-}
-
-export function pinThemeStudioDefaultVariables(
- element: HTMLElement | null,
- variables: Readonly<Record<string, string>>,
-): () => void {
- if (!element) return () => {};
- for (const [name, value] of Object.entries(variables)) {
- element.style.setProperty(name, value, 'important');
- }
- return () => {
- for (const name of Object.keys(variables)) {
- element.style.removeProperty(name);
- }
- };
-}