Make Git a native feature with an off switch
- Add the native feature runtime in src/lib/features/: the catalog, the switches, the first-start migration, the loader, and the feature sessions. - Add Settings → Features and the features settings section. - Add features_legacy. It reads the old plugin packages and changes nothing. - Move Git from the plugin into src/lib/features/git/, on host internals. - Remove api.git, the git contribution key, and the SDK Git types. - Add pnpm check:features. It fails when a feature module loads at start. - Update the tests, the menu inventory, the docs, and UI-055.
This commit is contained in:
@@ -8,6 +8,9 @@
|
||||
import PluginSettings from "$lib/plugins/PluginSettings.svelte";
|
||||
import { installedPlugins, pluginTools } from "$lib/plugins/external";
|
||||
import { pluginHost } from "$lib/plugins/registry";
|
||||
import { FEATURES, type FeatureId } from "$lib/features/catalog";
|
||||
import { featureSwitches, setFeature } from "$lib/features/state";
|
||||
import { featureErrors } from "$lib/features/loader";
|
||||
import { onMount, untrack, type Snippet } from "svelte";
|
||||
import Icon from "$lib/ui/Icon.svelte";
|
||||
import IconButton, { type IconName } from "$lib/ui/IconButton.svelte";
|
||||
@@ -51,6 +54,7 @@
|
||||
{ id: "about", label: $t("Help and about"), icon: "help", keywords: "help about version shortcuts keyboard guide" },
|
||||
{ id: "general", label: $t("General"), icon: "settings", keywords: "auto-save autosave save interval seconds files language français 日本語 简体中文 tables table formulas calculate" },
|
||||
{ id: "appearance", label: $t("Appearance"), icon: "sun", keywords: "theme colors light dark Claude Sakura Harvest Moon Crimson Pilot Silver Serpent" },
|
||||
{ id: "features", label: $t("Features"), icon: "toggle", keywords: `features off switch memory ${FEATURES.map(feature => `${$t(feature.name)} ${feature.keywords}`).join(" ")}` },
|
||||
{ id: "plugins", label: $t("Plug-ins"), icon: "puzzle", keywords: "plugins extensions community" },
|
||||
]);
|
||||
let section = $state<Section>(untrack(() => help ? "about" : "general"));
|
||||
@@ -95,6 +99,12 @@
|
||||
apply({ ...settings, autosaveSeconds: seconds });
|
||||
}
|
||||
|
||||
function changeFeature(id: FeatureId, on: boolean) {
|
||||
error = "";
|
||||
setFeature(id, on).then(() => { message = $t("Changes saved."); })
|
||||
.catch(() => { error = $t("Could not save these settings. Your previous settings still apply. Try again."); message = ""; });
|
||||
}
|
||||
|
||||
function select(next: Section) { section = next; error = ""; message = ""; seconds = settings.autosaveSeconds; }
|
||||
|
||||
function trapFocus(event: KeyboardEvent) {
|
||||
@@ -180,6 +190,23 @@
|
||||
<p class="saved" role="status">{message}</p>
|
||||
{:else if selected.id === "appearance"}
|
||||
<AppearanceSettings />
|
||||
{:else if selected.id === "features"}
|
||||
<h2>{$t("Features")}</h2>
|
||||
<p class="intro">{$t("Turn off the features that you do not use. A feature that is off does not load, and its controls do not show.")}</p>
|
||||
<div class="card">
|
||||
{#each FEATURES as feature (feature.id)}
|
||||
<div class="setting-row">
|
||||
<div>
|
||||
<label for={`feature-${feature.id}`}>{$t(feature.name)}</label>
|
||||
<p id={`feature-${feature.id}-description`}>{$t(feature.description)}</p>
|
||||
{#if $featureErrors[feature.id]}<p class="error" role="alert">{$t("{name} could not load: {error}", { name: $t(feature.name), error: $featureErrors[feature.id] ?? "" })}</p>{/if}
|
||||
</div>
|
||||
<input id={`feature-${feature.id}`} class="rs-switch" type="checkbox" role="switch" aria-describedby={`feature-${feature.id}-description`} checked={$featureSwitches[feature.id]} onchange={event => changeFeature(feature.id, event.currentTarget.checked)} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{#if error}<p class="error" role="alert">{error}</p>{/if}
|
||||
<p class="saved" role="status">{message}</p>
|
||||
{:else if selected.id === "plugins"}
|
||||
<PluginManager />
|
||||
{:else if selected.id === "browser"}
|
||||
|
||||
Reference in New Issue
Block a user