wire the output dock into the layout — toggle, tabs, persistence (T-54)
The D-87 bottom dock, end to end. New Slots.dock in the classic preset (hidden by default); RootLayout renders it full-width above the status bar when open, capped at half the window so Claude stays largest (the D-47 amendment). LogRing now lives on KernelServices (boot tees the kernel logger into it; main.dart also tees the IPC/MCP logger), so the dock shows logs from every subsystem. OutputExtension contributes the Output tab, the merged health/toggle status-bar widget (green check when clean, warn/error counts otherwise) that replaces the old ipc-status item, and the dock.toggle command (Ctrl+J). Problems moves out of the sidebar into the dock. open/height persist per workspace via the default-layout extension. Drag-resize of the dock height is deferred (DragResizeHandle needs a dock sign case); height is the persisted default for now. Boot verified via testmode; full suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -144,6 +144,10 @@ class DefaultLayoutExtension extends ClideExtension {
|
||||
if (sidebarSize != null) ctx.arrangement.setSize(Slots.sidebar, sidebarSize);
|
||||
final contextSize = s.get<double>(_kContextSize);
|
||||
if (contextSize != null) ctx.arrangement.setSize(Slots.contextPanel, contextSize);
|
||||
final dockVisible = s.get<bool>(_kDockVisible);
|
||||
if (dockVisible != null) ctx.arrangement.setVisible(Slots.dock, dockVisible);
|
||||
final dockSize = s.get<double>(_kDockSize);
|
||||
if (dockSize != null) ctx.arrangement.setSize(Slots.dock, dockSize);
|
||||
final editorRatio = s.get<double>(_kEditorRatio);
|
||||
if (editorRatio != null) ctx.arrangement.setEditorRatio(editorRatio);
|
||||
final activeLeft = s.get<String>(_kActiveLeft);
|
||||
@@ -161,6 +165,8 @@ class DefaultLayoutExtension extends ClideExtension {
|
||||
s.set(_kSidebarSize, a.sizeOf(Slots.sidebar));
|
||||
s.set(_kContextSize, a.sizeOf(Slots.contextPanel));
|
||||
s.set(_kEditorRatio, a.editorRatio);
|
||||
s.set(_kDockVisible, a.isVisible(Slots.dock));
|
||||
s.set(_kDockSize, a.sizeOf(Slots.dock));
|
||||
}
|
||||
|
||||
void _persistActiveTabs(ClideExtensionContext ctx) {
|
||||
@@ -179,6 +185,8 @@ class DefaultLayoutExtension extends ClideExtension {
|
||||
static const _kEditorRatio = 'project.layout.editor.ratio';
|
||||
static const _kActiveLeft = 'project.layout.sidebar.activeTab';
|
||||
static const _kActiveRight = 'project.layout.context.activeTab';
|
||||
static const _kDockVisible = 'project.layout.dock.visible';
|
||||
static const _kDockSize = 'project.layout.dock.size';
|
||||
|
||||
Future<IpcResponse> _reset(List<String> args) async {
|
||||
final preset = _preset;
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
export 'src/dock_status_item.dart';
|
||||
export 'src/extension.dart';
|
||||
export 'src/output_controller.dart';
|
||||
export 'src/output_view.dart';
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/// Status-bar widget for the output dock (T-54 / D-87): merged health +
|
||||
/// toggle. Replaces the old app-status item — green ✓ when the log is clean,
|
||||
/// ⚠/✕ counts when not; click (or ⌘J) toggles the dock; chevron shows state.
|
||||
library;
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:clide/widgets/widgets.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class DockStatusItem extends StatefulWidget {
|
||||
const DockStatusItem({super.key});
|
||||
|
||||
@override
|
||||
State<DockStatusItem> createState() => _DockStatusItemState();
|
||||
}
|
||||
|
||||
class _DockStatusItemState extends State<DockStatusItem> {
|
||||
KernelServices? _kernel;
|
||||
StreamSubscription<void>? _ringSub;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
final k = ClideKernel.of(context);
|
||||
if (identical(k, _kernel)) return;
|
||||
_kernel = k;
|
||||
_ringSub?.cancel();
|
||||
_ringSub = k.logRing.changes.listen((_) {
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
void _toggle(KernelServices kernel) {
|
||||
final a = kernel.arrangement;
|
||||
final opening = !a.isVisible(Slots.dock);
|
||||
a.setVisible(Slots.dock, opening);
|
||||
if (opening && kernel.panels.activeTabIn(Slots.dock) == null) {
|
||||
kernel.panels.activateTab(Slots.dock, 'output.panel');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_ringSub?.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final kernel = ClideKernel.of(context);
|
||||
return ListenableBuilder(
|
||||
listenable: kernel.arrangement,
|
||||
builder: (ctx, _) {
|
||||
final tokens = ClideTheme.of(ctx).surface;
|
||||
final open = kernel.arrangement.isVisible(Slots.dock);
|
||||
final errors = kernel.logRing.countAtLeast(LogLevel.error);
|
||||
final warns = kernel.logRing.countAtLeast(LogLevel.warn) - errors;
|
||||
final (String badge, Color color) = errors > 0
|
||||
? ('✕ $errors', tokens.statusError)
|
||||
: warns > 0
|
||||
? ('⚠ $warns', tokens.statusWarning)
|
||||
: ('✓', tokens.statusSuccess);
|
||||
return Semantics(
|
||||
button: true,
|
||||
label: 'toggle output dock',
|
||||
child: GestureDetector(
|
||||
onTap: () => _toggle(kernel),
|
||||
child: MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ClideText('${open ? '▼' : '▲'} Output ', fontSize: clideFontCaption, color: tokens.globalForeground),
|
||||
ClideText(badge, fontSize: clideFontCaption, color: color),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
/// The output-dock builtin (T-54 / D-87): contributes the Output tab + the
|
||||
/// merged health/toggle status-bar widget, and the `dock.toggle` command.
|
||||
library;
|
||||
|
||||
import 'package:clide/builtin/output/src/dock_status_item.dart';
|
||||
import 'package:clide/builtin/output/src/output_view.dart';
|
||||
import 'package:clide/clide.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
|
||||
class OutputExtension extends ClideExtension {
|
||||
ClideExtensionContext? _ctx;
|
||||
|
||||
@override
|
||||
String get id => 'builtin.output';
|
||||
@override
|
||||
String get title => 'Output';
|
||||
@override
|
||||
String get version => '0.1.0';
|
||||
|
||||
/// The dock slot is registered by the default-layout preset; depend on it so
|
||||
/// the slot exists before this tab contributes.
|
||||
@override
|
||||
List<String> get dependsOn => const ['builtin.default-layout'];
|
||||
|
||||
@override
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_ctx = ctx;
|
||||
}
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => [
|
||||
TabContribution(
|
||||
id: 'output.panel',
|
||||
slot: Slots.dock,
|
||||
title: 'Output',
|
||||
priority: -100, // sort before Problems in the dock tab bar
|
||||
build: (ctx) => OutputView(ring: ClideKernel.of(ctx).logRing),
|
||||
),
|
||||
StatusItemContribution(
|
||||
id: 'output.dock-toggle',
|
||||
priority: 100, // right group, replacing the old app-status item
|
||||
build: (_) => const DockStatusItem(),
|
||||
),
|
||||
CommandContribution(
|
||||
id: 'dock.toggle',
|
||||
command: 'dock.toggle',
|
||||
title: 'Toggle output dock',
|
||||
defaultBinding: 'ctrl+j',
|
||||
run: (_) async {
|
||||
final ctx = _ctx;
|
||||
if (ctx == null) return IpcResponse.ok(id: '', data: const {});
|
||||
final a = ctx.arrangement;
|
||||
final opening = !a.isVisible(Slots.dock);
|
||||
a.setVisible(Slots.dock, opening);
|
||||
if (opening && ctx.panels.activeTabIn(Slots.dock) == null) {
|
||||
ctx.panels.activateTab(Slots.dock, 'output.panel');
|
||||
}
|
||||
return IpcResponse.ok(id: '', data: {'dock': opening});
|
||||
},
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:clide/builtin/problems/src/problems_view.dart';
|
||||
import 'package:clide/extension/extension.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:clide/widgets/widgets.dart';
|
||||
|
||||
class ProblemsExtension extends ClideExtension {
|
||||
@override
|
||||
@@ -15,11 +14,12 @@ class ProblemsExtension extends ClideExtension {
|
||||
|
||||
@override
|
||||
List<ContributionPoint> get contributions => [
|
||||
// Moved out of the sidebar into the bottom dock (D-87): no duplication,
|
||||
// and the dock's width fits `severity · file:line · message` rows.
|
||||
TabContribution(
|
||||
id: 'problems.panel',
|
||||
slot: Slots.sidebar,
|
||||
slot: Slots.dock,
|
||||
title: 'Problems',
|
||||
icon: PhosphorIcons.warningCircle,
|
||||
titleKey: 'tab.title',
|
||||
i18nNamespace: id,
|
||||
priority: -50,
|
||||
|
||||
Reference in New Issue
Block a user