@t3mode/plugin-sdk 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +11 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -42,9 +42,20 @@ 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
+ }
45
52
  export interface PluginApi<O extends OptionsSpec = OptionsSpec> {
46
53
  /** The id from the plugin's manifest.json. */
47
54
  readonly id: string;
55
+ /** Connects to a local socket whose name must be declared in the manifest. */
56
+ readonly sockets: {
57
+ readonly connect: (name: string) => Promise<LocalSocket>;
58
+ };
48
59
  readonly options: OptionValues<O>;
49
60
  /** Adds a stylesheet, removed when the plugin stops. */
50
61
  readonly css: (text: string) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t3mode/plugin-sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "definePlugin and the plugin API types for t3mode, the plugin loader for T3 Code",
5
5
  "license": "MIT",
6
6
  "repository": {