feat(plugins): add theme contributions
Adds plugin-contributed light and dark app themes, including persistence, host-aware coalescing, fallback behavior, documentation, examples, and browser/iOS QA.
This commit is contained in:
@@ -102,6 +102,24 @@ export interface PluginSidebarContribution {
|
||||
surface: string;
|
||||
}
|
||||
|
||||
export interface PluginThemeColors {
|
||||
background: string;
|
||||
foreground: string;
|
||||
raised: string;
|
||||
control: string;
|
||||
border: string;
|
||||
accent?: string;
|
||||
mutedForeground: string;
|
||||
ring: string;
|
||||
}
|
||||
|
||||
export interface PluginThemeContribution {
|
||||
id: string;
|
||||
name: string;
|
||||
appearance: "light" | "dark";
|
||||
colors: PluginThemeColors;
|
||||
}
|
||||
|
||||
export interface PluginAttachmentSourceContribution {
|
||||
id: string;
|
||||
title: string;
|
||||
@@ -175,6 +193,7 @@ export interface PluginContext {
|
||||
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
|
||||
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
|
||||
addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
|
||||
addTheme(contribution: PluginThemeContribution): void;
|
||||
}
|
||||
|
||||
export type PluginCleanup = () => void | Promise<void>;
|
||||
|
||||
@@ -7,6 +7,7 @@ import type {
|
||||
PluginSidebarContribution,
|
||||
PluginSurfaceContribution,
|
||||
PluginSurfaceProps,
|
||||
PluginThemeContribution,
|
||||
PluginWorkspacePanelContribution,
|
||||
} from "./contracts.js";
|
||||
import { PluginRpcProvider } from "./rpc-context.js";
|
||||
@@ -20,6 +21,7 @@ interface PluginCollector {
|
||||
addWorkspacePanel(contribution: PluginWorkspacePanelContribution): void;
|
||||
addCommandCenterItem(contribution: PluginCommandCenterItemContribution): void;
|
||||
addAttachmentSource(contribution: PluginAttachmentSourceContribution): void;
|
||||
addTheme(contribution: PluginThemeContribution): void;
|
||||
}
|
||||
|
||||
export interface PluginRegistrationCollector {
|
||||
@@ -28,6 +30,7 @@ export interface PluginRegistrationCollector {
|
||||
workspacePanels: PluginWorkspacePanelContribution[];
|
||||
commandCenterItems: PluginCommandCenterItemContribution[];
|
||||
attachmentSources: PluginAttachmentSourceContribution[];
|
||||
themes: PluginThemeContribution[];
|
||||
}
|
||||
|
||||
export function createPluginContext(
|
||||
@@ -39,6 +42,7 @@ export function createPluginContext(
|
||||
| "addWorkspacePanel"
|
||||
| "addCommandCenterItem"
|
||||
| "addAttachmentSource"
|
||||
| "addTheme"
|
||||
> {
|
||||
return {
|
||||
addSurface(id, Component) {
|
||||
@@ -56,6 +60,9 @@ export function createPluginContext(
|
||||
addAttachmentSource(contribution) {
|
||||
collector.addAttachmentSource(contribution);
|
||||
},
|
||||
addTheme(contribution) {
|
||||
collector.addTheme(contribution);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ export type {
|
||||
PluginSidebarContribution,
|
||||
PluginSurfaceContribution,
|
||||
PluginSurfaceProps,
|
||||
PluginThemeColors,
|
||||
PluginThemeContribution,
|
||||
PluginWorkspaceCommandContext,
|
||||
PluginWorkspacePanelContribution,
|
||||
PluginWorkspacePanelProps,
|
||||
|
||||
Reference in New Issue
Block a user