chore(plugin): delete

This commit is contained in:
AAGaming
2024-05-24 17:10:51 -04:00
parent 3384d2910d
commit b728d90263
2 changed files with 0 additions and 97 deletions

View File

@@ -5,7 +5,6 @@ export * from './components';
export * from './deck-hooks';
export * from './modules';
export * from './globals';
export * from './plugin';
export * from './webpack';
export * from './utils';
export * from './class-mapper';

View File

@@ -1,96 +0,0 @@
import type { ComponentType, ReactNode } from 'react';
import { RouteProps } from 'react-router';
export interface Plugin {
title: JSX.Element;
icon: JSX.Element;
content?: JSX.Element;
onDismount?(): void;
alwaysRender?: boolean;
}
interface ServerResponseSuccess<TRes> {
success: true;
result: TRes;
}
interface ServerResponseError {
success: false;
result: string;
}
export type ServerResponse<TRes> = ServerResponseSuccess<TRes> | ServerResponseError;
export type RoutePatch = (route: RouteProps) => RouteProps;
export interface RouterHook {
addRoute(path: string, component: ComponentType, props?: Omit<RouteProps, 'path' | 'children'>): void;
addPatch(path: string, patch: RoutePatch): RoutePatch;
addGlobalComponent(name: string, component: ComponentType): void;
removeRoute(path: string): void;
removePatch(path: string, patch: RoutePatch): void;
removeGlobalComponent(name: string): void;
}
export interface ToastData {
title: ReactNode;
body: ReactNode;
onClick?: () => void;
logo?: ReactNode;
icon?: ReactNode;
className?: string;
contentClassName?: string;
duration?: number;
critical?: boolean;
eType?: number;
sound?: number;
playSound?: boolean;
showToast?: boolean;
}
export interface Toaster {
toast(toast: ToastData): void;
}
export interface FilePickerRes {
path: string;
realpath: string;
}
export const enum FileSelectionType {
FILE,
FOLDER,
}
export interface ServerAPI {
routerHook: RouterHook;
toaster: Toaster;
openFilePicker(startPath: string, includeFiles?: boolean, regex?: RegExp): Promise<FilePickerRes>;
openFilePickerV2(
select: FileSelectionType,
startPath: string,
includeFiles?: boolean,
includeFolders?: boolean,
filter?: RegExp | ((file: File) => boolean),
extensions?: string[],
showHiddenFiles?: boolean,
allowAllFiles?: boolean,
max?: number,
): Promise<FilePickerRes>;
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
fetchNoCors<TRes = {}>(url: RequestInfo, request?: RequestInit): Promise<ServerResponse<TRes>>;
executeInTab(tab: string, runAsync: boolean, code: string): Promise<unknown>;
injectCssIntoTab<TRes = string>(tab: string, style: string): Promise<ServerResponse<TRes>>;
removeCssFromTab(tab: string, cssId: string): Promise<unknown>;
}
type DefinePluginFn = (serverAPI: ServerAPI) => Plugin;
// TypeScript helper function
export const definePlugin = (fn: DefinePluginFn): DefinePluginFn => {
return (...args) => {
// TODO: Maybe wrap this
return fn(...args);
};
};