Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

unbrick theme mentions (#4439)

Seamuse3a4f77efff8
diff --git a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
index 1ff4525bc9..495fc332bb 100644
--- a/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
+++ b/js/app/packages/core/component/LexicalMarkdown/component/decorator/ThemeMention.tsx
@@ -1,12 +1,12 @@
import { useSettingsState } from '@core/constant/SettingsState';
import type { ThemeMentionDecoratorProps } from '@lexical-core';
-import { ThemeChipPill } from '@theme/components/ThemeChipPill';
+import { ThemeChips } from '@theme/components/ThemeChips';
import { setUserThemes, themes, userThemes } from '@theme/signals/themeSignals';
import type { ThemeV2 } from '@theme/types/themeTypes';
import { applyTheme } from '@theme/utils/themeUtils';
import { isThemeV2 } from '@theme/utils/themeValidation';
import { cn } from '@ui';
-import { useContext } from 'solid-js';
+import { Show, useContext } from 'solid-js';
import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';
export function ThemeMention(props: ThemeMentionDecoratorProps) {
@@ -39,15 +39,24 @@ export function ThemeMention(props: ThemeMentionDecoratorProps) {
};
return (
- <ThemeChipPill
- type="button"
- onClick={handleClick}
+ <span
+ data-theme-mention="true"
class={cn(
- 'pointer-events-auto mx-0.5 align-baseline',
- isSelectedAsNode() && 'bg-active'
+ 'pointer-events-auto p-0.5 cursor-default rounded-xs hover:bg-hover focus:bg-active',
+ isSelectedAsNode() && 'bg-active text-ink'
)}
- theme={theme()}
- name={props.name}
- />
+ onClick={handleClick}
+ >
+ <Show when={theme()}>
+ {(t) => (
+ <span class="relative inline-flex -top-0.75 mr-1">
+ <ThemeChips theme={t()} size="inline" />
+ </span>
+ )}
+ </Show>
+ <span class="underline decoration-current/20 decoration-[max(1px,0.1em)] underline-offset-2">
+ {props.name}
+ </span>
+ </span>
);
}
diff --git a/js/app/packages/theme/components/ThemeChips.tsx b/js/app/packages/theme/components/ThemeChips.tsx
index 3afb66a933..5de782694e 100644
--- a/js/app/packages/theme/components/ThemeChips.tsx
+++ b/js/app/packages/theme/components/ThemeChips.tsx
@@ -3,7 +3,7 @@ import IconTextA from '@phosphor-icons/core/regular/text-aa.svg?component-solid'
import { cn } from '@ui';
type Token = { l: number; c: number; h: number };
-type ThemeChipsSize = 'sm' | 'md';
+type ThemeChipsSize = 'inline' | 'sm' | 'md';
const sizeStyles: Record<
ThemeChipsSize,
@@ -23,6 +23,13 @@ const sizeStyles: Record<
accent: 'size-[6px]',
icon: 'size-[15px]',
},
+ // Em-based so the chip scales with the surrounding font size (~1em tall),
+ // letting it baseline-align inline with text (e.g. the theme mention).
+ inline: {
+ root: 'gap-[0.15em] py-[0.15em] px-[0.15em] rounded-[0.3em]',
+ accent: 'size-[0.28em]',
+ icon: 'size-[0.62em]',
+ },
};
/** A theme swatch: an encompassing square of the theme's panel surface with the