feat(settings): settings panel shell + settings.open command (T-445)
Lay the foundation for the schema-driven settings UI (epic T-444). A new `settings.open` command (⌘`,`, plus a File-menu and command-palette entry) opens a centered Settings modal over the dimmed app via the dialog router, built from the modalSurface* tokens (D-7, no Material). The shell frames the two regions later tickets fill in — the category rail (T-447) and the scrolling carded panel (T-448) — and dismisses on ✕, Esc, or barrier tap. With no category registered yet it shows its empty state, which is the correct runtime state. Flesh out the `builtin.settings-ui` stub (was 0.0.0-stub) into a real extension; ship its en-US i18n catalog. Relabel the theme picker's `theme.pick` command title from "Settings…" to "Theme…" so the two no longer collide in the palette (the picker folds into the new panel's Appearance category in T-452). Tests: command + ⌘`,` binding registered, shell renders, Esc and close both dismiss. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,44 @@
|
||||
import 'package:clide/builtin/settings_ui/src/settings_modal.dart';
|
||||
import 'package:clide/clide.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
|
||||
/// Tier-0 stub. Real implementation lands in a later tier; the extension
|
||||
/// is registered so the extensions-ui surface can list it as "installed,
|
||||
/// not yet implemented" and its id is reserved.
|
||||
/// Schema-driven Settings UI (epic T-444). T-445 lands the foundation: the
|
||||
/// `settings.open` command and the modal shell it opens. The category rail
|
||||
/// (T-447), schema field renderer (T-448), scope tags (T-449), search
|
||||
/// (T-450) and the per-subsystem categories fill the shell in later tickets.
|
||||
class SettingsUiExtension extends ClideExtension {
|
||||
@override
|
||||
String get id => 'builtin.settings-ui';
|
||||
@override
|
||||
String get title => 'Settings UI';
|
||||
@override
|
||||
String get version => '0.0.0-stub';
|
||||
String get version => '0.1.0';
|
||||
@override
|
||||
List<String> get dependsOn => const [];
|
||||
|
||||
ClideExtensionContext? _ctx;
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => const [];
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => [
|
||||
// Opens the Settings panel. Palette + File-menu entry come for free off
|
||||
// the title; ctrl+, is the conventional settings shortcut.
|
||||
CommandContribution(id: 'settings.open', command: 'settings.open', title: 'Settings…', defaultBinding: 'ctrl+,', run: _open),
|
||||
];
|
||||
|
||||
Future<IpcResponse> _open(List<String> args) async {
|
||||
final ctx = _ctx;
|
||||
if (ctx == null) {
|
||||
return IpcResponse.err(
|
||||
id: '',
|
||||
error: IpcError(code: IpcExitCode.toolError, kind: IpcErrorKind.toolError, message: 'settings-ui not activated'),
|
||||
);
|
||||
}
|
||||
await ctx.dialog.show<Object>((context, dismiss) => SettingsModal(onDismiss: () => dismiss()));
|
||||
return IpcResponse.ok(id: '', data: const {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user