@majkapp/plugin-kit 3.3.3 → 3.3.5

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 CHANGED
@@ -605,6 +605,10 @@ const plugin = definePlugin('my-plugin', 'My Plugin', '1.0.0');
605
605
 
606
606
  ## Troubleshooting
607
607
 
608
+ ### Client Generation Warnings
609
+
610
+ After running `npm run build`, check `ui/src/generated/generation.log` for schema optimization warnings. The generator analyzes your function input schemas and provides actionable suggestions for improving hook performance (e.g., flattening nested structures, reducing large objects).
611
+
608
612
  ### "React app not built"
609
613
 
610
614
  ```
package/docs/HOOKS.md CHANGED
@@ -524,6 +524,11 @@ Generated files (DO NOT EDIT manually):
524
524
  - `ui/src/generated/client.ts` - RPC client
525
525
  - `ui/src/generated/types.ts` - TypeScript types
526
526
  - `ui/src/generated/index.ts` - Barrel export
527
+ - `ui/src/generated/generation.log` - Build log with warnings
528
+
529
+ ### Hook Performance Optimization
530
+
531
+ Generated hooks use **schema-driven dependency extraction** for optimal performance. Primitive fields (string, number, boolean) are tracked individually via `Object.is()` instead of expensive serialization. Check `generation.log` for dependency analysis and warnings about schema improvements.
527
532
 
528
533
  ## Next Steps
529
534
 
package/docs/INDEX.md CHANGED
@@ -43,7 +43,8 @@ const plugin = definePlugin('my-plugin', 'My Plugin', '1.0.0')
43
43
  name: 'My Plugin',
44
44
  description: 'Main plugin screen',
45
45
  route: '/plugin-screens/my-plugin/main',
46
- pluginPath: '/index.html' // Path to built React app
46
+ pluginPath: '/index.html', // Path to built React app
47
+ pluginPathHash: '#/' // Route within React app (HashRouter)
47
48
  })
48
49
 
49
50
  .build();
@@ -228,6 +229,46 @@ export default defineConfig({
228
229
  - Empty base ensures assets load correctly
229
230
  - `base: './'` will cause 404 errors for assets
230
231
 
232
+ ### Hash Routing for Multiple Screens
233
+
234
+ **Use `pluginPathHash` to route to different screens in your React app:**
235
+
236
+ ```typescript
237
+ // Multiple screens using hash routes
238
+ .screenReact({
239
+ id: 'my-plugin-dashboard',
240
+ name: 'Dashboard',
241
+ route: '/plugin-screens/my-plugin/dashboard',
242
+ pluginPath: '/index.html',
243
+ pluginPathHash: '#/' // Main dashboard
244
+ })
245
+
246
+ .screenReact({
247
+ id: 'my-plugin-settings',
248
+ name: 'Settings',
249
+ route: '/plugin-screens/my-plugin/settings',
250
+ pluginPath: '/index.html',
251
+ pluginPathHash: '#/settings' // Settings page
252
+ })
253
+ ```
254
+
255
+ Your React app (ui/src/App.tsx) uses HashRouter:
256
+
257
+ ```typescript
258
+ import { HashRouter, Routes, Route } from 'react-router-dom';
259
+
260
+ export function App() {
261
+ return (
262
+ <HashRouter>
263
+ <Routes>
264
+ <Route path="/" element={<DashboardPage />} />
265
+ <Route path="/settings" element={<SettingsPage />} />
266
+ </Routes>
267
+ </HashRouter>
268
+ );
269
+ }
270
+ ```
271
+
231
272
  ## Best Practice: Decoupled Business Logic
232
273
 
233
274
  **ALWAYS separate business logic from plugin code.** This makes testing easier and allows logic reuse.
@@ -380,7 +421,7 @@ export class MockStorageService implements StorageService {
380
421
 
381
422
  ## React UI with Generated Hooks
382
423
 
383
- The plugin-kit auto-generates React hooks from your functions.
424
+ The plugin-kit auto-generates **performance-optimized** React hooks from your functions. Dependencies are extracted from your input schemas for O(1) comparison instead of serialization. Review `ui/src/generated/generation.log` for optimization analysis and schema warnings.
384
425
 
385
426
  ```typescript
386
427
  // ui/src/DashboardPage.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majkapp/plugin-kit",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "description": "Pure plugin definition library for MAJK - outputs plugin definitions, not HTTP servers",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",