mirror of
https://github.com/stablyai/orca.git
synced 2026-11-18 11:54:46 +00:00
feat(plugins): expose the app fonts to plugin frames as --orca-font-sans and --orca-font-mono (#43282)
Frames only got the colour tokens and --orca-radius, so a plugin panel could not match a user's chosen app font. Add --font-sans and --font-mono to the panel design token allowlist; the existing theme sync already refreshes frames in place when the root style changes, so a font change now restyles them too. Native chat visuals already listed both tokens and now get them from the shared allowlist. Fixes #42575 Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -258,7 +258,7 @@ function renderHostApi(sources, { frame, worker }) {
|
||||
[
|
||||
'## Theme variables in frames',
|
||||
'',
|
||||
"HTML panels and custom editors get these CSS variables from Orca's active theme, plus a `light` or `dark` class on `<html>`. A theme change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.",
|
||||
"HTML panels and custom editors get these CSS variables from Orca's active theme and fonts, plus a `light` or `dark` class on `<html>`. A theme or font change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.",
|
||||
'',
|
||||
...sources.themeTokens.pluginFrameThemeVariables().map(({ variable, paints }) => {
|
||||
// Name the frame's own variables, not the app theme tokens behind them.
|
||||
|
||||
@@ -83,7 +83,7 @@ Every key an app theme may set in `tokens` (see [plugin themes](plugin-themes.md
|
||||
|
||||
## Frame CSS variables
|
||||
|
||||
Panel and custom editor frames get these stable variables, set from Orca's active theme and updated in place when it changes. Other tokens are not exposed to frames.
|
||||
Panel and custom editor frames get these stable variables, set from Orca's active theme and fonts and updated in place when they change. Other tokens are not exposed to frames.
|
||||
|
||||
| Variable | Orca token |
|
||||
| --- | --- |
|
||||
@@ -107,3 +107,5 @@ Panel and custom editor frames get these stable variables, set from Orca's activ
|
||||
| `--orca-input` | `--input` |
|
||||
| `--orca-ring` | `--ring` |
|
||||
| `--orca-radius` | `--radius` |
|
||||
| `--orca-font-sans` | `--font-sans` |
|
||||
| `--orca-font-mono` | `--font-mono` |
|
||||
|
||||
@@ -44,7 +44,7 @@ Host API 1.10 (`"pluginApi": 1`). Call `host.call(method, params, { signal })`;
|
||||
|
||||
## Theme variables in frames
|
||||
|
||||
HTML panels and custom editors get these CSS variables from Orca's active theme, plus a `light` or `dark` class on `<html>`. A theme change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.
|
||||
HTML panels and custom editors get these CSS variables from Orca's active theme and fonts, plus a `light` or `dark` class on `<html>`. A theme or font change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.
|
||||
|
||||
- `--orca-background`: App canvas
|
||||
- `--orca-foreground`: Body text
|
||||
@@ -66,6 +66,8 @@ HTML panels and custom editors get these CSS variables from Orca's active theme,
|
||||
- `--orca-input`: Input borders
|
||||
- `--orca-ring`: Focus rings
|
||||
- `--orca-radius`: Corner radius of cards and controls
|
||||
- `--orca-font-sans`: Interface font stack. Fonts Orca loads itself (the default Geist, plugin fonts) are not in frames, so the next installed font in the stack is used
|
||||
- `--orca-font-mono`: Monospace font stack for code
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -3114,7 +3114,7 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [
|
||||
"",
|
||||
"## Theme variables in frames",
|
||||
"",
|
||||
"HTML panels and custom editors get these CSS variables from Orca's active theme, plus a `light` or `dark` class on `<html>`. A theme change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.",
|
||||
"HTML panels and custom editors get these CSS variables from Orca's active theme and fonts, plus a `light` or `dark` class on `<html>`. A theme or font change updates them in place and emits `theme` (`orca.on('theme', ...)`); the frame is not reloaded. Style from them, not fixed colours.",
|
||||
"",
|
||||
"- `--orca-background`: App canvas",
|
||||
"- `--orca-foreground`: Body text",
|
||||
@@ -3136,6 +3136,8 @@ const ORCA_PLUGIN_AUTHORING_HOST_API_REFERENCE_MARKDOWN = [
|
||||
"- `--orca-input`: Input borders",
|
||||
"- `--orca-ring`: Focus rings",
|
||||
"- `--orca-radius`: Corner radius of cards and controls",
|
||||
"- `--orca-font-sans`: Interface font stack. Fonts Orca loads itself (the default Geist, plugin fonts) are not in frames, so the next installed font in the stack is used",
|
||||
"- `--orca-font-mono`: Monospace font stack for code",
|
||||
"",
|
||||
"## Methods",
|
||||
"",
|
||||
|
||||
@@ -63,9 +63,7 @@ export const NATIVE_CHAT_VISUAL_THEME_TOKENS = [
|
||||
'--chart-2',
|
||||
'--chart-3',
|
||||
'--chart-4',
|
||||
'--chart-5',
|
||||
'--font-sans',
|
||||
'--font-mono'
|
||||
'--chart-5'
|
||||
] as const
|
||||
|
||||
export type NativeChatVisualTheme = {
|
||||
|
||||
@@ -151,7 +151,10 @@ const APP_THEME_TOKENS: ReadonlySet<string> = new Set(PLUGIN_APP_THEME_TOKENS)
|
||||
const isAppThemeToken = (token: string): token is PluginAppThemeToken => APP_THEME_TOKENS.has(token)
|
||||
// Frame variables that are not colours of an app theme.
|
||||
const FRAME_ONLY_ROLES: Record<string, string> = {
|
||||
'--radius': 'Corner radius of cards and controls'
|
||||
'--radius': 'Corner radius of cards and controls',
|
||||
'--font-sans':
|
||||
'Interface font stack. Fonts Orca loads itself (the default Geist, plugin fonts) are not in frames, so the next installed font in the stack is used',
|
||||
'--font-mono': 'Monospace font stack for code'
|
||||
}
|
||||
|
||||
/** The `--orca-*` CSS variables panel and editor frames get, with what each paints. */
|
||||
@@ -181,7 +184,7 @@ export function renderPluginThemeTokenReference(): string {
|
||||
'',
|
||||
'## Frame CSS variables',
|
||||
'',
|
||||
"Panel and custom editor frames get these stable variables, set from Orca's active theme and updated in place when it changes. Other tokens are not exposed to frames.",
|
||||
"Panel and custom editor frames get these stable variables, set from Orca's active theme and fonts and updated in place when they change. Other tokens are not exposed to frames.",
|
||||
'',
|
||||
'| Variable | Orca token |',
|
||||
'| --- | --- |',
|
||||
|
||||
@@ -22,5 +22,7 @@ export const PANEL_DESIGN_TOKEN_ALLOWLIST = [
|
||||
'--border',
|
||||
'--input',
|
||||
'--ring',
|
||||
'--radius'
|
||||
'--radius',
|
||||
'--font-sans',
|
||||
'--font-mono'
|
||||
] as const
|
||||
|
||||
Reference in New Issue
Block a user