Make Terminal a native feature
- Move the Terminal plugin into src/lib/features/terminal/ on the host Svelte runtime, with xterm 6.0.0 and addon-fit 0.11.0. - Buttons, shortcuts, Help rows, and the close guard follow the Terminal switch. The first use loads the module. - Add Settings → Terminal and the terminal settings section. The first start copies the old runestone.terminal key. - The 16 ANSI colors come from the --rs-ansi-* tokens. - Off asks first when a shell runs in any window (pty_running). - Rust: no pty-data or pty-exit events, an owner check for write, resize, and close, output joined up to 64 KiB or 8 ms, and the sessions of a reloaded page close. - Remove api.pty, the terminal contribution, TerminalSlot, and the plugin loader of the smoke harness. - Check only the tested switches in the Background smoke test. - Update the tests, the menu inventory, the docs, and UI-058.
This commit is contained in:
@@ -66,7 +66,7 @@ A type-only import, such as `import type { PluginApi }`, adds no code to the bun
|
||||
|
||||
## Check for features
|
||||
|
||||
Members marked optional in `PluginApi` can be absent on older RuneStone versions. Examples are `api.pty`, `api.files`, and `api.workspace.readBytes`.
|
||||
Members marked optional in `PluginApi` can be absent on older RuneStone versions. Examples are `api.files`, `api.backgrounds`, and `api.workspace.readBytes`.
|
||||
Make sure that a member exists before you use it.
|
||||
|
||||
```ts
|
||||
@@ -74,8 +74,8 @@ import { hasFeature, requireFeature, requireFeatures, type PluginApi } from "@ru
|
||||
|
||||
export function activate(api: PluginApi) {
|
||||
// Stop the activation with one message that names each missing feature.
|
||||
requireFeatures(api, ["pty", "workspace.readOptional"]);
|
||||
const pty = requireFeature(api, "pty");
|
||||
requireFeatures(api, ["files", "workspace.readOptional"]);
|
||||
const files = requireFeature(api, "files");
|
||||
|
||||
// Hide a control when the feature is absent.
|
||||
if (hasFeature(api, "ui.showActionMenu")) showMenuButton();
|
||||
@@ -91,7 +91,7 @@ export function activate(api: PluginApi) {
|
||||
|
||||
When a feature is missing, `requireFeature` and `requireFeatures` throw a `MissingFeatureError`. Its `features` property lists the feature names.
|
||||
Its message names each feature and its API path, and tells the user to update RuneStone. For example:
|
||||
`This plugin needs the terminal API (api.pty). Update RuneStone to a version that has this feature.`
|
||||
`This plugin needs the folder grant API (api.files). Update RuneStone to a version that has this feature.`
|
||||
|
||||
`pluginFeatures` lists all the feature names. The checks examine only whether the member exists.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user