Make Background a native feature
- Background replaces the Background Slideshow plugin and the background image of Appearance. It shows a folder as a slideshow, or one image. - It is on by default. Its module loads at launch only when a folder or an image is chosen. - Rust keeps the one folder in background-folder.json. The interface never sends a path. Eight background_* commands replace the six deprecated backgrounds_* commands. - The first start moves the slideshow folder and settings, and keeps the saved image as the image source. - One blur worker with a cache, fewer folder reads, and a decode before each fade. The hub writes only the changed properties. - Remove the deprecated folder methods of api.backgrounds. set, get, and subscribe stay for the Project Management plugin. - Show the view buttons in the workbench test without text, after UI-056. - Update the tests, the measurement tool, the docs, and UI-057.
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
// This file is in the main bundle, so it holds only small static data: names, views, and commands.
|
||||
// The code of a feature loads with a dynamic import at first need (see `loader.ts`), and never while its switch is off.
|
||||
import { message, tr } from "../i18n/index.ts";
|
||||
import type { PluginView } from "../plugins/sdk.ts";
|
||||
import type { PluginCommand, PluginView } from "../plugins/sdk.ts";
|
||||
|
||||
export type FeatureId = "git";
|
||||
export type FeatureId = "git" | "background";
|
||||
|
||||
/** A view of a feature. The workbench shows it as a tab or in the side pane, as it shows a plugin view. */
|
||||
export interface FeatureViewInfo {
|
||||
@@ -21,9 +21,9 @@ export interface FeatureViewInfo {
|
||||
export interface FeatureCommandInfo {
|
||||
id: string;
|
||||
title: () => string;
|
||||
icon?: PluginView["icon"];
|
||||
/** The view that the command opens. */
|
||||
view: string;
|
||||
icon?: PluginCommand["icon"];
|
||||
/** The view that the command opens. Without a view, the command loads the feature and calls `FeatureInstance.run`. */
|
||||
view?: string;
|
||||
}
|
||||
|
||||
export interface FeatureEntry {
|
||||
@@ -37,6 +37,8 @@ export interface FeatureEntry {
|
||||
keywords: string;
|
||||
/** The switch for a user who never installed the old package. */
|
||||
defaultOn: boolean;
|
||||
/** True when the first start gives the switch the state of the old package. False when every user gets `defaultOn`. */
|
||||
followsPackage: boolean;
|
||||
views: readonly FeatureViewInfo[];
|
||||
commands: readonly FeatureCommandInfo[];
|
||||
}
|
||||
@@ -46,7 +48,7 @@ export const FEATURES: readonly FeatureEntry[] = [
|
||||
id: "git", owner: "runestone.git", name: message("Git"),
|
||||
description: message("Review changes, stage files, commit, and see the commit graph of the workspace repository."),
|
||||
keywords: "git source control commit stage diff graph branch push pull blame",
|
||||
defaultOn: true,
|
||||
defaultOn: true, followsPackage: true,
|
||||
views: [
|
||||
{ id: "source-control", title: () => tr("Source control"), placement: "sidebar", icon: "git", navigation: true },
|
||||
{ id: "diff", title: () => tr("Git diff"), placement: "editor", icon: "git" },
|
||||
@@ -54,6 +56,19 @@ export const FEATURES: readonly FeatureEntry[] = [
|
||||
],
|
||||
commands: [{ id: "graph", title: () => tr("Show Git graph"), icon: "git", view: "graph" }],
|
||||
},
|
||||
{
|
||||
// Background replaces the Background Slideshow plugin and the background image of Appearance. Its settings are in
|
||||
// Appearance → Background. It loads at the start only when a folder or an image is selected (see `launch.ts`).
|
||||
id: "background", owner: "runestone.bg-slideshow", name: message("Background"),
|
||||
description: message("Show a folder of images as a slideshow, or one image, behind the workspace and the boards."),
|
||||
keywords: "background image wallpaper slideshow folder picture photo overlay blur",
|
||||
defaultOn: true, followsPackage: false,
|
||||
views: [],
|
||||
commands: [
|
||||
{ id: "next", title: () => tr("Next background image"), icon: "image" },
|
||||
{ id: "pause", title: () => tr("Pause background"), icon: "pause" },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function featureEntry(id: FeatureId): FeatureEntry {
|
||||
|
||||
Reference in New Issue
Block a user