@skyvexsoftware/stratos-sdk 0.1.9 → 0.1.11
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 +49 -43
- package/dist/helpers/createPlugin.d.ts +1 -1
- package/dist/helpers/createPlugin.js +1 -1
- package/dist/vite/plugin-config.js +13 -10
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ my-plugin/
|
|
|
42
42
|
│ │ ├── index.tsx # UI entry (default export: React component)
|
|
43
43
|
│ │ └── global.css # Tailwind CSS
|
|
44
44
|
│ └── background/ # Optional: main process module
|
|
45
|
-
│ └── index.ts #
|
|
45
|
+
│ └── index.ts # export default createPlugin({...})
|
|
46
46
|
└── assets/
|
|
47
47
|
├── icon-light.svg # Sidebar icon (dark theme)
|
|
48
48
|
└── icon-dark.svg # Sidebar icon (light theme)
|
|
@@ -77,7 +77,7 @@ The `vite` option accepts any Vite config to merge in (plugins, resolve, css, et
|
|
|
77
77
|
|
|
78
78
|
## Plugin Manifest
|
|
79
79
|
|
|
80
|
-
`plugin.json` defines your plugin's metadata
|
|
80
|
+
`plugin.json` defines your plugin's metadata. Background modules don't need manifest configuration — the shell discovers them automatically if `background/index.js` exists in the built output.
|
|
81
81
|
|
|
82
82
|
```json
|
|
83
83
|
{
|
|
@@ -87,7 +87,7 @@ The `vite` option accepts any Vite config to merge in (plugins, resolve, css, et
|
|
|
87
87
|
"name": "My Plugin",
|
|
88
88
|
"version": "0.1.0",
|
|
89
89
|
"description": "A Stratos plugin",
|
|
90
|
-
"author": { "id": "my-org", "name": "My
|
|
90
|
+
"author": { "id": "my-org", "name": "My Organisation" },
|
|
91
91
|
"icon_light": "icon-light.svg",
|
|
92
92
|
"icon_dark": "icon-dark.svg"
|
|
93
93
|
}
|
|
@@ -110,7 +110,7 @@ function MyComponent() {
|
|
|
110
110
|
pluginId,
|
|
111
111
|
auth, // { isAuthenticated, token, user }
|
|
112
112
|
airline, // { id, name, icao, logo_light, logo_dark }
|
|
113
|
-
config, // { get(key, defaultValue) }
|
|
113
|
+
config, // { get(key, defaultValue?) } — airline-scoped settings
|
|
114
114
|
navigation, // { navigateTo, navigateToPlugin, navigateToShell }
|
|
115
115
|
toast, // { success, error, info, warning }
|
|
116
116
|
logger, // { info, warn, error, debug }
|
|
@@ -120,84 +120,90 @@ function MyComponent() {
|
|
|
120
120
|
|
|
121
121
|
Individual hooks are also available:
|
|
122
122
|
|
|
123
|
-
| Hook |
|
|
124
|
-
| ---------------------- |
|
|
125
|
-
| `usePluginContext()` |
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
123
|
+
| Hook | Description |
|
|
124
|
+
| ---------------------- | ---------------------------------------------- |
|
|
125
|
+
| `usePluginContext()` | All shell services combined |
|
|
126
|
+
| `useSimData()` | Real-time simulator data (RAF-throttled) |
|
|
127
|
+
| `useFlightPhase()` | Current flight phase with selector support |
|
|
128
|
+
| `useFlightEvents()` | Flight event log with comment mutations |
|
|
129
|
+
| `useFlightManager()` | Low-level flight lifecycle control |
|
|
130
|
+
| `useTrackingSession()` | High-level tracking state with derived fields |
|
|
131
|
+
| `useLandingAnalysis()` | Landing rate, bounces, and settled analysis |
|
|
132
|
+
| `useShellAuth()` | Authentication state and token |
|
|
133
|
+
| `useShellConfig()` | Scoped configuration access |
|
|
134
|
+
| `useShellNavigation()` | Route navigation utilities |
|
|
135
|
+
| `useShellToast()` | Toast/notification functions |
|
|
136
|
+
| `usePluginLogger()` | Scoped renderer-side logger |
|
|
131
137
|
|
|
132
138
|
### Background Module
|
|
133
139
|
|
|
134
|
-
Optional main-process code with access to IPC, Express routes, SQLite, and more:
|
|
140
|
+
Optional main-process code with access to IPC, Express routes, SQLite, and more. Must use the `createPlugin` helper (imported from the `/helpers` subpath) with a default export:
|
|
135
141
|
|
|
136
142
|
```ts
|
|
137
|
-
import { createPlugin } from "@skyvexsoftware/stratos-sdk";
|
|
143
|
+
import { createPlugin } from "@skyvexsoftware/stratos-sdk/helpers";
|
|
138
144
|
|
|
139
145
|
export default createPlugin({
|
|
140
146
|
async onStart(ctx) {
|
|
141
|
-
// ctx.logger
|
|
142
|
-
// ctx.config
|
|
143
|
-
// ctx.ipc
|
|
144
|
-
// ctx.auth
|
|
145
|
-
// ctx.server
|
|
147
|
+
// ctx.logger — scoped logger
|
|
148
|
+
// ctx.config — per-plugin config store (async)
|
|
149
|
+
// ctx.ipc — IPC handler registration
|
|
150
|
+
// ctx.auth — read-only auth token access (async)
|
|
151
|
+
// ctx.server — Express router registration
|
|
146
152
|
// ctx.database — SQLite database access
|
|
147
153
|
ctx.logger.info("MyPlugin", "Started");
|
|
148
154
|
},
|
|
149
|
-
async onStop() {
|
|
150
|
-
|
|
155
|
+
async onStop(ctx) {
|
|
156
|
+
ctx.logger.info("MyPlugin", "Stopped");
|
|
151
157
|
},
|
|
152
158
|
});
|
|
153
159
|
```
|
|
154
160
|
|
|
155
|
-
|
|
161
|
+
Named exports are not supported — the shell requires the `createPlugin` default export pattern for type safety and validation.
|
|
156
162
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
import { PluginRouter } from "@skyvexsoftware/stratos-sdk";
|
|
163
|
+
### UI Components
|
|
161
164
|
|
|
162
|
-
|
|
163
|
-
{ path: "home", component: HomePage },
|
|
164
|
-
{ path: "settings", component: SettingsPage },
|
|
165
|
-
{ path: "detail/:id", component: DetailPage },
|
|
166
|
-
];
|
|
165
|
+
Pre-styled shadcn/ui components that match the Stratos design system:
|
|
167
166
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
}
|
|
167
|
+
```tsx
|
|
168
|
+
import { Button, Card, CardContent, Input, Dialog } from "@skyvexsoftware/stratos-sdk";
|
|
171
169
|
```
|
|
172
170
|
|
|
173
|
-
|
|
171
|
+
Available: Button, Card, Dialog, Input, Label, Select, Badge, Separator, Tabs, Tooltip, AlertDialog, RadioGroup, Slider, Switch, Textarea.
|
|
174
172
|
|
|
175
|
-
###
|
|
173
|
+
### Icons
|
|
176
174
|
|
|
177
|
-
|
|
175
|
+
The full [Lucide](https://lucide.dev) icon set is available via `STRATOS_ICONS`:
|
|
178
176
|
|
|
179
177
|
```tsx
|
|
180
|
-
import {
|
|
178
|
+
import { STRATOS_ICONS, STRATOS_ICON_NAMES } from "@skyvexsoftware/stratos-sdk";
|
|
179
|
+
|
|
180
|
+
const Icon = STRATOS_ICONS["Helicopter"];
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
Or import icons directly from `lucide-react` in your plugin.
|
|
184
184
|
|
|
185
185
|
### Types
|
|
186
186
|
|
|
187
187
|
```ts
|
|
188
|
-
import { FlightPhase,
|
|
188
|
+
import { FlightPhase, EventCategory } from "@skyvexsoftware/stratos-sdk";
|
|
189
189
|
import type { FlightData, PluginManifest, PluginContext } from "@skyvexsoftware/stratos-sdk";
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
### Utilities
|
|
193
193
|
|
|
194
194
|
```ts
|
|
195
|
-
import { cn } from "@skyvexsoftware/stratos-sdk";
|
|
196
|
-
|
|
197
195
|
// Tailwind class merging
|
|
196
|
+
import { cn } from "@skyvexsoftware/stratos-sdk";
|
|
198
197
|
cn("bg-red-500", isActive && "text-white", className);
|
|
198
|
+
|
|
199
|
+
// Unit conversion helpers
|
|
200
|
+
import { weightFromLbs, formatAltitude } from "@skyvexsoftware/stratos-sdk/helpers";
|
|
199
201
|
```
|
|
200
202
|
|
|
201
|
-
##
|
|
203
|
+
## Documentation
|
|
204
|
+
|
|
205
|
+
Full documentation is available at [docs.skyvexsoftware.com](https://docs.skyvexsoftware.com).
|
|
206
|
+
|
|
207
|
+
## Licence
|
|
202
208
|
|
|
203
209
|
MIT
|
|
@@ -6,7 +6,7 @@ import type { PluginBackgroundModule } from "../types/module";
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```ts
|
|
9
|
-
* import { createPlugin } from "@skyvexsoftware/stratos-sdk";
|
|
9
|
+
* import { createPlugin } from "@skyvexsoftware/stratos-sdk/helpers";
|
|
10
10
|
*
|
|
11
11
|
* export default createPlugin({
|
|
12
12
|
* async onStart(ctx) {
|
|
@@ -21,11 +21,7 @@ import { UI_EXTERNALS } from "./externals.js";
|
|
|
21
21
|
import { serveExternals } from "./serve-externals.js";
|
|
22
22
|
import { stratosDevServer } from "./stratos-dev-server.js";
|
|
23
23
|
/** Modules external in background builds (available in Electron main process) */
|
|
24
|
-
const BG_EXTERNALS = [
|
|
25
|
-
"electron",
|
|
26
|
-
"@skyvexsoftware/stratos-sdk",
|
|
27
|
-
"socket.io-client",
|
|
28
|
-
];
|
|
24
|
+
const BG_EXTERNALS = ["electron", "socket.io-client"];
|
|
29
25
|
/** Node.js built-in modules to externalize in background builds */
|
|
30
26
|
const NODE_BUILTINS = [
|
|
31
27
|
"assert",
|
|
@@ -238,11 +234,18 @@ function createBackgroundConfig(pluginDir, entry) {
|
|
|
238
234
|
fileName: () => "index.js",
|
|
239
235
|
},
|
|
240
236
|
rollupOptions: {
|
|
241
|
-
external:
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
237
|
+
external: (id) => {
|
|
238
|
+
// Bundle the SDK helpers subpath (createPlugin) into the output
|
|
239
|
+
if (id === "@skyvexsoftware/stratos-sdk/helpers")
|
|
240
|
+
return false;
|
|
241
|
+
if (id === "@skyvexsoftware/stratos-sdk")
|
|
242
|
+
return true;
|
|
243
|
+
if (BG_EXTERNALS.some((ext) => id === ext || id.startsWith(`${ext}/`)))
|
|
244
|
+
return true;
|
|
245
|
+
if (NODE_BUILTINS.some((b) => id === b || id === `node:${b}`))
|
|
246
|
+
return true;
|
|
247
|
+
return false;
|
|
248
|
+
},
|
|
246
249
|
},
|
|
247
250
|
sourcemap: !isProduction,
|
|
248
251
|
minify: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyvexsoftware/stratos-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"description": "Plugin SDK for Stratos — types, hooks, and UI components",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Skyvex Software",
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"@radix-ui/react-tabs": "^1.1.0",
|
|
73
73
|
"@radix-ui/react-tooltip": "^1.1.0",
|
|
74
74
|
"@tanstack/react-query": "^5.0.0",
|
|
75
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
75
76
|
"class-variance-authority": "^0.7.0",
|
|
76
77
|
"lucide-react": ">=0.300.0",
|
|
77
78
|
"react": "^19.0.0",
|
|
78
79
|
"socket.io-client": "^4.0.0",
|
|
79
|
-
"@vitejs/plugin-react": "^5.0.0",
|
|
80
80
|
"vite": "^7.0.0"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
"@radix-ui/react-tabs": "^1.1.8",
|
|
97
97
|
"@radix-ui/react-tooltip": "^1.1.12",
|
|
98
98
|
"@types/react": "^19.1.2",
|
|
99
|
-
"class-variance-authority": "^0.7.1",
|
|
100
|
-
"lucide-react": "^0.503.0",
|
|
101
99
|
"@vitejs/plugin-react": "^5.1.4",
|
|
100
|
+
"class-variance-authority": "^0.7.1",
|
|
101
|
+
"lucide-react": "^0.577.0",
|
|
102
102
|
"socket.io-client": "^4.8.3",
|
|
103
103
|
"typescript": "^5.8.3",
|
|
104
104
|
"vite": "^7.3.1"
|