Translate Project Management and add its tests and guide

- Every interface string of Project Management goes through the catalog: 539 new rows with fr, ja, and zh-CN.
- Storage and model messages use a local message() marker and stay free of host imports. The interface translates them.
- A board renders again when the language changes. Dates use the interface language.
- Fix: the ribbon button waits for the feature switches at startup, and the settings code loads no feature module.
- Add six smoke tests: board state, cards, menus, drag and drop, views, and language.
- Add docs/guides/project-management.md and UI-060. Update the user, plugin, SDK, host, development, and interface docs and CLAUDE.md.
- Name the fake board view of tree/renameUndo "Board fixture", because the native Project Management button is now in the ribbon.
This commit is contained in:
Knotty Wyvern
2026-10-29 21:53:09 -07:00
parent e66f089176
commit 956ead818b
53 changed files with 2510 additions and 867 deletions
+11 -53
View File
@@ -13,7 +13,6 @@ This reference gives the package contract, the build procedure, and the API for
- [Use the SDK instead of native calls](#use-the-sdk-instead-of-native-calls)
- [Folder grants](#folder-grants)
- [Plugin services](#plugin-services)
- [Background API](#background-api)
## Install the SDK
@@ -223,6 +222,8 @@ Without the SDK, examine the member directly: `if (!api.workspace.readBytes) thr
Older hosts ignore unknown fields in objects that you pass to the host, such as a view `icon` or `launch` handler.
The host has no `api.backgrounds`. Only the native Background feature shows images behind the interface, and plugins cannot set or read its frames.
### Activation and cleanup
- The host limits activation, each view mount, and each cleanup callback to five seconds. A timeout reports an error.
@@ -230,7 +231,7 @@ Older hosts ignore unknown fields in objects that you pass to the host, such as
- Plugins activate in every RuneStone window except browser windows.
- `api.signal` aborts when shutdown starts. Use it to stop pending work.
- After shutdown starts, every API call throws an error. Ignore results that arrive after shutdown.
- On disable, the host removes contributions, commands, views, and background frames first. Then it runs view cleanups and `onDispose` callbacks in reverse order.
- On disable, the host removes contributions, commands, and views first. Then it runs view cleanups and `onDispose` callbacks in reverse order.
- Remove timers, listeners, and other resources in cleanup. Closing a view and disabling the plugin share the same cleanup promise.
- Plugins have full application access. The SDK does not isolate plugin JavaScript.
@@ -264,7 +265,6 @@ Older hosts ignore unknown fields in objects that you pass to the host, such as
| `completion` | yes | Autocomplete fields and providers. See the [completion API](completion.md). |
| `files` | yes | Folders outside the workspace that the user granted to the plugin. See [Folder grants](#folder-grants). |
| `services` | yes | Data that one plugin offers to other plugins. See [Plugin services](#plugin-services). |
| `backgrounds` | yes | Background image frames. See [Background API](#background-api). |
### Commands
@@ -306,7 +306,6 @@ Closing an editor tab or disabling the plugin disposes the view.
A `launch()` handler can select a default target and call `api.openView(id)`.
Explicit `api.openView` calls and restored tabs do not call `launch()`.
Example: [Project Management](https://git.knottywyvern.com/kwyvern/RuneStone_PM/src/branch/main/development.md#workspace-default-board) uses `launch()` to open the default board of the workspace.
### Navigation buttons
@@ -422,7 +421,7 @@ Do not call `invoke`, `listen`, or other `@tauri-apps/api` functions from a plug
Use the `api` members of the [API reference](#api-reference). They check plugin shutdown, and they will stay available when a later host runs each plugin in its own isolated context.
Make sure that an optional member exists before you use it.
The Project Management, Local Autocomplete, and CSV Viewer plugins make no native calls.
The Local Autocomplete and CSV Viewer plugins make no native calls.
Their test scripts replace `window.__TAURI_INTERNALS__` with a test double. That is test code and does not go into the package.
## Folder grants
@@ -450,6 +449,13 @@ A sidecar holds valid JSON of at most 1 MiB. The host writes no other files in a
Store the grant `id` in the plugin settings. Before you use a saved grant, look for it in `grants()`.
### Example: the per-image settings of Background
The per-image settings file of the Background feature is `.runestone-backgrounds.json` in the image folder.
It is JSON with `"schema": 1` and an `images` object, at most 1 MiB. Each key is a file name. Each value can have `fit` (`cover`, `contain`, `auto`, or `blurred`), `position`, and `overlay`.
A plugin with a folder grant can read and write the same file with `files.readSidecar` and `files.writeSidecar`. `writeSidecar` compares the current file to `expected` (`null` when the file does not exist). It fails when the file changed, so external edits are not lost. The host checks only that the text is JSON. The plugin checks the schema.
Example: `src/lib/features/background/imageSettings.ts` reads the file and applies it.
## Plugin services
`api.services` (`version: 1`) lets a plugin offer data to other plugins in the same window. The host passes the calls, so no plugin reads the private files of another plugin.
@@ -464,51 +470,3 @@ A service name uses lowercase letters, digits, dots, and hyphens, and starts wit
Each method call returns a promise. The host copies the arguments and the result with `structuredClone`. Use only data that this function can copy, not functions or DOM nodes.
When the provider stops, the host removes its services and notifies the subscribers. Calls through an old service object then fail. Call `get` again after a notification.
Make the data of a service a documented contract of the provider. Give its name, methods, and result shapes in the documentation of the provider plugin.
## Background API
`api.backgrounds` (`version: 1`) lets a plugin show image frames behind the RuneStone interface, and read the frames of other owners.
Frames stay in the current window and do not change the saved appearance settings.
To read images from a folder outside the workspace, use [folder grants](#folder-grants).
| Method | Contract |
| --- | --- |
| `set(target, frame)` | Show a frame for a target. `null` removes the frame of this plugin. |
| `get(target)` | Return the active frame for a target, or `null`. |
| `subscribe(listener)` | Receive the target name when a frame changes. Returns a cleanup function. |
The folder methods of earlier hosts (`chooseFolder`, `defaultFolder`, `list`, `read`, `readImageSettings`, and `writeImageSettings`) are gone. The native Background feature replaced the Background Slideshow plugin that used them.
### Targets and frames
| Target | Use |
| --- | --- |
| `app` | The host shows this frame behind the app. |
| `pm-all` | Read by Project Management for all boards. |
| `pm-board:<board UUID>` | Read by Project Management for one board. |
| Frame field | Rule |
| --- | --- |
| `url` | Required `blob:` URL. |
| `blurredUrl` | Optional `blob:` URL for a blurred layer. Each target scales it separately from the foreground. |
| `overlay` | From -1 to 1. Negative values make the image lighter. Positive values make it darker. |
| `position` | `center`, `top left`, `top`, `top right`, `left`, `right`, `bottom left`, `bottom`, or `bottom right`. |
| `size` | `cover`, `contain`, or `auto`. |
| `previous` | Optional earlier frame with the same fields, without `previous` or `transitionMs`. |
| `transitionMs` | Optional fade time from 0 to 5,000 milliseconds. |
The host fades from `previous` to the new frame, unless the user turns on reduced motion.
The plugin owns all frame URLs. Keep them valid until a new frame replaces them or the plugin stops, then release them.
When more than one plugin sets a frame for a target, the most recent frame is shown. When it is removed, the host shows the earlier frame or the saved background.
Disable removes the frames and subscriptions of the plugin before cleanup.
To share saved configuration across windows, use the plugin settings API.
Example: the native Background feature (`src/lib/features/background/index.ts`) sets frames from a local image folder through the host frames.
Example: [Project Management](https://git.knottywyvern.com/kwyvern/RuneStone_PM/src/branch/main/development.md#pm-0229-slideshow-backgrounds) reads frames for board backgrounds.
### Per-image settings
The per-image settings file of the Background feature is `.runestone-backgrounds.json` in the image folder.
It is JSON with `"schema": 1` and an `images` object, at most 1 MiB. Each key is a file name. Each value can have `fit` (`cover`, `contain`, `auto`, or `blurred`), `position`, and `overlay`.
A plugin with a folder grant can read and write the same file with `files.readSidecar` and `files.writeSidecar`. `writeSidecar` compares the current file to `expected` (`null` when the file does not exist). It fails when the file changed, so external edits are not lost. The host checks only that the text is JSON. The plugin checks the schema.
Example: `src/lib/features/background/imageSettings.ts` reads the file and applies it.