Skip to content
15 changes: 15 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,21 @@ Working rules for this repo:

## Project notes

- **Single-select capabilities (2026-08-12, PR 2 of the streamline epic)** —
overlapping tools are radio choices, not stacking toggles. Pure
`kExclusiveGroups` (`{'hex-flavor': [verdant, hexcrawl]}`) +
`normalizeExclusive` + `kExclusiveSystemIds` in `campaign_surfaces.dart`;
the wizard + `_EditSystemsDialog` render group members as ChoiceChips
(keys unchanged, `hexflavor-none`/`edit-hexflavor-none` for None) and
normalization runs on wizard create + edit-dialog save ONLY (gates stay
tolerant of legacy both-on sets). `SessionMeta.partyTool`
('emulator'|'behavior'|'sidekick', JSON omitted at default;
`enabledPartyTool`, `setPartyTool`, `partyToolProvider`) picks the ONE
party surface `PartyToolsPane` renders (SegmentedButton retired; the
wizard's `party-tool-<id>` row + the edit dialog's `edit-party-tool-<id>`
row switch it). The Dungeon pane shows one generator at a time
(`_hexcrawlDungeonControls` hidden while classic-dungeon is on). See
`docs/superpowers/specs/2026-08-12-streamline-library-exclusive-capabilities-design.md`.
- **QoL sweep (2026-07-12, PRs #287–#299)** — thirteen player-experience
features, each with a spec in `docs/superpowers/specs/2026-07-12-*`:
mobile chrome density + HUD light-chip de-noising (`kCompactWidth` 600,
Expand Down
570 changes: 570 additions & 0 deletions docs/superpowers/plans/2026-08-12-exclusive-capabilities.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions lib/engine/campaign_surfaces.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,30 @@ List<VerbSurfaces> surfacesFor(Set<String> systems) {
]),
];
}

/// Capability groups where enabling more than one member stacks overlapping
/// UI for the same job. The dialogs render each group as a radio row, and
/// [normalizeExclusive] resolves a both-on legacy set by keeping the FIRST
/// member listed here. Gates elsewhere stay tolerant of both-on sets.
const Map<String, List<String>> kExclusiveGroups = {
'hex-flavor': ['verdant', 'hexcrawl'],
};

/// Every system id that belongs to some exclusive group — the dialogs skip
/// these in their plain checkbox/filter loops.
final Set<String> kExclusiveSystemIds =
kExclusiveGroups.values.expand((m) => m).toSet();

/// Keeps at most one member per exclusive group (the first listed), leaving
/// everything else untouched.
Set<String> normalizeExclusive(Set<String> systems) {
final out = {...systems};
for (final members in kExclusiveGroups.values) {
final present = members.where(out.contains).toList();
if (present.length > 1) {
out.removeAll(present);
out.add(present.first);
}
}
return out;
}
14 changes: 13 additions & 1 deletion lib/engine/models/session.dart
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@ class SessionMeta {
this.identityColor,
this.identityIcon,
this.genre,
this.dndEdition});
this.dndEdition,
this.partyTool});
final String id;
final String name;

