@decido/shell 1.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -0
- package/package.json +17 -14
- package/.turbo/turbo-build.log +0 -13
- package/src/AgentPlayer.tsx +0 -105
- package/src/DecidoPlayer.tsx +0 -117
- package/src/bridge/BridgeAgent.ts +0 -443
- package/src/components/DecidoIcon.tsx +0 -56
- package/src/components/JsonTreeEditor.tsx +0 -117
- package/src/components/PanelSplitter.tsx +0 -71
- package/src/components/PluginErrorBoundary.tsx +0 -69
- package/src/components/SafeLiquidUI.tsx +0 -114
- package/src/components/TransientLayer.tsx +0 -92
- package/src/components/agent/AgentChat.tsx +0 -134
- package/src/components/chat-extensions/IntentCatalogPanel.tsx +0 -81
- package/src/components/chat-extensions/chatSlashCommands.ts +0 -101
- package/src/components/controls/CreatorInputBar.tsx +0 -144
- package/src/components/controls/OSToolbar.tsx +0 -90
- package/src/components/controls/TimelineTape.tsx +0 -43
- package/src/components/debug/ActionTimelineTab.tsx +0 -111
- package/src/components/debug/CSSInspectorTab.tsx +0 -436
- package/src/components/debug/ExportTab.tsx +0 -192
- package/src/components/debug/FlowHealthTab.tsx +0 -86
- package/src/components/debug/LogsTab.tsx +0 -110
- package/src/components/debug/MorphStackTab.tsx +0 -241
- package/src/components/debug/NetworkTab.tsx +0 -173
- package/src/components/debug/PerformanceTab.tsx +0 -171
- package/src/components/debug/ProfilesTab.tsx +0 -238
- package/src/components/debug/ReplayTab.tsx +0 -70
- package/src/components/debug/StoresTab.tsx +0 -255
- package/src/components/debug/TopologyTab.tsx +0 -59
- package/src/components/debug/debugConfig.tsx +0 -66
- package/src/components/playground/DebugPanel.tsx +0 -112
- package/src/components/playground/HeaderCenterControls.tsx +0 -92
- package/src/components/playground/KeyframeListItem.tsx +0 -70
- package/src/components/playground/PlaygroundAppSidebar.tsx +0 -171
- package/src/components/playground/PlaygroundBottomControls.tsx +0 -132
- package/src/components/playground/PlaygroundCanvas.tsx +0 -87
- package/src/components/playground/PlaygroundChat.tsx +0 -236
- package/src/components/playground/PlaygroundErrorBoundary.tsx +0 -63
- package/src/components/playground/PlaygroundFloatingInput.tsx +0 -352
- package/src/components/playground/PlaygroundHeader.tsx +0 -222
- package/src/components/playground/PlaygroundSidebar.tsx +0 -136
- package/src/components/playground/PlaygroundTerminal.tsx +0 -44
- package/src/components/playground/SuggestionCards.tsx +0 -29
- package/src/components/playground/demos/ClinicaAINode.tsx +0 -221
- package/src/components/playground/demos/FinanceAINode.tsx +0 -226
- package/src/components/playground/demos/KiaAcademyNode.tsx +0 -250
- package/src/components/playground/demos/KiaBotNode.tsx +0 -207
- package/src/components/playground/demos/KiaCampaignNode.tsx +0 -191
- package/src/components/playground/demos/KiaComplianceNode.tsx +0 -140
- package/src/components/playground/demos/KiaCustomerJourneyNode.tsx +0 -220
- package/src/components/playground/demos/KiaCyberNode.tsx +0 -203
- package/src/components/playground/demos/KiaDashboardNode.tsx +0 -399
- package/src/components/playground/demos/KiaEmbudoOverviewNode.tsx +0 -168
- package/src/components/playground/demos/KiaExecutiveNode.tsx +0 -169
- package/src/components/playground/demos/KiaGamificationNode.tsx +0 -229
- package/src/components/playground/demos/KiaIntelligenceHubNode.tsx +0 -165
- package/src/components/playground/demos/KiaInventoryNode.tsx +0 -183
- package/src/components/playground/demos/KiaLeadScoringNode.tsx +0 -226
- package/src/components/playground/demos/KiaLiveSimulationNode.tsx +0 -177
- package/src/components/playground/demos/KiaMultiDealerNode.tsx +0 -223
- package/src/components/playground/demos/KiaNPSVoiceNode.tsx +0 -214
- package/src/components/playground/demos/KiaOmnichannelNode.tsx +0 -162
- package/src/components/playground/demos/KiaPBIBudgetNode.tsx +0 -152
- package/src/components/playground/demos/KiaPBIConversionNode.tsx +0 -206
- package/src/components/playground/demos/KiaPBIFunnelNode.tsx +0 -184
- package/src/components/playground/demos/KiaPBIOwnershipNode.tsx +0 -113
- package/src/components/playground/demos/KiaPBIPartnerNode.tsx +0 -143
- package/src/components/playground/demos/KiaPBIPreciosNode.tsx +0 -120
- package/src/components/playground/demos/KiaPBIRuntNode.tsx +0 -205
- package/src/components/playground/demos/KiaPartnerScoreNode.tsx +0 -206
- package/src/components/playground/demos/KiaPredictiveNode.tsx +0 -226
- package/src/components/playground/demos/KiaShowroomNode.tsx +0 -194
- package/src/components/playground/demos/KiaStoreNode.tsx +0 -215
- package/src/components/playground/demos/KiaSustainabilityNode.tsx +0 -173
- package/src/components/playground/demos/KiaUsedVehiclesNode.tsx +0 -163
- package/src/components/playground/demos/KiaWorkshopNode.tsx +0 -221
- package/src/components/playground/demos/SmartCityNode.tsx +0 -205
- package/src/components/playground/demos/kia_campaign_manifest.json +0 -112
- package/src/components/playground/input-parts/AIModelSelector.tsx +0 -156
- package/src/components/playground/input-parts/InputActions.tsx +0 -80
- package/src/components/playground/input-parts/InputToolbar.tsx +0 -245
- package/src/components/playground/input-parts/ResourceLibraryPanel.tsx +0 -287
- package/src/components/playground/sidebarDsdIO.ts +0 -82
- package/src/components/settings/SettingsPanel.tsx +0 -267
- package/src/components/shell/AppHeader.tsx +0 -9
- package/src/components/shell/AppShell.tsx +0 -139
- package/src/components/shell/ArtifactBar.tsx +0 -97
- package/src/components/shell/BootScreen.tsx +0 -19
- package/src/components/shell/CenterComposite.tsx +0 -87
- package/src/components/shell/CodeEditorPanel.tsx +0 -88
- package/src/components/shell/GlobalOverlays.tsx +0 -228
- package/src/components/shell/LayoutConfigurator.tsx +0 -209
- package/src/components/shell/LayoutGrid.tsx +0 -178
- package/src/components/shell/MorphShell.tsx +0 -368
- package/src/components/shell/PluginViewer.tsx +0 -147
- package/src/components/shell/ShellNexusPreview.tsx +0 -458
- package/src/components/shell/SlotRenderer.tsx +0 -115
- package/src/components/shell/TabBar.tsx +0 -94
- package/src/components/shell/TemplateLibrary.tsx +0 -195
- package/src/components/shell/layoutConstants.ts +0 -35
- package/src/components/shell/morphStageMeta.ts +0 -15
- package/src/components/shell/shells/BuiltInShells.tsx +0 -443
- package/src/components/shell/shells/DatawayChatShell.tsx +0 -42
- package/src/components/shell/shells/TokenPreview.tsx +0 -339
- package/src/components/shell/shells/bootShells.ts +0 -31
- package/src/components/shells/CreatorShell.tsx +0 -37
- package/src/components/shells/DecidoShell.tsx +0 -447
- package/src/components/shells/ExperimentalChatShell.tsx +0 -245
- package/src/components/shells/UserCanvas.tsx +0 -44
- package/src/components/studio/BlueprintManagerPanel.tsx +0 -137
- package/src/components/studio/DependencyTreePanel.tsx +0 -192
- package/src/components/studio/NodePalette.tsx +0 -92
- package/src/components/studio/NodePropertiesPanel.tsx +0 -81
- package/src/components/studio/ReactFlowEditor.tsx +0 -242
- package/src/components/studio/TimelineEditor.tsx +0 -122
- package/src/components/studio/TimelineKeyframeCard.tsx +0 -99
- package/src/components/studio/VariablePanel.tsx +0 -181
- package/src/components/studio/blueprint/BlueprintCard.tsx +0 -82
- package/src/components/studio/editor/CanvasContextMenu.tsx +0 -107
- package/src/components/studio/editor/EditorToolbar.tsx +0 -80
- package/src/components/studio/editor/StageContentRenderer.tsx +0 -134
- package/src/components/studio/editor/TrackPropertyEditors.tsx +0 -133
- package/src/components/studio/editor/TreeNodeItem.tsx +0 -91
- package/src/components/studio/editor/edgeStyles.ts +0 -43
- package/src/components/studio/editor/editorKeyHandler.ts +0 -95
- package/src/components/studio/editor/nodeTypeRegistry.ts +0 -137
- package/src/components/studio/editor/paletteCatalog.tsx +0 -84
- package/src/components/studio/nodes/shell/InteractionNodes.tsx +0 -82
- package/src/components/studio/nodes/shell/LayoutControlNodes.tsx +0 -69
- package/src/components/studio/nodes/shell/RegisterActionNode.tsx +0 -20
- package/src/components/studio/nodes/shell/RegisterButtonNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterPanelNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterSidebarNode.tsx +0 -19
- package/src/components/studio/nodes/shell/RegisterStatusBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/RegisterTabNode.tsx +0 -21
- package/src/components/studio/nodes/shell/RegisterTopBarNode.tsx +0 -22
- package/src/components/studio/nodes/shell/ShellConfigNode.tsx +0 -51
- package/src/components/studio/nodes/shell/ShellNodeBase.tsx +0 -100
- package/src/components/studio/nodes/shell/ThemeNodes.tsx +0 -51
- package/src/components/studio/nodes/shell/index.ts +0 -12
- package/src/components/widgets/BroadcastWidget.tsx +0 -93
- package/src/components/widgets/MarketplaceWidget.tsx +0 -298
- package/src/components/widgets/McpToolsWidget.tsx +0 -231
- package/src/components/widgets/OpsDashboard.tsx +0 -59
- package/src/components/widgets/QuickActionsWidget.tsx +0 -60
- package/src/components/widgets/UsageWidget.tsx +0 -112
- package/src/components/widgets/WidgetRenderer.tsx +0 -892
- package/src/components/widgets/WidgetSlotPanel.tsx +0 -213
- package/src/config/IconRegistry.ts +0 -126
- package/src/contexts/NetworkProvider.tsx +0 -162
- package/src/core/AIDirector.ts +0 -71
- package/src/core/EventBus.ts +0 -37
- package/src/core/PluginContext.tsx +0 -141
- package/src/hooks/listeners/useUIStateListener.ts +0 -59
- package/src/hooks/listeners/useWhatsAppListener.ts +0 -110
- package/src/hooks/morphBridge.ts +0 -82
- package/src/hooks/useAIModelSelector.ts +0 -144
- package/src/hooks/useAgentStream.ts +0 -220
- package/src/hooks/useAutoUpdater.ts +0 -89
- package/src/hooks/useBootSequence.ts +0 -20
- package/src/hooks/useExportDSD.ts +0 -53
- package/src/hooks/useFullscreen.ts +0 -35
- package/src/hooks/useGeminiStream.ts +0 -282
- package/src/hooks/useIntentLens.ts +0 -224
- package/src/hooks/useKeyboardShortcuts.ts +0 -69
- package/src/hooks/useLoggerBridge.ts +0 -32
- package/src/hooks/useMcpClient.ts +0 -112
- package/src/hooks/useNexusaiDeploy.ts +0 -118
- package/src/hooks/usePlaybackEngine.ts +0 -21
- package/src/hooks/usePlaygroundCommander.ts +0 -475
- package/src/hooks/usePluginEngine.ts +0 -165
- package/src/hooks/useScreenRecorder.ts +0 -73
- package/src/hooks/useShellKeyboard.ts +0 -40
- package/src/hooks/useShellShortcuts.ts +0 -118
- package/src/hooks/useSoundEffects.ts +0 -35
- package/src/hooks/useStudioConfig.ts +0 -72
- package/src/hooks/useSystemBoot.ts +0 -84
- package/src/hooks/useSystemTelemetry.ts +0 -62
- package/src/lib/debugLogger.ts +0 -80
- package/src/lib/networkInterceptor.ts +0 -100
- package/src/mocks/decido.tsx +0 -41
- package/src/plugins/pluginAPI.ts +0 -190
- package/src/store/McpStore.ts +0 -69
- package/src/store/UpdaterStore.ts +0 -60
- package/src/store/engine.ts +0 -392
- package/src/store/index.ts +0 -4
- package/src/store/layoutPresets.ts +0 -66
- package/src/store/playgroundTypes.ts +0 -98
- package/src/store/useActionTimelineStore.ts +0 -48
- package/src/store/useDebugPanelStore.ts +0 -98
- package/src/store/useDebugProfileStore.ts +0 -130
- package/src/store/useLayoutStore.ts +0 -205
- package/src/store/useMorphInstanceStore.ts +0 -289
- package/src/store/useMorphologyStore.ts +0 -103
- package/src/store/usePlaygroundStore.ts +0 -236
- package/src/store/useShellRegistry.ts +0 -123
- package/src/store/useSuggestionsStore.ts +0 -57
- package/src/store/useThemeStore.ts +0 -399
- package/src/store/useUIComponentStore.ts +0 -179
- package/src/types/DecidoStoryDefinition.ts +0 -43
- package/src/utils/ai/ai-architect.ts +0 -92
- package/src/utils/ai/ai-code.ts +0 -187
- package/src/utils/ai/ai-core.ts +0 -50
- package/src/utils/ai/ai-media.ts +0 -292
- package/src/utils/layoutGraph.ts +0 -67
- package/tsconfig.json +0 -17
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
|
|
3
|
-
export type LogLevel = 'info' | 'warn' | 'error' | 'debug';
|
|
4
|
-
export type DebugTab = 'logs' | 'flow-health' | 'topology' | 'replay' | 'stores' | 'morph-stack' | 'network' | 'profiles' | 'timeline' | 'performance' | 'export' | 'css-inspector';
|
|
5
|
-
|
|
6
|
-
export interface DebugLogEntry {
|
|
7
|
-
id: number;
|
|
8
|
-
timestamp: string;
|
|
9
|
-
level: LogLevel;
|
|
10
|
-
categories: string[];
|
|
11
|
-
message: string;
|
|
12
|
-
data?: any;
|
|
13
|
-
source?: { fileName: string; line: string };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
interface LogFilters {
|
|
17
|
-
levels: Set<LogLevel>;
|
|
18
|
-
categories: Set<string>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface DebugPanelState {
|
|
22
|
-
isOpen: boolean;
|
|
23
|
-
activeTab: DebugTab;
|
|
24
|
-
logEntries: DebugLogEntry[];
|
|
25
|
-
logFilters: LogFilters;
|
|
26
|
-
allCategories: Set<string>;
|
|
27
|
-
errorCount: number;
|
|
28
|
-
|
|
29
|
-
// Actions
|
|
30
|
-
togglePanel: () => void;
|
|
31
|
-
setOpen: (open: boolean) => void;
|
|
32
|
-
setActiveTab: (tab: DebugTab) => void;
|
|
33
|
-
addLogEntry: (entry: Omit<DebugLogEntry, 'id'>) => void;
|
|
34
|
-
clearLogs: () => void;
|
|
35
|
-
toggleLevel: (level: LogLevel) => void;
|
|
36
|
-
toggleCategory: (category: string) => void;
|
|
37
|
-
resetFilters: () => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const MAX_LOG_ENTRIES = 500;
|
|
41
|
-
let _logId = 0;
|
|
42
|
-
|
|
43
|
-
export const useDebugPanelStore = create<DebugPanelState>((set, get) => ({
|
|
44
|
-
isOpen: false,
|
|
45
|
-
activeTab: 'logs',
|
|
46
|
-
logEntries: [],
|
|
47
|
-
logFilters: {
|
|
48
|
-
levels: new Set<LogLevel>(['info', 'warn', 'error', 'debug']),
|
|
49
|
-
categories: new Set<string>(),
|
|
50
|
-
},
|
|
51
|
-
allCategories: new Set<string>(),
|
|
52
|
-
errorCount: 0,
|
|
53
|
-
|
|
54
|
-
togglePanel: () => set(s => ({ isOpen: !s.isOpen })),
|
|
55
|
-
setOpen: (open) => set({ isOpen: open }),
|
|
56
|
-
setActiveTab: (tab) => set({ activeTab: tab }),
|
|
57
|
-
|
|
58
|
-
addLogEntry: (entry) => {
|
|
59
|
-
const id = ++_logId;
|
|
60
|
-
const newEntry: DebugLogEntry = { ...entry, id };
|
|
61
|
-
set(s => {
|
|
62
|
-
const entries = [...s.logEntries, newEntry];
|
|
63
|
-
if (entries.length > MAX_LOG_ENTRIES) entries.splice(0, entries.length - MAX_LOG_ENTRIES);
|
|
64
|
-
|
|
65
|
-
const allCats = new Set(s.allCategories);
|
|
66
|
-
entry.categories.forEach(c => allCats.add(c));
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
logEntries: entries,
|
|
70
|
-
allCategories: allCats,
|
|
71
|
-
errorCount: entry.level === 'error' ? s.errorCount + 1 : s.errorCount,
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
clearLogs: () => set({ logEntries: [], errorCount: 0 }),
|
|
77
|
-
|
|
78
|
-
toggleLevel: (level) => set(s => {
|
|
79
|
-
const levels = new Set(s.logFilters.levels);
|
|
80
|
-
if (levels.has(level)) levels.delete(level);
|
|
81
|
-
else levels.add(level);
|
|
82
|
-
return { logFilters: { ...s.logFilters, levels } };
|
|
83
|
-
}),
|
|
84
|
-
|
|
85
|
-
toggleCategory: (category) => set(s => {
|
|
86
|
-
const categories = new Set(s.logFilters.categories);
|
|
87
|
-
if (categories.has(category)) categories.delete(category);
|
|
88
|
-
else categories.add(category);
|
|
89
|
-
return { logFilters: { ...s.logFilters, categories } };
|
|
90
|
-
}),
|
|
91
|
-
|
|
92
|
-
resetFilters: () => set({
|
|
93
|
-
logFilters: {
|
|
94
|
-
levels: new Set<LogLevel>(['info', 'warn', 'error', 'debug']),
|
|
95
|
-
categories: new Set<string>(),
|
|
96
|
-
}
|
|
97
|
-
}),
|
|
98
|
-
}));
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* useDebugProfileStore — Persistent debug profiles with watch list, quick actions, log filters.
|
|
3
|
-
* Sprint AQ: Allows creating custom debugging views.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { create } from 'zustand';
|
|
7
|
-
import { persist } from 'zustand/middleware';
|
|
8
|
-
import type { LogLevel } from './useDebugPanelStore';
|
|
9
|
-
|
|
10
|
-
export interface WatchEntry {
|
|
11
|
-
/** Store name (e.g. 'Morphology') */
|
|
12
|
-
storeName: string;
|
|
13
|
-
/** Property path (e.g. 'activeStage.type') */
|
|
14
|
-
path: string;
|
|
15
|
-
/** Friendly label */
|
|
16
|
-
label?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface PinnedAction {
|
|
20
|
-
storeName: string;
|
|
21
|
-
actionName: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface DebugProfile {
|
|
25
|
-
id: string;
|
|
26
|
-
name: string;
|
|
27
|
-
watchList: WatchEntry[];
|
|
28
|
-
pinnedActions: PinnedAction[];
|
|
29
|
-
logCategories: string[];
|
|
30
|
-
logLevels: LogLevel[];
|
|
31
|
-
notes: string;
|
|
32
|
-
createdAt: number;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface DebugProfileState {
|
|
36
|
-
profiles: DebugProfile[];
|
|
37
|
-
activeProfileId: string | null;
|
|
38
|
-
|
|
39
|
-
createProfile: (name: string) => void;
|
|
40
|
-
updateProfile: (id: string, partial: Partial<DebugProfile>) => void;
|
|
41
|
-
deleteProfile: (id: string) => void;
|
|
42
|
-
activateProfile: (id: string | null) => void;
|
|
43
|
-
getActiveProfile: () => DebugProfile | undefined;
|
|
44
|
-
|
|
45
|
-
// Watch list helpers
|
|
46
|
-
addWatch: (profileId: string, entry: WatchEntry) => void;
|
|
47
|
-
removeWatch: (profileId: string, index: number) => void;
|
|
48
|
-
|
|
49
|
-
// Pinned action helpers
|
|
50
|
-
addPinnedAction: (profileId: string, action: PinnedAction) => void;
|
|
51
|
-
removePinnedAction: (profileId: string, index: number) => void;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const useDebugProfileStore = create<DebugProfileState>()(
|
|
55
|
-
persist(
|
|
56
|
-
(set, get) => ({
|
|
57
|
-
profiles: [],
|
|
58
|
-
activeProfileId: null,
|
|
59
|
-
|
|
60
|
-
createProfile: (name) => {
|
|
61
|
-
const profile: DebugProfile = {
|
|
62
|
-
id: Date.now().toString(36),
|
|
63
|
-
name,
|
|
64
|
-
watchList: [],
|
|
65
|
-
pinnedActions: [],
|
|
66
|
-
logCategories: [],
|
|
67
|
-
logLevels: ['info', 'warn', 'error', 'debug'],
|
|
68
|
-
notes: '',
|
|
69
|
-
createdAt: Date.now(),
|
|
70
|
-
};
|
|
71
|
-
set(s => ({ profiles: [...s.profiles, profile], activeProfileId: profile.id }));
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
updateProfile: (id, partial) => {
|
|
75
|
-
set(s => ({
|
|
76
|
-
profiles: s.profiles.map(p => p.id === id ? { ...p, ...partial } : p),
|
|
77
|
-
}));
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
deleteProfile: (id) => {
|
|
81
|
-
set(s => ({
|
|
82
|
-
profiles: s.profiles.filter(p => p.id !== id),
|
|
83
|
-
activeProfileId: s.activeProfileId === id ? null : s.activeProfileId,
|
|
84
|
-
}));
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
activateProfile: (id) => set({ activeProfileId: id }),
|
|
88
|
-
|
|
89
|
-
getActiveProfile: () => {
|
|
90
|
-
const { profiles, activeProfileId } = get();
|
|
91
|
-
return profiles.find(p => p.id === activeProfileId);
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
addWatch: (profileId, entry) => {
|
|
95
|
-
set(s => ({
|
|
96
|
-
profiles: s.profiles.map(p =>
|
|
97
|
-
p.id === profileId ? { ...p, watchList: [...p.watchList, entry] } : p
|
|
98
|
-
),
|
|
99
|
-
}));
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
removeWatch: (profileId, index) => {
|
|
103
|
-
set(s => ({
|
|
104
|
-
profiles: s.profiles.map(p =>
|
|
105
|
-
p.id === profileId ? { ...p, watchList: p.watchList.filter((_, i) => i !== index) } : p
|
|
106
|
-
),
|
|
107
|
-
}));
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
addPinnedAction: (profileId, action) => {
|
|
111
|
-
set(s => ({
|
|
112
|
-
profiles: s.profiles.map(p =>
|
|
113
|
-
p.id === profileId ? { ...p, pinnedActions: [...p.pinnedActions, action] } : p
|
|
114
|
-
),
|
|
115
|
-
}));
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
removePinnedAction: (profileId, index) => {
|
|
119
|
-
set(s => ({
|
|
120
|
-
profiles: s.profiles.map(p =>
|
|
121
|
-
p.id === profileId ? { ...p, pinnedActions: p.pinnedActions.filter((_, i) => i !== index) } : p
|
|
122
|
-
),
|
|
123
|
-
}));
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
{
|
|
127
|
-
name: 'decido-debug-profiles-v1',
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
);
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { persist, createJSONStorage, StateStorage } from 'zustand/middleware';
|
|
3
|
-
import { get, set as idbSet, del } from 'idb-keyval';
|
|
4
|
-
import { BUILT_IN_PRESETS } from './layoutPresets';
|
|
5
|
-
import { dlog } from '../lib/debugLogger';
|
|
6
|
-
|
|
7
|
-
// Re-export all types for backward compat
|
|
8
|
-
export type { SlotComponentId, RegionId, MorphStageType, MorphStage, LayoutTab, LayoutPreset } from './layoutPresets';
|
|
9
|
-
export { BUILT_IN_PRESETS } from './layoutPresets';
|
|
10
|
-
import type { SlotComponentId, RegionId, MorphStage, LayoutTab, LayoutPreset } from './layoutPresets';
|
|
11
|
-
|
|
12
|
-
// ── IDB Storage ──
|
|
13
|
-
const idbStorage: StateStorage = {
|
|
14
|
-
getItem: async (name: string): Promise<string | null> => (await get(name)) || null,
|
|
15
|
-
setItem: async (name: string, value: string): Promise<void> => { await idbSet(name, value); },
|
|
16
|
-
removeItem: async (name: string): Promise<void> => { await del(name); },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// ── State Interface ──
|
|
20
|
-
|
|
21
|
-
interface LayoutState {
|
|
22
|
-
// ── Slot assignment ──
|
|
23
|
-
slots: Record<RegionId, SlotComponentId>;
|
|
24
|
-
setSlot: (region: RegionId, componentId: SlotComponentId) => void;
|
|
25
|
-
swapSlots: (r1: RegionId, r2: RegionId) => void;
|
|
26
|
-
resetLayout: (preset: string) => void;
|
|
27
|
-
|
|
28
|
-
// ── UI toggles (absorbed from usePlaygroundStore) ──
|
|
29
|
-
isCreatorMode: boolean;
|
|
30
|
-
setIsCreatorMode: (val: boolean) => void;
|
|
31
|
-
showCanvas: boolean;
|
|
32
|
-
setShowCanvas: (val: boolean) => void;
|
|
33
|
-
showChat: boolean;
|
|
34
|
-
setShowChat: (val: boolean) => void;
|
|
35
|
-
isSidebarOpen: boolean;
|
|
36
|
-
setIsSidebarOpen: (val: boolean) => void;
|
|
37
|
-
isImmersive: boolean;
|
|
38
|
-
setIsImmersive: (val: boolean) => void;
|
|
39
|
-
|
|
40
|
-
// ── Morph stages (absorbed from useMorphologyStore) ──
|
|
41
|
-
activeStage: MorphStage | null;
|
|
42
|
-
stageHistory: MorphStage[];
|
|
43
|
-
setStage: (stage: MorphStage | null) => void;
|
|
44
|
-
pushStage: (stage: MorphStage) => void;
|
|
45
|
-
popStage: () => void;
|
|
46
|
-
clearStages: () => void;
|
|
47
|
-
|
|
48
|
-
// ── T2 Tabs ──
|
|
49
|
-
tabs: LayoutTab[];
|
|
50
|
-
activeTabId: string | null;
|
|
51
|
-
addTab: (tab: LayoutTab) => void;
|
|
52
|
-
removeTab: (tabId: string) => void;
|
|
53
|
-
setActiveTab: (tabId: string) => void;
|
|
54
|
-
|
|
55
|
-
// ── Presets ──
|
|
56
|
-
savedPresets: LayoutPreset[];
|
|
57
|
-
savePreset: (name: string) => void;
|
|
58
|
-
loadPreset: (presetId: string) => void;
|
|
59
|
-
deletePreset: (presetId: string) => void;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const useLayoutStore = create<LayoutState>()(
|
|
63
|
-
persist(
|
|
64
|
-
(set, get) => ({
|
|
65
|
-
// ── Slot assignment ──
|
|
66
|
-
slots: { ...BUILT_IN_PRESETS['player'] },
|
|
67
|
-
|
|
68
|
-
setSlot: (region, componentId) =>
|
|
69
|
-
set((s) => ({ slots: { ...s.slots, [region]: componentId } })),
|
|
70
|
-
|
|
71
|
-
swapSlots: (r1, r2) =>
|
|
72
|
-
set((s) => ({
|
|
73
|
-
slots: { ...s.slots, [r1]: s.slots[r2], [r2]: s.slots[r1] }
|
|
74
|
-
})),
|
|
75
|
-
|
|
76
|
-
resetLayout: (preset) => {
|
|
77
|
-
const p = BUILT_IN_PRESETS[preset];
|
|
78
|
-
if (p) set({ slots: { ...p } });
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
// ── UI toggles ──
|
|
82
|
-
isCreatorMode: false,
|
|
83
|
-
setIsCreatorMode: (val) => {
|
|
84
|
-
set({ isCreatorMode: val });
|
|
85
|
-
// Auto-switch layout preset when toggling mode
|
|
86
|
-
const preset = val ? BUILT_IN_PRESETS['creator'] : BUILT_IN_PRESETS['player'];
|
|
87
|
-
set({ slots: { ...preset } });
|
|
88
|
-
},
|
|
89
|
-
showCanvas: false,
|
|
90
|
-
setShowCanvas: (val) => set({ showCanvas: val }),
|
|
91
|
-
showChat: true,
|
|
92
|
-
setShowChat: (val) => set({ showChat: val }),
|
|
93
|
-
isSidebarOpen: false,
|
|
94
|
-
setIsSidebarOpen: (val) => set({ isSidebarOpen: val }),
|
|
95
|
-
isImmersive: false,
|
|
96
|
-
setIsImmersive: (val) => set({ isImmersive: val }),
|
|
97
|
-
|
|
98
|
-
// ── Morph stages ──
|
|
99
|
-
activeStage: null,
|
|
100
|
-
stageHistory: [],
|
|
101
|
-
|
|
102
|
-
setStage: (stage) => {
|
|
103
|
-
dlog.layout(`setStage → ${stage?.type || 'null'}`, stage);
|
|
104
|
-
set({ activeStage: stage });
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
pushStage: (stage) => {
|
|
108
|
-
const { activeStage, stageHistory } = get();
|
|
109
|
-
dlog.layout(`pushStage → ${stage.type}${stage.label ? ` (${stage.label})` : ''} | depth: ${stageHistory.length + 1}`, { stage, previousStage: activeStage?.type });
|
|
110
|
-
const newHistory = activeStage
|
|
111
|
-
? [...stageHistory, activeStage]
|
|
112
|
-
: stageHistory;
|
|
113
|
-
set({ activeStage: stage, stageHistory: newHistory });
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
popStage: () => {
|
|
117
|
-
const { stageHistory, activeStage } = get();
|
|
118
|
-
if (stageHistory.length === 0) {
|
|
119
|
-
dlog.layout('popStage → null (history empty)', { poppedStage: activeStage?.type }, 'warn');
|
|
120
|
-
set({ activeStage: null });
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
const prev = stageHistory[stageHistory.length - 1];
|
|
124
|
-
dlog.layout(`popStage → ${prev.type}${prev.label ? ` (${prev.label})` : ''} | depth: ${stageHistory.length - 1}`, { poppedStage: activeStage?.type, restoredStage: prev.type });
|
|
125
|
-
set({
|
|
126
|
-
activeStage: prev,
|
|
127
|
-
stageHistory: stageHistory.slice(0, -1),
|
|
128
|
-
});
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
clearStages: () => {
|
|
132
|
-
dlog.layout('clearStages → all cleared', { previousDepth: get().stageHistory.length });
|
|
133
|
-
set({ activeStage: null, stageHistory: [] });
|
|
134
|
-
},
|
|
135
|
-
|
|
136
|
-
// ── T2 Tabs ──
|
|
137
|
-
tabs: [],
|
|
138
|
-
activeTabId: null,
|
|
139
|
-
|
|
140
|
-
addTab: (tab) => {
|
|
141
|
-
const { tabs } = get();
|
|
142
|
-
// Don't add duplicate tabs
|
|
143
|
-
if (tabs.some((t) => t.id === tab.id)) {
|
|
144
|
-
set({ activeTabId: tab.id });
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
set({ tabs: [...tabs, tab], activeTabId: tab.id });
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
removeTab: (tabId) => {
|
|
151
|
-
const { tabs, activeTabId } = get();
|
|
152
|
-
const newTabs = tabs.filter((t) => t.id !== tabId);
|
|
153
|
-
const newActive =
|
|
154
|
-
activeTabId === tabId
|
|
155
|
-
? newTabs.length > 0
|
|
156
|
-
? newTabs[newTabs.length - 1].id
|
|
157
|
-
: null
|
|
158
|
-
: activeTabId;
|
|
159
|
-
set({ tabs: newTabs, activeTabId: newActive });
|
|
160
|
-
},
|
|
161
|
-
|
|
162
|
-
setActiveTab: (tabId) => set({ activeTabId: tabId }),
|
|
163
|
-
|
|
164
|
-
// ── Presets ──
|
|
165
|
-
savedPresets: [],
|
|
166
|
-
|
|
167
|
-
savePreset: (name) => {
|
|
168
|
-
const { slots, savedPresets } = get();
|
|
169
|
-
const preset: LayoutPreset = {
|
|
170
|
-
id: Date.now().toString(36),
|
|
171
|
-
name,
|
|
172
|
-
slots: { ...slots },
|
|
173
|
-
createdAt: Date.now(),
|
|
174
|
-
};
|
|
175
|
-
set({ savedPresets: [...savedPresets, preset] });
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
loadPreset: (presetId) => {
|
|
179
|
-
const { savedPresets } = get();
|
|
180
|
-
const preset = savedPresets.find((p) => p.id === presetId);
|
|
181
|
-
if (preset) set({ slots: { ...preset.slots } });
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
deletePreset: (presetId) => {
|
|
185
|
-
set((s) => ({
|
|
186
|
-
savedPresets: s.savedPresets.filter((p) => p.id !== presetId),
|
|
187
|
-
}));
|
|
188
|
-
},
|
|
189
|
-
}),
|
|
190
|
-
{
|
|
191
|
-
name: 'decido-layout-v4', // v4 forces eviction to clear corrupted react-resizable-panels flex ratios
|
|
192
|
-
storage: createJSONStorage(() => idbStorage),
|
|
193
|
-
partialize: (state) => ({
|
|
194
|
-
slots: state.slots,
|
|
195
|
-
isCreatorMode: state.isCreatorMode,
|
|
196
|
-
isSidebarOpen: state.isSidebarOpen,
|
|
197
|
-
showCanvas: state.showCanvas,
|
|
198
|
-
showChat: state.showChat,
|
|
199
|
-
tabs: state.tabs,
|
|
200
|
-
activeTabId: state.activeTabId,
|
|
201
|
-
savedPresets: state.savedPresets,
|
|
202
|
-
}),
|
|
203
|
-
}
|
|
204
|
-
)
|
|
205
|
-
);
|