@t3mode/plugin-sdk 1.1.0 → 1.3.0
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 +25 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -42,9 +42,29 @@ export interface PluginUi {
|
|
|
42
42
|
readonly row: (options: RowOptions) => HTMLElement;
|
|
43
43
|
readonly button: (options: ButtonOptions) => HTMLButtonElement;
|
|
44
44
|
}
|
|
45
|
+
export interface LocalSocket {
|
|
46
|
+
readonly name: string;
|
|
47
|
+
write(data: Uint8Array): void;
|
|
48
|
+
close(): void;
|
|
49
|
+
onData(callback: (data: Uint8Array) => void): void;
|
|
50
|
+
onClose(callback: (error?: string) => void): void;
|
|
51
|
+
}
|
|
52
|
+
/** A local fixed drive. */
|
|
53
|
+
export interface Disk {
|
|
54
|
+
/** The drive's root, such as `C:\`. */
|
|
55
|
+
readonly path: string;
|
|
56
|
+
/** Bytes. */
|
|
57
|
+
readonly total: number;
|
|
58
|
+
/** Bytes available to the user. */
|
|
59
|
+
readonly free: number;
|
|
60
|
+
}
|
|
45
61
|
export interface PluginApi<O extends OptionsSpec = OptionsSpec> {
|
|
46
62
|
/** The id from the plugin's manifest.json. */
|
|
47
63
|
readonly id: string;
|
|
64
|
+
/** Connects to a local socket whose name must be declared in the manifest. */
|
|
65
|
+
readonly sockets: {
|
|
66
|
+
readonly connect: (name: string) => Promise<LocalSocket>;
|
|
67
|
+
};
|
|
48
68
|
readonly options: OptionValues<O>;
|
|
49
69
|
/** Adds a stylesheet, removed when the plugin stops. */
|
|
50
70
|
readonly css: (text: string) => void;
|
|
@@ -88,6 +108,11 @@ export interface PluginApi<O extends OptionsSpec = OptionsSpec> {
|
|
|
88
108
|
/** The first hook state in the tree under the root of `node` that passes `test`. */
|
|
89
109
|
readonly findHookState: <T>(node: Element, test: (value: unknown) => value is T, budget?: number) => T | undefined;
|
|
90
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Size and free space of each local fixed drive, cached for 30 seconds. Network and removable
|
|
113
|
+
* drives are left out. Added in SDK 1.3.0, so check for it before calling.
|
|
114
|
+
*/
|
|
115
|
+
readonly disks?: () => Promise<ReadonlyArray<Disk>>;
|
|
91
116
|
}
|
|
92
117
|
export interface PluginDefinition<O extends OptionsSpec = OptionsSpec> {
|
|
93
118
|
readonly options: O;
|