feat(frontend): système de plugins — runtime, menus, layouts custom (#43)
Lots F1-F4 : runtime de chargement/registre plugin, extension des menus existants, panneau de gestion des plugins, types de layout custom (sélecteur, fallback, cellule dédiée) branchés sur le port plugin. Suite npm typecheck/test verte (947/947). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
58
frontend/src/adapters/plugin.ts
Normal file
58
frontend/src/adapters/plugin.ts
Normal file
@ -0,0 +1,58 @@
|
||||
/**
|
||||
* Tauri adapter for {@link PluginGateway} (ticket #43, F1).
|
||||
*
|
||||
* Commands use snake_case (Tauri convention); payload keys are camelCase,
|
||||
* consistent with the other adapters in this directory. Command names and
|
||||
* envelope match the carnet §5 exactly — no contract improvised here.
|
||||
*
|
||||
* NOTE: The Tauri commands wired here are defined in the backend `app-tauri`
|
||||
* crate (lots B1-B4, in progress in parallel on this branch). The mock gateway
|
||||
* covers tests and offline dev today.
|
||||
*/
|
||||
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
import type {
|
||||
PluginAdmin,
|
||||
PluginInstallResult,
|
||||
PluginReview,
|
||||
PluginRuntimeContributionCatalog,
|
||||
PluginUninstallResult,
|
||||
} from "@/domain";
|
||||
import type { PluginGateway, ReviewPluginPackageInput } from "@/ports";
|
||||
|
||||
export class TauriPluginGateway implements PluginGateway {
|
||||
listPlugins(): Promise<PluginAdmin[]> {
|
||||
return invoke<PluginAdmin[]>("plugin_list_plugins");
|
||||
}
|
||||
|
||||
reviewPackage(input: ReviewPluginPackageInput): Promise<PluginReview> {
|
||||
return invoke<PluginReview>("plugin_review_package", {
|
||||
request: { sourceKind: input.sourceKind, path: input.path },
|
||||
});
|
||||
}
|
||||
|
||||
installFromArchive(path: string): Promise<PluginInstallResult> {
|
||||
return invoke<PluginInstallResult>("plugin_install_from_archive", { path });
|
||||
}
|
||||
|
||||
installFromDirectory(path: string): Promise<PluginInstallResult> {
|
||||
return invoke<PluginInstallResult>("plugin_install_from_directory", { path });
|
||||
}
|
||||
|
||||
setEnabled(pluginId: string, enabled: boolean): Promise<PluginAdmin> {
|
||||
return invoke<PluginAdmin>("plugin_set_enabled", { pluginId, enabled });
|
||||
}
|
||||
|
||||
uninstall(pluginId: string): Promise<PluginUninstallResult> {
|
||||
return invoke<PluginUninstallResult>("plugin_uninstall", { pluginId });
|
||||
}
|
||||
|
||||
listRuntimeContributions(): Promise<PluginRuntimeContributionCatalog> {
|
||||
return invoke<PluginRuntimeContributionCatalog>("plugin_list_runtime_contributions");
|
||||
}
|
||||
|
||||
async openPluginsFolder(pluginId?: string): Promise<void> {
|
||||
await invoke("plugin_open_plugins_folder", { pluginId: pluginId ?? null });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user