Expand All @@ -319,9 +320,16 @@ class SessionMeta {
/// ('5.2'). Filters edition-tagged content so one edition shows at a time.
final String? dndEdition;

/// Which party-tools paradigm the Track subtab shows ('emulator' | 'behavior' |
/// 'sidekick'); null → emulator.
final String? partyTool;

/// Resolved set: the declared systems, or every system when unset.
Set<String> get enabledSystems => systems?.toSet() ?? kAllSystems;

/// Resolved party tool; null → 'emulator'.
String get enabledPartyTool => partyTool ?? 'emulator';

Map<String, dynamic> toJson() => {
'id': id,
'name': name,
Expand All @@ -330,6 +338,7 @@ class SessionMeta {
if (identityIcon != null) 'identityIcon': identityIcon,
if (genre != null) 'genre': genre,
if (dndEdition != null) 'dndEdition': dndEdition,
if (partyTool != null) 'partyTool': partyTool,
};

// id is immutable — not overridable via copyWith.
Expand All @@ -340,6 +349,7 @@ class SessionMeta {
String? identityIcon,
String? genre,
String? dndEdition,
String? partyTool,
}) =>
SessionMeta(
id: id,
Expand All @@ -349,6 +359,7 @@ class SessionMeta {
identityIcon: identityIcon ?? this.identityIcon,
genre: genre ?? this.genre,
dndEdition: dndEdition ?? this.dndEdition,
partyTool: partyTool ?? this.partyTool,
);

factory SessionMeta.fromJson(Map<String, dynamic> j) => SessionMeta(
Expand All @@ -359,6 +370,7 @@ class SessionMeta {
identityIcon: j['identityIcon'] as String?,
genre: j['genre'] as String?,
dndEdition: j['dndEdition'] as String?,
partyTool: j['partyTool'] as String?,
);
}

Expand Down
8 changes: 8 additions & 0 deletions lib/features/launcher_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ class LauncherScreen extends ConsumerWidget {
await ref
.read(settingsProvider.notifier)
.setDefaultOracle(result.defaultOracle);
if (result.partyTool != 'emulator') {
final active = ref.read(sessionsProvider).valueOrNull?.active;
if (active != null) {
await ref
.read(sessionsProvider.notifier)
.setPartyTool(active, result.partyTool);
}
}
// First real campaign replaces the untouched first-run placeholder.
if (wasPristine) {
await ref.read(sessionsProvider.notifier).remove('default');
Expand Down
5 changes: 4 additions & 1 deletion lib/features/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,10 @@ class DungeonMapPaneState extends ConsumerState<DungeonMapPane> {
.goTo(Destination.map, subtab: 'world');
},
),
if (_hexcrawlOn()) _hexcrawlDungeonControls(context),
// One dungeon generator at a time: when the classic (Roll 4 Ruin)
// crawler owns this pane, the hexcrawl toolkit's room/dungeon
// generation folds away instead of stacking a second generator.
if (_hexcrawlOn() && !_classicOn()) _hexcrawlDungeonControls(context),
IconButton(
key: const Key('dungeon-journal'),
icon: const Icon(Icons.bookmark_add_outlined),
Expand Down
62 changes: 16 additions & 46 deletions lib/features/party_tools_pane.dart
Original file line number Diff line number Diff line change
@@ -1,56 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../state/providers.dart';
import 'behavior_tables_screen.dart';
import 'party_emulator_screen.dart';
import 'sidekick_screen.dart';

/// One Track subtab hosting the three party-tools surfaces — Emulator,
/// Behavior, and Sidekick — behind a segmented switch (was three separate
/// same-weight subtabs). An [IndexedStack] keeps all three mounted so each
/// keeps its state across switches (and dodges the TabBarView loose-constraints
/// gotcha in the tool host).
class PartyToolsPane extends StatefulWidget {
const PartyToolsPane({super.key, this.initial = 0});

/// Which inner surface to show first (0 Emulator, 1 Behavior, 2 Sidekick).
final int initial;

@override
State<PartyToolsPane> createState() => _PartyToolsPaneState();
}

class _PartyToolsPaneState extends State<PartyToolsPane> {
late int _tab = widget.initial.clamp(0, 2);
/// The Track party subtab shows ONE party-tools paradigm — Emulator,
/// Behavior, or Sidekick — chosen per campaign (SessionMeta.partyTool, set
/// in the creation wizard or Campaigns → Edit systems). The old in-pane
/// SegmentedButton stacked all three behind a switch; the paradigms answer
/// the same question, so the choice is campaign config, not pane state.
/// Unchosen paradigms keep their persisted state for a later switch back.
class PartyToolsPane extends ConsumerWidget {
const PartyToolsPane({super.key});

@override
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(12, 8, 12, 0),
child: SegmentedButton<int>(
key: const Key('party-tools-switch'),
segments: const [
ButtonSegment(value: 0, label: Text('Emulator')),
ButtonSegment(value: 1, label: Text('Behavior')),
ButtonSegment(value: 2, label: Text('Sidekick')),
],
selected: {_tab},
showSelectedIcon: false,
onSelectionChanged: (s) => setState(() => _tab = s.first),
),
),
Expanded(
child: IndexedStack(
index: _tab,
children: const [
PartyEmulatorScreen(),
BehaviorTablesScreen(),
SidekickScreen(),
],
),
),
],
);
Widget build(BuildContext context, WidgetRef ref) {
return switch (ref.watch(partyToolProvider)) {
'behavior' => const BehaviorTablesScreen(),
'sidekick' => const SidekickScreen(),
_ => const PartyEmulatorScreen(),
};
}
}
6 changes: 4 additions & 2 deletions lib/features/tracking_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ class TrackingTab extends ConsumerWidget {
const SubtabDef('encounter', 'Encounter'),
if (rumors) const SubtabDef('rumors', 'Rumors'),
const SubtabDef('tracks', 'Tracks'),
// Emulator + Behavior + Sidekick consolidated into one Party subtab
// (internal switch); legacy routes resolve via the aliases.
// One party paradigm renders per SessionMeta.partyTool (Emulator /
// Behavior / Sidekick are mutually exclusive, not stacked). The
// aliases only keep legacy routes ('emulator'/'sidekick'/'behavior')
// resolving to this subtab.
if (partyTools)
const SubtabDef('party', 'Party',
aliases: ['emulator', 'sidekick', 'behavior']),
Expand Down
Loading
Loading