docs(sdk): éclate et étend la documentation SDK par sujet
Remplace le README monolithique par un point d'entrée vers des pages dédiées (manifest, activation/contexte, menus, commandes/feedback, layouts React, fenêtres, services, packaging/distribution) pour couvrir #142-#144 et faciliter la navigation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
46
docs/windows.md
Normal file
46
docs/windows.md
Normal file
@ -0,0 +1,46 @@
|
||||
# Windows
|
||||
|
||||
Plugin windows are detached OS windows that host an existing
|
||||
`contributes.layouts` layout. There is no separate window contribution type.
|
||||
|
||||
```ts
|
||||
await ctx.services?.windows.open({
|
||||
layoutType: "hello-plugin.dashboard",
|
||||
state: { openedFrom: "menu" }
|
||||
});
|
||||
```
|
||||
|
||||
## Contract
|
||||
|
||||
- `layoutType` must match a layout type declared by the calling plugin.
|
||||
- The host validates the plugin is runtime-active and the layout exists before
|
||||
opening or focusing the window.
|
||||
- Reopening the same plugin/layout pair focuses the existing window.
|
||||
- `state` is JSON-serializable initial window state. The mounted component can
|
||||
later call `setState(next)` to update its local host state.
|
||||
- The window follows IdeA's focused project, matching detached native panel
|
||||
behavior. If no project is focused, the host shows a neutral shell until one
|
||||
is focused.
|
||||
|
||||
## Return Value
|
||||
|
||||
```ts
|
||||
const win = await ctx.services.windows.open({ layoutType: "hello-plugin.dashboard" });
|
||||
|
||||
win.label;
|
||||
win.alreadyOpen;
|
||||
win.surface.layoutType;
|
||||
```
|
||||
|
||||
The returned `label` is a host-owned window identity. Treat it as opaque.
|
||||
|
||||
## Typical Menu Flow
|
||||
|
||||
```ts
|
||||
ctx.commands?.registerCommand("hello-plugin.open-dashboard", async () => {
|
||||
return ctx.services?.windows.open({
|
||||
layoutType: "hello-plugin.dashboard",
|
||||
state: { source: "menu" }
|
||||
});
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user