@decky/ui 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -1
- package/package.json +1 -1
- package/src/index.ts +10 -1
- package/src/plugin.tsx +0 -96
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './components';
|
|
|
4
4
|
export * from './deck-hooks';
|
|
5
5
|
export * from './modules';
|
|
6
6
|
export * from './globals';
|
|
7
|
-
export * from './plugin';
|
|
8
7
|
export * from './webpack';
|
|
9
8
|
export * from './utils';
|
|
10
9
|
export * from './class-mapper';
|
|
10
|
+
export declare const definePlugin: (fn: any) => any;
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,11 @@ export * from './components';
|
|
|
4
4
|
export * from './deck-hooks';
|
|
5
5
|
export * from './modules';
|
|
6
6
|
export * from './globals';
|
|
7
|
-
export * from './plugin';
|
|
8
7
|
export * from './webpack';
|
|
9
8
|
export * from './utils';
|
|
10
9
|
export * from './class-mapper';
|
|
10
|
+
export const definePlugin = (fn) => {
|
|
11
|
+
return (...args) => {
|
|
12
|
+
return fn(...args);
|
|
13
|
+
};
|
|
14
|
+
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -5,7 +5,16 @@ export * from './components';
|
|
|
5
5
|
export * from './deck-hooks';
|
|
6
6
|
export * from './modules';
|
|
7
7
|
export * from './globals';
|
|
8
|
-
export * from './plugin';
|
|
9
8
|
export * from './webpack';
|
|
10
9
|
export * from './utils';
|
|
11
10
|
export * from './class-mapper';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated use @decky/api instead
|
|
14
|
+
*/
|
|
15
|
+
export const definePlugin = (fn: any): any => {
|
|
16
|
+
return (...args: any[]) => {
|
|
17
|
+
// TODO: Maybe wrap this
|
|
18
|
+
return fn(...args);
|
|
19
|
+
};
|
|
20
|
+
};
|
package/src/plugin.tsx
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import { RouteProps } from 'react-router';
|
|
3
|
-
|
|
4
|
-
export interface Plugin {
|
|
5
|
-
title: JSX.Element;
|
|
6
|
-
icon: JSX.Element;
|
|
7
|
-
content?: JSX.Element;
|
|
8
|
-
onDismount?(): void;
|
|
9
|
-
alwaysRender?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
interface ServerResponseSuccess<TRes> {
|
|
13
|
-
success: true;
|
|
14
|
-
result: TRes;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface ServerResponseError {
|
|
18
|
-
success: false;
|
|
19
|
-
result: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ServerResponse<TRes> = ServerResponseSuccess<TRes> | ServerResponseError;
|
|
23
|
-
|
|
24
|
-
export type RoutePatch = (route: RouteProps) => RouteProps;
|
|
25
|
-
|
|
26
|
-
export interface RouterHook {
|
|
27
|
-
addRoute(path: string, component: ComponentType, props?: Omit<RouteProps, 'path' | 'children'>): void;
|
|
28
|
-
addPatch(path: string, patch: RoutePatch): RoutePatch;
|
|
29
|
-
addGlobalComponent(name: string, component: ComponentType): void;
|
|
30
|
-
removeRoute(path: string): void;
|
|
31
|
-
removePatch(path: string, patch: RoutePatch): void;
|
|
32
|
-
removeGlobalComponent(name: string): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ToastData {
|
|
36
|
-
title: ReactNode;
|
|
37
|
-
body: ReactNode;
|
|
38
|
-
onClick?: () => void;
|
|
39
|
-
logo?: ReactNode;
|
|
40
|
-
icon?: ReactNode;
|
|
41
|
-
className?: string;
|
|
42
|
-
contentClassName?: string;
|
|
43
|
-
duration?: number;
|
|
44
|
-
critical?: boolean;
|
|
45
|
-
eType?: number;
|
|
46
|
-
sound?: number;
|
|
47
|
-
playSound?: boolean;
|
|
48
|
-
showToast?: boolean;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface Toaster {
|
|
52
|
-
toast(toast: ToastData): void;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface FilePickerRes {
|
|
56
|
-
path: string;
|
|
57
|
-
realpath: string;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export const enum FileSelectionType {
|
|
61
|
-
FILE,
|
|
62
|
-
FOLDER,
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface ServerAPI {
|
|
66
|
-
routerHook: RouterHook;
|
|
67
|
-
toaster: Toaster;
|
|
68
|
-
openFilePicker(startPath: string, includeFiles?: boolean, regex?: RegExp): Promise<FilePickerRes>;
|
|
69
|
-
openFilePickerV2(
|
|
70
|
-
select: FileSelectionType,
|
|
71
|
-
startPath: string,
|
|
72
|
-
includeFiles?: boolean,
|
|
73
|
-
includeFolders?: boolean,
|
|
74
|
-
filter?: RegExp | ((file: File) => boolean),
|
|
75
|
-
extensions?: string[],
|
|
76
|
-
showHiddenFiles?: boolean,
|
|
77
|
-
allowAllFiles?: boolean,
|
|
78
|
-
max?: number,
|
|
79
|
-
): Promise<FilePickerRes>;
|
|
80
|
-
callPluginMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
|
81
|
-
callServerMethod<TArgs = {}, TRes = {}>(methodName: string, args: TArgs): Promise<ServerResponse<TRes>>;
|
|
82
|
-
fetchNoCors<TRes = {}>(url: RequestInfo, request?: RequestInit): Promise<ServerResponse<TRes>>;
|
|
83
|
-
executeInTab(tab: string, runAsync: boolean, code: string): Promise<unknown>;
|
|
84
|
-
injectCssIntoTab<TRes = string>(tab: string, style: string): Promise<ServerResponse<TRes>>;
|
|
85
|
-
removeCssFromTab(tab: string, cssId: string): Promise<unknown>;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
type DefinePluginFn = (serverAPI: ServerAPI) => Plugin;
|
|
89
|
-
|
|
90
|
-
// TypeScript helper function
|
|
91
|
-
export const definePlugin = (fn: DefinePluginFn): DefinePluginFn => {
|
|
92
|
-
return (...args) => {
|
|
93
|
-
// TODO: Maybe wrap this
|
|
94
|
-
return fn(...args);
|
|
95
|
-
};
|
|
96
|
-
};
|