feat(desktop): Message Bubble transparency slider in Appearance
One 0-100 lever beside Window Translucency: 0 keeps your bubble solid (the default), 100 leaves only the outline. The store paints a single root var, --user-bubble-keep, that --dt-user-bubble mixes in, so the read-only bubble and the inline edit composer follow together and an untouched lever yields byte-identical CSS. Reuses TranslucencySlider (with its overlay peek), has a Cmd-K search entry, and copy in all six locales.
This commit is contained in:
committed by
brooklyn!
parent
59302ece0d
commit
96e1e3f921
@@ -48,6 +48,7 @@ import {
|
||||
TRANSLUCENCY_STEP,
|
||||
TRANSLUCENCY_SUPPORTED
|
||||
} from '@/store/translucency'
|
||||
import { $userBubbleTransparency, setUserBubbleTransparency } from '@/store/user-bubble-transparency'
|
||||
import { $vibeHeartsEnabled, setVibeHeartsEnabled } from '@/store/vibe-hearts-enabled'
|
||||
import { $zoomPercent, setZoomPercent } from '@/store/zoom'
|
||||
import { getBaseColors, useTheme } from '@/themes/context'
|
||||
@@ -402,6 +403,7 @@ export function AppearanceSettings() {
|
||||
const composerPopoutGesturesEnabled = useStore($composerPopoutGesturesEnabled)
|
||||
const translucency = useStore($translucency)
|
||||
const glassMode = translucency.mode === 'glass' && GLASS_SUPPORTED
|
||||
const userBubbleTransparency = useStore($userBubbleTransparency)
|
||||
const reactionsEnabled = useStore($reactionsEnabled)
|
||||
const tipsEnabled = useStore($tipsEnabled)
|
||||
const toursEnabled = useStore($toursEnabled)
|
||||
@@ -743,6 +745,24 @@ export function AppearanceSettings() {
|
||||
/>
|
||||
)}
|
||||
|
||||
<ListRow
|
||||
action={
|
||||
// Same peek as the window lever: the bubble being tuned sits
|
||||
// behind this overlay, so the overlay ghosts while the hand is
|
||||
// on the slider.
|
||||
<div className="flex items-center gap-3" data-translucency-peek-scope="">
|
||||
<TranslucencySlider
|
||||
label={a.userBubbleTitle}
|
||||
onChange={setUserBubbleTransparency}
|
||||
value={userBubbleTransparency}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
description={a.userBubbleDesc}
|
||||
id={appearanceSettingElementId(APPEARANCE_SETTING_IDS.userBubble)}
|
||||
title={a.userBubbleTitle}
|
||||
/>
|
||||
|
||||
<ListRow
|
||||
action={
|
||||
<SegmentedControl
|
||||
|
||||
@@ -18,7 +18,8 @@ export const APPEARANCE_SETTING_IDS = {
|
||||
theme: 'appearance.theme',
|
||||
toolView: 'appearance.tool-view',
|
||||
translucency: 'appearance.translucency',
|
||||
uiScale: 'appearance.ui-scale'
|
||||
uiScale: 'appearance.ui-scale',
|
||||
userBubble: 'appearance.user-bubble'
|
||||
} as const
|
||||
|
||||
export interface SettingsSearchTarget {
|
||||
|
||||
@@ -151,6 +151,15 @@ export function useSettingsSearchCatalog(enabled: boolean) {
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
context: appearanceContext,
|
||||
description: appearance.userBubbleDesc,
|
||||
icon: Palette,
|
||||
id: `setting:${APPEARANCE_SETTING_IDS.userBubble}`,
|
||||
keywords: ['opacity', 'transparent', 'message', 'bubble'],
|
||||
label: appearance.userBubbleTitle,
|
||||
target: { setting: APPEARANCE_SETTING_IDS.userBubble, view: 'config:appearance' }
|
||||
},
|
||||
{
|
||||
context: appearanceContext,
|
||||
description: appearance.backdropDesc,
|
||||
|
||||
@@ -466,6 +466,8 @@ export const ar = defineLocale({
|
||||
},
|
||||
backdropTitle: 'خلفية النافذة',
|
||||
backdropDesc: 'اختيار مقدار مزج خلفية سطح المكتب مع سطح Hermes.',
|
||||
userBubbleTitle: 'فقاعة الرسالة',
|
||||
userBubbleDesc: 'مدى شفافية رسائلك. معتمة عند 0؛ يبقى الإطار فقط عند 100.',
|
||||
introSplashTitle: 'شاشة المقدمة',
|
||||
introSplashDesc: 'الشعار النصي والعبارة التمهيدية في محادثة فارغة.',
|
||||
reactionsTitle: 'تفاعلات الرسائل',
|
||||
|
||||
@@ -586,6 +586,8 @@ export const en: Translations = {
|
||||
},
|
||||
backdropTitle: 'Chat Backdrop',
|
||||
backdropDesc: 'The faint statue image behind the conversation.',
|
||||
userBubbleTitle: 'Message Bubble',
|
||||
userBubbleDesc: 'How see-through your own messages are. Solid at 0; only the outline remains at 100.',
|
||||
introSplashTitle: 'Intro Splash',
|
||||
introSplashDesc: 'The wordmark and prompt shown on an empty chat.',
|
||||
reactionsTitle: 'Message Reactions',
|
||||
|
||||
@@ -409,6 +409,8 @@ export const ja = defineLocale({
|
||||
},
|
||||
backdropTitle: 'チャット背景',
|
||||
backdropDesc: '会話の背後に表示される淡い彫像の画像。',
|
||||
userBubbleTitle: 'メッセージの吹き出し',
|
||||
userBubbleDesc: '自分のメッセージの透け具合。0 で不透明、100 で枠線だけが残ります。',
|
||||
introSplashTitle: 'イントロ表示',
|
||||
introSplashDesc: '空のチャットに表示されるワードマークとプロンプト。',
|
||||
reactionsTitle: 'メッセージリアクション',
|
||||
|
||||
@@ -579,6 +579,8 @@ export const ru = defineLocale({
|
||||
},
|
||||
backdropTitle: 'Фон чата',
|
||||
backdropDesc: 'Блёклый силуэт позади диалога.',
|
||||
userBubbleTitle: 'Пузырь сообщения',
|
||||
userBubbleDesc: 'Насколько прозрачны ваши сообщения. 0 — сплошная заливка, 100 — остаётся только контур.',
|
||||
introSplashTitle: 'Экран приветствия',
|
||||
introSplashDesc: 'Логотип и подсказка, показываемые на пустом чате.',
|
||||
reactionsTitle: 'Реакции на сообщения',
|
||||
|
||||
@@ -478,6 +478,8 @@ export interface Translations {
|
||||
}
|
||||
backdropTitle: string
|
||||
backdropDesc: string
|
||||
userBubbleTitle: string
|
||||
userBubbleDesc: string
|
||||
introSplashTitle: string
|
||||
introSplashDesc: string
|
||||
reactionsTitle: string
|
||||
|
||||
@@ -398,6 +398,8 @@ export const zhHant = defineLocale({
|
||||
},
|
||||
backdropTitle: '聊天背景',
|
||||
backdropDesc: '對話後方那張淡淡的雕像圖片。',
|
||||
userBubbleTitle: '訊息氣泡',
|
||||
userBubbleDesc: '你自己的訊息有多透明。0 為不透明,100 時只保留邊框。',
|
||||
introSplashTitle: '開場標識',
|
||||
introSplashDesc: '空白對話中顯示的字標和提示語。',
|
||||
reactionsTitle: '訊息回應',
|
||||
|
||||
@@ -572,6 +572,8 @@ export const zh: Translations = {
|
||||
},
|
||||
backdropTitle: '聊天背景',
|
||||
backdropDesc: '对话后方那张淡淡的雕像图片。',
|
||||
userBubbleTitle: '消息气泡',
|
||||
userBubbleDesc: '你自己的消息有多透明。0 为不透明,100 时只保留边框。',
|
||||
introSplashTitle: '开场标识',
|
||||
introSplashDesc: '空白对话中显示的字标和提示语。',
|
||||
reactionsTitle: '消息回应',
|
||||
|
||||
@@ -5,6 +5,8 @@ import './store/active-work'
|
||||
import './store/power'
|
||||
// Side-effect: applies the persisted window translucency on load.
|
||||
import './store/translucency'
|
||||
// Side-effect: applies the persisted user-bubble transparency on load.
|
||||
import './store/user-bubble-transparency'
|
||||
// Dev-only render/state churn counters. MUST precede the `react-dom` import
|
||||
// below: react-dom captures the devtools hook at module init, so bippy has to
|
||||
// install during THIS import's evaluation or every commit goes unseen
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Message bubble transparency — how much of your own bubble's fill shows.
|
||||
*
|
||||
* One 0–100 lever, same direction as Window Translucency: 0 keeps the bubble
|
||||
* solid (default), 100 leaves only the outline. Presentation-only, so the
|
||||
* renderer owns it (desktop AGENTS.md: state lives with its authority) and
|
||||
* paints it as ONE root variable — `--user-bubble-keep`, the share of the
|
||||
* theme's bubble fill to keep — that `--dt-user-bubble` mixes in (styles.css).
|
||||
* The bubble and the inline edit composer share that token, so both follow.
|
||||
*/
|
||||
|
||||
import { clampIntensity, TRANSLUCENCY_MAX, TRANSLUCENCY_MIN } from '@hermes/shared/translucency'
|
||||
import { atom } from 'nanostores'
|
||||
|
||||
import { persistString, storedString } from '@/lib/storage'
|
||||
|
||||
const KEY = 'hermes.desktop.user-bubble-transparency.v1'
|
||||
|
||||
export const $userBubbleTransparency = atom<number>(
|
||||
typeof window === 'undefined' ? TRANSLUCENCY_MIN : clampIntensity(storedString(KEY))
|
||||
)
|
||||
|
||||
export function setUserBubbleTransparency(value: number): void {
|
||||
$userBubbleTransparency.set(clampIntensity(value))
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
$userBubbleTransparency.subscribe(value => {
|
||||
const root = document.documentElement
|
||||
|
||||
// The default paints nothing: styles.css falls back to the full fill, so a
|
||||
// user who never touched the lever gets byte-identical CSS to before.
|
||||
if (value === TRANSLUCENCY_MIN) {
|
||||
root.style.removeProperty('--user-bubble-keep')
|
||||
persistString(KEY, null)
|
||||
} else {
|
||||
root.style.setProperty('--user-bubble-keep', `${TRANSLUCENCY_MAX - value}%`)
|
||||
persistString(KEY, String(value))
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -432,7 +432,12 @@
|
||||
--dt-destructive-foreground: #ffffff;
|
||||
--dt-sidebar-bg: var(--ui-bg-sidebar);
|
||||
--dt-sidebar-border: var(--ui-stroke-secondary);
|
||||
--dt-user-bubble: var(--ui-chat-bubble-background);
|
||||
/* `--user-bubble-keep` is the Settings → Appearance → Message Bubble lever
|
||||
(store/user-bubble-transparency.ts): the share of the theme's bubble
|
||||
fill to keep. Unset at the default, so the mix is a no-op and the bubble
|
||||
is the theme's fill exactly as before. The border stays put either way —
|
||||
at full transparency the outline is what still marks your turn. */
|
||||
--dt-user-bubble: color-mix(in srgb, var(--ui-chat-bubble-background) var(--user-bubble-keep, 100%), transparent);
|
||||
--dt-user-bubble-border: var(--ui-stroke-tertiary);
|
||||
|
||||
--dt-font-sans:
|
||||
|
||||
Reference in New Issue
Block a user