From 64c2131362d1091cae7aa3cfa4285c03572b17d2 Mon Sep 17 00:00:00 2001 From: clayzenx Date: Wed, 11 Sep 2024 15:39:43 +0300 Subject: [PATCH] PAPI interface --- index.ts | 1 + interfaces/papi.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 interfaces/papi.ts diff --git a/index.ts b/index.ts index f7a5b79..cfd75e8 100644 --- a/index.ts +++ b/index.ts @@ -7,6 +7,7 @@ export * from './interfaces/document'; export * from './interfaces/protocol'; export * from './interfaces/uicomponent'; export * from './interfaces/editor'; +export * from './interfaces/papi'; export const DocHub: IDocHubCore = window['DocHub']; export const Vue2: any = window['Vue']; diff --git a/interfaces/papi.ts b/interfaces/papi.ts new file mode 100644 index 0000000..53f90b5 --- /dev/null +++ b/interfaces/papi.ts @@ -0,0 +1,67 @@ +export type IClipboardValue = string + +export interface IGotoParams { + id: string; + source: string; + entity: string; +} + +export interface IProjectMode { + mode: string +} + +export interface IUmlSourceCode { + uml: string +} + +export interface ISourceDownloadParams { + content: string; + title: string; + description: string; + extension: string; +} + +export interface ISourceSchema { + schema: string; +} + +export interface IClipboardData { + data: T +} + +export interface IFileContent { + source: string; + content: T +} + +export interface ICodeMetadata { + code: string; + metadata: string; +} + +export interface BasePapiEvents { + goTo(params: IGotoParams): void + applyEntitySchema(schema: ISourceSchema): void + registerLazyLoadedDiagrams(): void +} +export interface RenderPapiEvents { + renderPlantUml(uml: IUmlSourceCode): Promise +} + +export interface FileWorker { + initProject(mode: IProjectMode): void + download(source: ISourceDownloadParams): void +} + +export interface IdeaPapiPlugin extends BasePapiEvents, RenderPapiEvents, FileWorker { + messagePull(): Promise + pushFile(content: IFileContent): Promise + pushCode(metadata: ICodeMetadata): Promise + copyToClipboard(data: IClipboardData): void +} + +export interface VsCodePapiPlugin extends BasePapiEvents, RenderPapiEvents, FileWorker { + loadingHtmlDocumentEvent(): void + checkIsRootManifest(): void +} +