@skyvexsoftware/stratos-sdk 0.1.1 → 0.1.3
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/README.md +34 -29
- package/dist/vite/plugin-config.d.ts +1 -1
- package/dist/vite/plugin-config.js +3 -3
- package/dist/vite/serve-externals.js +1 -1
- package/package.json +10 -1
package/README.md
CHANGED
|
@@ -4,18 +4,20 @@ The Stratos Plugin SDK provides typed access to shell APIs, shared UI components
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
**External plugin developers (npm):**
|
|
8
|
-
|
|
9
7
|
```bash
|
|
10
|
-
|
|
8
|
+
pnpm add @skyvexsoftware/stratos-sdk
|
|
11
9
|
```
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
Scaffold a new plugin project:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
|
|
16
|
+
pnpx create-stratos-plugin
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
Or manually create a project with `plugin.json`, `vite.config.ts`, and `src/ui/index.tsx`. See the [plugin developer guide](https://skyvexsoftware.com/docs/plugins) for details.
|
|
20
|
+
|
|
19
21
|
## Available APIs
|
|
20
22
|
|
|
21
23
|
### Plugin Contract Types
|
|
@@ -32,6 +34,22 @@ import type {
|
|
|
32
34
|
} from "@skyvexsoftware/stratos-sdk";
|
|
33
35
|
```
|
|
34
36
|
|
|
37
|
+
### Vite Plugin Config
|
|
38
|
+
|
|
39
|
+
The SDK provides a shared Vite configuration for building plugins:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
import { createPluginConfig } from "@skyvexsoftware/stratos-sdk/vite";
|
|
43
|
+
|
|
44
|
+
export default createPluginConfig({
|
|
45
|
+
pluginDir: import.meta.dirname,
|
|
46
|
+
ui: { entry: "src/ui/index.tsx" },
|
|
47
|
+
background: { entry: "src/background/index.ts" }, // optional
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This handles UI bundling with externals, background module builds, asset copying, dev server auto-connect, and HMR.
|
|
52
|
+
|
|
35
53
|
### Helper Functions
|
|
36
54
|
|
|
37
55
|
#### `createPlugin(module)`
|
|
@@ -109,14 +127,14 @@ function DetailPage() {
|
|
|
109
127
|
|
|
110
128
|
Access shell services from plugin components. All hooks must be used within a `PluginShellProvider` (provided by the shell at runtime).
|
|
111
129
|
|
|
112
|
-
| Hook
|
|
113
|
-
|
|
|
114
|
-
| `useShellAuth()`
|
|
115
|
-
| `useShellConfig()`
|
|
116
|
-
| `useShellNavigation()` | Navigation helpers
|
|
117
|
-
| `useShellToast()`
|
|
118
|
-
| `usePluginLogger()`
|
|
119
|
-
| `usePluginContext()`
|
|
130
|
+
| Hook | Returns | Description |
|
|
131
|
+
| ---------------------- | -------------------- | ------------------------------ |
|
|
132
|
+
| `useShellAuth()` | Auth state | Authentication state and token |
|
|
133
|
+
| `useShellConfig()` | Config store | Scoped configuration access |
|
|
134
|
+
| `useShellNavigation()` | Navigation helpers | Route navigation utilities |
|
|
135
|
+
| `useShellToast()` | Toast API | Toast/notification functions |
|
|
136
|
+
| `usePluginLogger()` | Logger | Scoped renderer-side logger |
|
|
137
|
+
| `usePluginContext()` | Full PluginUIContext | All of the above combined |
|
|
120
138
|
|
|
121
139
|
```tsx
|
|
122
140
|
import { useShellAuth, useShellToast } from "@skyvexsoftware/stratos-sdk";
|
|
@@ -174,7 +192,7 @@ cn("bg-red-500", conditional && "text-white", className);
|
|
|
174
192
|
|
|
175
193
|
## Peer Dependencies
|
|
176
194
|
|
|
177
|
-
The SDK expects these to be provided by the shell at runtime:
|
|
195
|
+
The SDK expects these to be provided by the Stratos shell at runtime:
|
|
178
196
|
|
|
179
197
|
- `react` ^19.0.0
|
|
180
198
|
- `@radix-ui/react-*` (dialog, label, select, separator, slot, tabs, tooltip)
|
|
@@ -183,19 +201,6 @@ The SDK expects these to be provided by the shell at runtime:
|
|
|
183
201
|
- `lucide-react` >=0.300.0
|
|
184
202
|
- `socket.io-client` ^4.0.0
|
|
185
203
|
|
|
186
|
-
##
|
|
187
|
-
|
|
188
|
-
The SDK is published to npm as `@skyvexsoftware/stratos-sdk` directly from the monorepo.
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
pnpm build:sdk # compile TypeScript to dist/
|
|
192
|
-
pnpm --filter @skyvexsoftware/stratos-sdk publish # publish to npm
|
|
193
|
-
```
|
|
204
|
+
## License
|
|
194
205
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
To inspect what would be published without actually publishing:
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
pnpm --filter @skyvexsoftware/stratos-sdk pack
|
|
201
|
-
```
|
|
206
|
+
MIT
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* });
|
|
17
17
|
*/
|
|
18
18
|
import type { Plugin, UserConfig } from "vite";
|
|
19
|
-
import { UI_EXTERNALS } from "./externals";
|
|
19
|
+
import { UI_EXTERNALS } from "./externals.js";
|
|
20
20
|
/** Modules external in background builds (available in Electron main process) */
|
|
21
21
|
declare const BG_EXTERNALS: string[];
|
|
22
22
|
/**
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
import * as fs from "fs";
|
|
19
19
|
import * as path from "path";
|
|
20
20
|
import react from "@vitejs/plugin-react";
|
|
21
|
-
import { UI_EXTERNALS } from "./externals";
|
|
22
|
-
import { serveExternals } from "./serve-externals";
|
|
23
|
-
import { stratosDevServer } from "./stratos-dev-server";
|
|
21
|
+
import { UI_EXTERNALS } from "./externals.js";
|
|
22
|
+
import { serveExternals } from "./serve-externals.js";
|
|
23
|
+
import { stratosDevServer } from "./stratos-dev-server.js";
|
|
24
24
|
/** Modules external in background builds (available in Electron main process) */
|
|
25
25
|
const BG_EXTERNALS = [
|
|
26
26
|
"electron",
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyvexsoftware/stratos-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Plugin SDK for Stratos — types, hooks, and UI components",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Skyvex Software",
|
|
7
7
|
"email": "jordan@skyvexsoftware.com"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"homepage": "https://skyvexsoftware.com",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"stratos",
|
|
13
|
+
"plugin",
|
|
14
|
+
"sdk",
|
|
15
|
+
"flight-sim",
|
|
16
|
+
"acars",
|
|
17
|
+
"simconnect"
|
|
18
|
+
],
|
|
10
19
|
"type": "module",
|
|
11
20
|
"main": "dist/index.js",
|
|
12
21
|
"types": "dist/index.d.ts",
|