fix: change md files to md folder

This commit is contained in:
2026-07-21 18:22:39 +07:00
parent 20bf2bd5d8
commit d5143b440a
34 changed files with 6962 additions and 0 deletions
@@ -0,0 +1,58 @@
// SonicForge Studio - DAW Command Dispatcher
// Command Pattern & Undo/Redo Engine (28_AI_PANEL.md §1 & §2)
const DAWCommandDispatcher = (function() {
const MAX_HISTORY = 50;
const history = [];
let historyIndex = -1;
function pushHistory(entry) {
history.push(entry);
if (history.length > MAX_HISTORY) history.shift();
historyIndex = history.length - 1;
}
function undo() {
if (historyIndex < 0) return null;
const entry = history[historyIndex];
historyIndex--;
return entry;
}
function redo() {
if (historyIndex >= history.length - 1) return null;
historyIndex++;
const entry = history[historyIndex];
return entry;
}
function canUndo() { return historyIndex >= 0; }
function canRedo() { return historyIndex < history.length - 1; }
const registry = {};
function register(name, handler) {
registry[name] = handler;
}
function execute(name, args) {
if (!registry[name]) {
return { success: false, error: `Unknown command: ${name}` };
}
return registry[name](args);
}
return {
register,
execute,
undo,
redo,
canUndo,
canRedo,
pushHistory,
get history() { return history; },
get historyIndex() { return historyIndex; }
};
})();
window.DAWCommandDispatcher = DAWCommandDispatcher;