Initial commit — Meridian OS browser desktop demo

This commit is contained in:
2026-04-19 23:18:55 +00:00
commit 8e30dd3597
30 changed files with 6277 additions and 0 deletions

167
js/apps/chrome.js Normal file
View File

@@ -0,0 +1,167 @@
// Chrome spoof — static-but-believable browser UI.
const TABS = [
{ title: 'New Tab', active: true },
{ title: 'Meridian Docs', active: false },
{ title: 'Search', active: false },
];
const SHORTCUTS = [
{ label: 'GitHub', url: 'https://github.com' },
{ label: 'Gmail', url: 'https://mail.google.com' },
{ label: 'YouTube', url: 'https://youtube.com' },
{ label: 'Maps', url: 'https://maps.google.com' },
{ label: 'Drive', url: 'https://drive.google.com' },
{ label: 'Calendar', url: 'https://calendar.google.com' },
{ label: 'Docs', url: 'https://docs.google.com' },
{ label: 'Translate', url: 'https://translate.google.com' },
];
export default {
id: 'chrome',
title: 'Chrome',
render(container, api) {
let activeTab = 0;
let navUrl = '';
const root = document.createElement('div');
root.style.cssText = 'height:100%;display:flex;flex-direction:column;background:var(--bg-1);';
// Tab strip
const tabStrip = document.createElement('div');
tabStrip.style.cssText = 'display:flex;background:var(--bg-2);border-bottom:1px solid var(--border);flex-shrink:0;overflow-x:auto;';
// New tab button
const newTabBtn = document.createElement('button');
newTabBtn.style.cssText = 'padding:8px 12px;font-size:16px;border:none;background:transparent;color:var(--text-dim);cursor:pointer;flex-shrink:0;';
newTabBtn.textContent = '+';
newTabBtn.addEventListener('click', () => {
const newIdx = TABS.length;
TABS.push({ title: 'New Tab', active: true });
TABS.forEach((t) => { t.active = false; });
TABS[newIdx].active = true;
activeTab = newIdx;
navUrl = '';
updateTabBar();
updateBody();
});
function updateTabBar() {
tabStrip.innerHTML = '';
TABS.forEach((tab, i) => {
const btn = document.createElement('button');
btn.style.cssText = 'padding:8px 16px;font-size:12px;border:none;background:transparent;color:' + (tab.active ? 'var(--text)' : 'var(--text-dim)') + ';border-right:1px solid var(--border);cursor:pointer;transition:color 150ms;max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;';
btn.textContent = tab.title;
btn.addEventListener('click', () => {
activeTab = i;
navUrl = SHORTCUTS[i] ? SHORTCUTS[i].url : '';
updateTabBar();
updateBody();
});
tabStrip.appendChild(btn);
});
tabStrip.appendChild(newTabBtn);
}
updateTabBar();
root.appendChild(tabStrip);
// Address bar
const addrBar = document.createElement('div');
addrBar.style.cssText = 'display:flex;align-items:center;padding:6px 12px;gap:8px;background:var(--bg-2);border-bottom:1px solid var(--border);flex-shrink:0;';
const urlInput = document.createElement('input');
urlInput.type = 'text';
urlInput.value = navUrl || (SHORTCUTS[activeTab] ? SHORTCUTS[activeTab].url : '');
urlInput.style.cssText = 'flex:1;padding:6px 12px;background:var(--bg-3);border:1px solid var(--border);border-radius:20px;color:var(--text);font-size:13px;outline:none;';
urlInput.placeholder = 'Search or enter web address';
urlInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
const val = urlInput.value.trim();
if (val) {
navUrl = val;
updateBody();
}
}
});
const reloadBtn = document.createElement('button');
reloadBtn.style.cssText = 'padding:4px 8px;background:transparent;border:none;color:var(--text-dim);cursor:pointer;font-size:14px;';
reloadBtn.textContent = '\u{21BB}';
reloadBtn.addEventListener('click', () => { updateBody(); });
addrBar.appendChild(urlInput);
addrBar.appendChild(reloadBtn);
root.appendChild(addrBar);
// Body
const body = document.createElement('div');
body.style.cssText = 'flex:1;overflow-y:auto;padding:40px 20px;background:var(--bg-1);';
function updateBody() {
body.innerHTML = '';
urlInput.value = navUrl || (TABS[activeTab].title === 'New Tab' ? '' : TABS[activeTab].title.toLowerCase().replace(/\s+/g, '-') + '.meridian.dev');
if (activeTab === 0 && !navUrl) {
// New tab page
const titleEl = document.createElement('h2');
titleEl.style.cssText = 'font-size:22px;font-weight:500;color:var(--text);margin-bottom:28px;text-align:center;';
titleEl.textContent = 'Meridian Browser';
body.appendChild(titleEl);
const grid = document.createElement('div');
grid.style.cssText = 'display:grid;grid-template-columns:repeat(4,1fr);gap:12px;max-width:600px;margin:0 auto;';
SHORTCUTS.forEach((sc) => {
const tile = document.createElement('div');
tile.style.cssText = 'padding:16px 12px;background:var(--bg-2);border:1px solid var(--border);border-radius:8px;text-align:center;cursor:pointer;transition:background 150ms;';
tile.addEventListener('mouseenter', () => { tile.style.background = 'var(--bg-3)'; });
tile.addEventListener('mouseleave', () => { tile.style.background = 'var(--bg-2)'; });
tile.addEventListener('click', () => {
navUrl = sc.url;
TABS[0].title = sc.label;
updateTabBar();
updateBody();
});
const tileIcon = document.createElement('div');
tileIcon.style.cssText = 'font-size:18px;font-weight:600;color:var(--accent);margin-bottom:4px;';
tileIcon.textContent = sc.label.charAt(0);
const tileLabel = document.createElement('div');
tileLabel.style.cssText = 'font-size:11px;color:var(--text-dim);';
tileLabel.textContent = sc.label;
tile.appendChild(tileIcon);
tile.appendChild(tileLabel);
grid.appendChild(tile);
});
body.appendChild(grid);
} else {
// Simulated page
const page = document.createElement('div');
page.style.cssText = 'max-width:600px;margin:0 auto;';
const heading = document.createElement('h2');
heading.style.cssText = 'font-size:22px;font-weight:500;color:var(--text);margin-bottom:12px;';
heading.textContent = 'Simulated page for ' + (navUrl || TABS[activeTab].title);
page.appendChild(heading);
const urlDisplay = document.createElement('div');
urlDisplay.style.cssText = 'font-size:12px;color:var(--text-dim);margin-bottom:24px;font-family:monospace;padding:8px 12px;background:var(--bg-2);border:1px solid var(--border);border-radius:4px;';
urlDisplay.textContent = navUrl || TABS[activeTab].title;
page.appendChild(urlDisplay);
const para = document.createElement('p');
para.style.cssText = 'font-size:14px;color:var(--text-dim);line-height:1.7;';
const displayUrl = navUrl || TABS[activeTab].title;
para.textContent = 'This is a simulated page for ' + displayUrl + '. Meridian Browser does not make actual network requests — it is a spoof. Nothing to see here unless you count the aesthetic choices.';
page.appendChild(para);
body.appendChild(page);
}
}
root.appendChild(body);
container.appendChild(root);
updateBody();
},
};

248
js/apps/music.js Normal file
View File

@@ -0,0 +1,248 @@
// Music player — three tracks, play/pause/skip/seek/volume.
const TRACKS = [
{ title: 'Grace Ascent', artist: 'Meridian OST', src: 'https://cdn.pixabay.com/audio/2022/10/18/audio_31c1679d6c.mp3' },
{ title: 'Siege Breaker', artist: 'Meridian OST', src: 'https://cdn.pixabay.com/audio/2022/11/17/audio_febc508520.mp3' },
{ title: 'Final Whistle', artist: 'Meridian OST', src: 'https://cdn.pixabay.com/audio/2023/06/13/audio_2c8e3b31b0.mp3' },
];
export default {
id: 'music',
title: 'Music',
render(container, api) {
const audio = new Audio();
let currentTrack = 0;
let playedSeconds = 0;
let playSecondsTimer = null;
const root = document.createElement('div');
root.style.cssText = 'height:100%;display:flex;overflow:hidden;';
// Left panel: track list
const listPanel = document.createElement('div');
listPanel.style.cssText = 'width:220px;background:var(--bg-2);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow-y:auto;flex-shrink:0;';
const trackList = TRACKS.map((track, i) => {
const row = document.createElement('div');
row.style.cssText = 'padding:10px 14px;cursor:pointer;display:flex;flex-direction:column;border-left:2px solid transparent;border-bottom:1px solid rgba(255,255,255,0.04);transition:all 150ms ease-out;';
const titleSpan = document.createElement('div');
titleSpan.style.cssText = 'font-size:13px;font-weight:500;color:var(--text);';
titleSpan.textContent = track.title;
const artistSpan = document.createElement('div');
artistSpan.style.cssText = 'font-size:11px;color:var(--text-dim);margin-top:2px;';
artistSpan.textContent = track.artist;
row.appendChild(titleSpan);
row.appendChild(artistSpan);
row.addEventListener('click', () => loadTrack(i));
return { row, titleSpan, artistSpan };
});
TRACKS.forEach((_, i) => listPanel.appendChild(trackList[i].row));
// Right panel: now playing
const nowPanel = document.createElement('div');
nowPanel.style.cssText = 'flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:40px 24px;background:var(--bg-1);overflow-y:auto;';
const cover = document.createElement('div');
cover.style.cssText = 'width:120px;height:120px;background:rgba(212,162,76,0.15);border:1px solid rgba(212,162,76,0.2);display:flex;align-items:center;justify-content:center;font-size:48px;font-weight:600;color:var(--accent);margin-bottom:24px;';
const nowTitle = document.createElement('div');
nowTitle.style.cssText = 'font-size:28px;font-weight:600;color:var(--text);margin-bottom:6px;text-align:center;';
const nowArtist = document.createElement('div');
nowArtist.style.cssText = 'font-size:14px;color:var(--text-dim);margin-bottom:32px;text-align:center;';
// Controls row
const controls = document.createElement('div');
controls.style.cssText = 'display:flex;align-items:center;gap:20px;margin-bottom:28px;';
const btnStyle = 'width:40px;height:40px;border-radius:50%;background:var(--bg-3);border:1px solid var(--border);color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:background 150ms ease-out;';
const prevBtn = document.createElement('button');
prevBtn.style.cssText = btnStyle;
prevBtn.textContent = '<<';
prevBtn.addEventListener('click', () => { currentTrack = (currentTrack - 1 + TRACKS.length) % TRACKS.length; loadTrack(currentTrack); });
const playBtn = document.createElement('button');
playBtn.style.cssText = 'width:48px;height:48px;border-radius:50%;background:var(--accent);border:none;color:#0f1114;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:20px;font-weight:700;transition:opacity 150ms ease-out;';
playBtn.textContent = '>';
const nextBtn = document.createElement('button');
nextBtn.style.cssText = btnStyle;
nextBtn.textContent = '>>';
nextBtn.addEventListener('click', () => { currentTrack = (currentTrack + 1) % TRACKS.length; loadTrack(currentTrack); });
controls.appendChild(prevBtn);
controls.appendChild(playBtn);
controls.appendChild(nextBtn);
// Seek bar
const seekContainer = document.createElement('div');
seekContainer.style.cssText = 'width:100%;max-width:400px;margin-bottom:16px;';
const seekLabel = document.createElement('div');
seekLabel.style.cssText = 'font-size:11px;color:var(--text-dim);margin-bottom:4px;display:flex;justify-content:space-between;';
const seekLabelLeft = document.createElement('span');
seekLabelLeft.textContent = '0:00';
const seekLabelRight = document.createElement('span');
seekLabelRight.textContent = '0:00';
seekLabel.appendChild(seekLabelLeft);
seekLabel.appendChild(seekLabelRight);
const seekInput = document.createElement('input');
seekInput.type = 'range';
seekInput.min = '0';
seekInput.max = '100';
seekInput.value = '0';
seekInput.style.cssText = 'width:100%;height:4px;-webkit-appearance:none;appearance:none;background:var(--bg-3);border-radius:2px;outline:none;cursor:pointer;';
seekInput.addEventListener('input', () => {
if (audio.duration) {
audio.currentTime = (seekInput.value / 100) * audio.duration;
}
});
seekContainer.appendChild(seekLabel);
seekContainer.appendChild(seekInput);
// Volume slider
const volContainer = document.createElement('div');
volContainer.style.cssText = 'display:flex;align-items:center;gap:8px;margin-top:12px;';
const volLabel = document.createElement('span');
volLabel.style.cssText = 'font-size:12px;color:var(--text-dim);';
volLabel.textContent = '\u{25A0}\u{25A0}';
const volInput = document.createElement('input');
volInput.type = 'range';
volInput.min = '0';
volInput.max = '100';
volInput.value = '70';
volInput.style.cssText = 'width:100px;height:4px;-webkit-appearance:none;appearance:none;background:var(--bg-3);border-radius:2px;outline:none;cursor:pointer;';
volInput.addEventListener('input', () => {
audio.volume = volInput.value / 100;
});
volContainer.appendChild(volLabel);
volContainer.appendChild(volInput);
nowPanel.appendChild(cover);
nowPanel.appendChild(nowTitle);
nowPanel.appendChild(nowArtist);
nowPanel.appendChild(controls);
nowPanel.appendChild(seekContainer);
nowPanel.appendChild(volContainer);
root.appendChild(listPanel);
root.appendChild(nowPanel);
container.appendChild(root);
function formatTime(s) {
if (!isFinite(s)) return '0:00';
return Math.floor(s / 60) + ':' + String(Math.floor(s % 60)).padStart(2, '0');
}
function updateUI() {
const track = TRACKS[currentTrack];
const urlOk = urlAvailable(track.src);
cover.textContent = track.title.charAt(0);
nowTitle.textContent = track.title;
nowArtist.textContent = track.artist;
playBtn.textContent = audio.paused ? '>' : '||';
// Highlight selected track
TRACKS.forEach((_, i) => {
const row = trackList[i].row;
if (i === currentTrack) {
row.style.borderLeftColor = 'var(--accent)';
row.style.background = 'var(--bg-3)';
} else {
row.style.borderLeftColor = 'transparent';
row.style.background = 'transparent';
}
});
seekLabelLeft.textContent = formatTime(audio.currentTime);
seekLabelRight.textContent = formatTime(audio.duration);
seekInput.value = audio.duration ? (audio.currentTime / audio.duration) * 100 : 0;
}
function loadTrack(index) {
stopPlaySecondsTimer();
currentTrack = index;
const track = TRACKS[index];
if (!urlAvailable(track.src)) {
nowTitle.textContent = track.title;
nowArtist.textContent = 'Track unavailable (offline)';
cover.textContent = track.title.charAt(0);
cover.style.background = 'rgba(150,150,150,0.15)';
playBtn.textContent = '>';
playBtn.disabled = true;
seekInput.value = 0;
seekLabelLeft.textContent = '0:00';
seekLabelRight.textContent = '0:00';
return;
}
cover.style.background = 'rgba(212,162,76,0.15)';
playBtn.disabled = false;
audio.src = track.src;
audio.volume = volInput.value / 100;
audio.load();
updateUI();
}
playBtn.addEventListener('click', () => {
if (playBtn.disabled) return;
if (!audio.src) return;
if (audio.paused) {
audio.play().then(() => {
api.bus.emit('music:play');
updateUI();
}).catch(() => {
updateUI();
});
startPlaySecondsTimer();
} else {
audio.pause();
updateUI();
stopPlaySecondsTimer();
}
});
audio.addEventListener('timeupdate', updateUI);
audio.addEventListener('ended', () => {
currentTrack = (currentTrack + 1) % TRACKS.length;
loadTrack(currentTrack);
audio.play().then(() => {
updateUI();
startPlaySecondsTimer();
}).catch(() => { updateUI(); });
});
audio.addEventListener('error', () => {
nowArtist.textContent = 'Track unavailable (offline)';
playBtn.disabled = true;
updateUI();
stopPlaySecondsTimer();
});
updateUI();
loadTrack(0);
audio.pause();
function urlAvailable(url) {
try {
const u = new URL(url);
return true;
} catch {
return false;
}
}
function startPlaySecondsTimer() {
stopPlaySecondsTimer();
playSecondsTimer = setInterval(() => {
playedSeconds++;
api.bus.emit('music:played', { seconds: playedSeconds });
}, 5000);
}
function stopPlaySecondsTimer() {
clearInterval(playSecondsTimer);
}
},
};

82
js/apps/notepad.js Normal file
View File

@@ -0,0 +1,82 @@
// Notepad app — simple text editor with localStorage persistence.
const uid = () => Date.now().toString(36) + Math.random().toString(36).slice(2, 7);
export default {
id: 'notepad',
title: 'Notepad',
render(container, api) {
const docId = uid();
const storageKey = `meridian:notepad:${docId}`;
let renamed = false;
let saveTimer = null;
// Load saved content
const saved = localStorage.getItem(storageKey);
let docTitle = 'Untitled';
let content = saved !== null ? saved : '';
// Build UI
const toolbar = document.createElement('div');
toolbar.className = 'app-toolbar';
const titleEl = document.createElement('span');
titleEl.className = 'doc-title';
titleEl.textContent = docTitle;
titleEl.title = 'Click to rename';
titleEl.style.cursor = 'pointer';
titleEl.addEventListener('click', () => {
const newName = prompt('Rename document:', titleEl.textContent);
if (newName !== null && newName.trim()) {
docTitle = newName.trim();
titleEl.textContent = docTitle;
renamed = true;
api.setTitle(docTitle);
}
});
const saveBtn = document.createElement('button');
saveBtn.className = 'btn-amber';
saveBtn.textContent = 'Save';
saveBtn.addEventListener('click', () => {
saveContent();
saveBtn.textContent = 'Saved!';
setTimeout(() => { saveBtn.textContent = 'Save'; }, 1200);
});
toolbar.appendChild(titleEl);
toolbar.appendChild(saveBtn);
const textarea = document.createElement('textarea');
textarea.value = content;
const statusbar = document.createElement('div');
statusbar.className = 'app-status';
function updateCounts() {
const text = textarea.value;
const chars = text.length;
const words = text.trim() === '' ? 0 : text.trim().split(/\s+/).length;
statusbar.textContent = `${words} word${words !== 1 ? 's' : ''} · ${chars} character${chars !== 1 ? 's' : ''}`;
}
textarea.addEventListener('input', () => {
updateCounts();
api.bus.emit('text:typed', { chars: textarea.value.length });
// Auto-save after 1s of inactivity
clearTimeout(saveTimer);
saveTimer = setTimeout(saveContent, 1000);
});
function saveContent() {
localStorage.setItem(storageKey, textarea.value);
}
container.style.cssText = 'height:100%;display:flex;flex-direction:column;';
container.appendChild(toolbar);
container.appendChild(textarea);
container.appendChild(statusbar);
updateCounts();
},
};

184
js/apps/postman.js Normal file
View File

@@ -0,0 +1,184 @@
// Postman spoof — static-but-believable HTTP client UI.
const RESPONSES = {
GET: `{
"id": 1,
"name": "Alice Freeman",
"email": "alice@meridian.dev",
"role": "developer",
"active": true
}`,
POST: `{
"id": 42,
"name": "New Resource",
"created": "2025-03-14T10:30:00Z",
"status": "created",
"message": "Resource created successfully"
}`,
PUT: `{
"id": 42,
"name": "Updated Resource",
"updated": "2025-03-14T10:32:00Z",
"status": "updated",
"message": "Resource updated successfully"
}`,
DELETE: `{
"id": 42,
"status": "deleted",
"message": "Resource deleted successfully"
}`,
};
const METHODS = ['GET', 'POST', 'PUT', 'DELETE'];
export default {
id: 'postman',
title: 'Postman',
render(container, api) {
let method = 'GET';
let sending = false;
const root = document.createElement('div');
root.style.cssText = 'height:100%;display:flex;flex-direction:column;background:var(--bg-1);';
// Request bar: method select + URL input + Send button
const reqBar = document.createElement('div');
reqBar.style.cssText = 'display:flex;align-items:center;gap:0;padding:8px 12px;border-bottom:1px solid var(--border);background:var(--bg-2);flex-shrink:0;';
const methodSelect = document.createElement('select');
methodSelect.style.cssText = 'padding:6px 10px;background:var(--bg-3);border:1px solid var(--border);border-right:none;border-radius:4px 0 0 4px;color:var(--accent);font-weight:600;font-size:13px;outline:none;cursor:pointer;min-width:70px;';
METHODS.forEach((m) => {
const opt = document.createElement('option');
opt.value = m;
opt.textContent = m;
if (m === method) opt.selected = true;
methodSelect.appendChild(opt);
});
methodSelect.addEventListener('change', () => { method = methodSelect.value; });
const urlInput = document.createElement('input');
urlInput.type = 'text';
urlInput.value = 'https://api.meridian.dev/v1/users';
urlInput.style.cssText = 'flex:1;padding:6px 12px;background:var(--bg-3);border:1px solid var(--border);color:var(--text);font-size:13px;font-family:monospace;outline:none;';
urlInput.placeholder = 'Enter request URL';
const sendBtn = document.createElement('button');
sendBtn.style.cssText = 'padding:6px 20px;background:var(--accent);color:#0f1114;border:none;border-radius:0 4px 4px 0;font-size:13px;font-weight:600;cursor:pointer;';
sendBtn.textContent = 'Send';
sendBtn.addEventListener('click', () => {
if (sending) return;
sending = true;
sendBtn.textContent = 'Sending...';
sendBtn.disabled = true;
setTimeout(() => {
sendBtn.textContent = 'Send';
sendBtn.disabled = false;
sending = false;
showResponse();
}, 200);
});
reqBar.appendChild(methodSelect);
reqBar.appendChild(urlInput);
reqBar.appendChild(sendBtn);
root.appendChild(reqBar);
// Tabs
const tabNames = ['Params', 'Headers', 'Body'];
let activeTab = 'Params';
const tabBtns = [];
const tabBar = document.createElement('div');
tabBar.style.cssText = 'display:flex;gap:0;border-bottom:1px solid var(--border);background:var(--bg-2);flex-shrink:0;';
tabNames.forEach((tab) => {
const btn = document.createElement('button');
const isActive = activeTab === tab;
btn.style.cssText = 'padding:8px 16px;background:transparent;border:none;border-right:1px solid var(--border);color:' + (isActive ? 'var(--text)' : 'var(--text-dim)') + ';font-size:12px;cursor:pointer;transition:color 150ms;';
btn.textContent = tab;
btn.addEventListener('click', () => {
activeTab = tab;
tabArea.innerHTML = contentPanels[tab];
tabBtns.forEach((b) => { b.style.color = 'var(--text-dim)'; });
btn.style.color = 'var(--text)';
});
tabBtns.push(btn);
tabBar.appendChild(btn);
});
root.appendChild(tabBar);
// Tab content panels
const contentPanels = {
Params: '<div style="font-size:12px;line-height:2.4;padding:4px 0;">' +
'<div style="display:flex;gap:8px;margin-bottom:4px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">Authorization</span>' +
'<input style="flex:1;background:var(--bg-1);border:1px solid var(--border);padding:5px 10px;border-radius:3px;color:var(--text);font-size:12px;font-family:monospace;" value="Bearer eyJhbGciOiJIUzI1NiJ9..." />' +
'</div>' +
'<div style="display:flex;gap:8px;margin-bottom:4px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">Content-Type</span>' +
'<input style="flex:1;background:var(--bg-1);border:1px solid var(--border);padding:5px 10px;border-radius:3px;color:var(--text);font-size:12px;font-family:monospace;" value="application/json" />' +
'</div>' +
'<div style="display:flex;gap:8px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">X-Request-ID</span>' +
'<input style="flex:1;background:var(--bg-1);border:1px solid var(--border);padding:5px 10px;border-radius:3px;color:var(--text);font-size:12px;font-family:monospace;" value="" placeholder="Auto-generated" />' +
'</div>' +
'</div>',
Headers: '<div style="font-size:12px;line-height:2.4;padding:4px 0;">' +
'<div style="display:flex;gap:8px;margin-bottom:4px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">User-Agent</span>' +
'<span style="color:var(--text);font-family:monospace;">MeridianClient/1.0</span>' +
'</div>' +
'<div style="display:flex;gap:8px;margin-bottom:4px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">Accept</span>' +
'<span style="color:var(--text);font-family:monospace;">application/json</span>' +
'</div>' +
'<div style="display:flex;gap:8px;">' +
'<span style="color:var(--accent);font-weight:500;width:100px;flex-shrink:0;">Cache-Control</span>' +
'<span style="color:var(--text);font-family:monospace;">no-cache</span>' +
'</div>' +
'</div>',
Body: '<div style="padding:4px 0;">' +
'<textarea id="postman-body" style="width:100%;height:140px;background:var(--bg-1);border:1px solid var(--border);padding:10px;border-radius:3px;color:var(--text);font-size:12px;font-family:monospace;resize:none;outline:none;"></textarea>' +
'</div>',
};
// Build body content separately since it has real JSON
const postmanBody = JSON.stringify({ name: 'Alice Freeman', email: 'alice@meridian.dev', role: 'developer' }, null, 2);
const tabArea = document.createElement('div');
tabArea.style.cssText = 'flex:1;overflow-y:auto;background:var(--bg-2);';
tabArea.innerHTML = contentPanels[activeTab];
root.appendChild(tabArea);
// Response label
const respLabel = document.createElement('div');
respLabel.style.cssText = 'padding:8px 12px;font-size:11px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.05em;border-bottom:1px solid var(--border);background:var(--bg-2);flex-shrink:0;';
respLabel.textContent = 'Response';
// Response pre
const respArea = document.createElement('pre');
respArea.style.cssText = 'flex:1;overflow:auto;padding:12px 16px;margin:0;font-size:12px;line-height:1.6;color:var(--text);font-family:monospace;background:var(--bg-1);';
respArea.textContent = 'Click Send to execute the request';
// Status line
const statusLine = document.createElement('div');
statusLine.style.cssText = 'padding:4px 12px;font-size:11px;color:var(--text-dim);border-top:1px solid var(--border);background:var(--bg-2);flex-shrink:0;';
statusLine.textContent = 'Ready';
root.appendChild(respLabel);
root.appendChild(respArea);
root.appendChild(statusLine);
container.appendChild(root);
function showResponse() {
const resp = RESPONSES[method] || RESPONSES.GET;
const time = Math.floor(Math.random() * 60) + 40;
const size = resp.length + 2;
respArea.textContent = resp;
statusLine.textContent = 'Status: 200 OK \u{B7} Time: ' + time + 'ms \u{B7} Size: ' + size + ' B';
}
},
};

133
js/apps/steam.js Normal file
View File

@@ -0,0 +1,133 @@
// Steam spoof — static-but-believable game library UI.
const GAMES = [
{ id: 'elden', title: 'Elden Ring', desc: 'Explore the Lands Between in this open-world action RPG from FromSoftware. Face legendary bosses, forge your build, and uncover the mystery of the shattered Elden Ring. Every step is a descent into the unknown.' },
{ id: 'cod', title: 'Call of Duty: MW2', desc: 'Relive the global conflict in this first-person shooter campaign. From Operation Deadbolt to the final push, the stakes have never been higher. Multiplayer is included, if you can find it in the files.' },
{ id: 'fifa', title: 'FIFA 24', desc: 'The world\'s game, rendered in full hyper-realistic detail. Play Career Mode, Ultimate Team, or just stare at the menu screen for three hours. Your choice, really.' },
{ id: 'hades', title: 'Hades II', desc: 'Return to the Underworld as Melinoch, sister of Zagreus. Wield witchcraft, summon gods, and break out of the cycle of death and rebirth. Again. This time with more style.' },
{ id: 'factorio', title: 'Factorio', desc: 'Build factories, then build bigger factories, then automate your entire existence into a sprawling industrial complex that will consume all your spare time. There is no escape.' },
{ id: 'stardew', title: 'Stardew Valley', desc: 'Leave the city. Take over your grandfather\'s old farm plot. Grow crops, raise animals, befriend the locals. It\'s a quiet life, and you\'ll never leave.' },
{ id: 'bg3', title: "Baldur's Gate 3", desc: 'Gather your party. Roll the dice. Make the worst possible choice. Larian Studios has crafted a deep RPG experience with consequences that actually matter. Mostly.' },
];
export default {
id: 'steam',
title: 'Steam',
render(container, api) {
let selectedGame = null;
let installing = null;
const root = document.createElement('div');
root.style.cssText = 'height:100%;display:flex;flex-direction:column;background:var(--bg-1);';
// Top bar
const topBar = document.createElement('div');
topBar.style.cssText = 'background:var(--bg-2);padding:8px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;';
const topTitle = document.createElement('span');
topTitle.style.cssText = 'font-size:14px;font-weight:600;color:var(--text);';
topTitle.textContent = 'Steam';
topBar.appendChild(topTitle);
root.appendChild(topBar);
// Body: sidebar + main
const body = document.createElement('div');
body.style.cssText = 'flex:1;display:flex;overflow:hidden;';
// Sidebar
const sidebar = document.createElement('div');
sidebar.style.cssText = 'width:220px;background:var(--bg-2);border-right:1px solid var(--border);display:flex;flex-direction:column;overflow-y:auto;flex-shrink:0;';
const sidebarLabel = document.createElement('div');
sidebarLabel.style.cssText = 'padding:12px 14px 6px;font-size:11px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.05em;';
sidebarLabel.textContent = 'Library';
sidebar.appendChild(sidebarLabel);
GAMES.forEach((game) => {
const item = document.createElement('div');
item.style.cssText = 'padding:8px 14px;cursor:pointer;font-size:13px;color:var(--text);transition:background 150ms ease-out;border-left:2px solid transparent;';
item.textContent = game.title;
item.addEventListener('click', () => { selectGame(game); });
item.dataset.gameId = game.id;
sidebar.appendChild(item);
});
// Main area
const mainArea = document.createElement('div');
mainArea.style.cssText = 'flex:1;display:flex;flex-direction:column;overflow-y:auto;padding:24px;';
// Initial state: "Select a game"
const placeholder = document.createElement('div');
placeholder.style.cssText = 'flex:1;display:flex;align-items:center;justify-content:center;color:var(--text-dim);font-size:14px;';
placeholder.textContent = 'Select a game from your library';
mainArea.appendChild(placeholder);
body.appendChild(sidebar);
body.appendChild(mainArea);
root.appendChild(body);
// Status bar
const status = document.createElement('div');
status.style.cssText = 'background:var(--bg-2);border-top:1px solid var(--border);padding:6px 14px;font-size:11px;color:var(--text-dim);flex-shrink:0;';
status.textContent = 'Online \u{B7} 142 friends online \u{B7} 4.7 TB free';
root.appendChild(status);
container.appendChild(root);
function selectGame(game) {
selectedGame = game;
installing = null;
// Clear main area and add game details
while (mainArea.firstChild) mainArea.removeChild(mainArea.firstChild);
// Hero image (gradient block with title overlay)
const hero = document.createElement('div');
hero.style.cssText = 'width:100%;height:200px;background:linear-gradient(135deg, rgba(37,42,49,0.9), rgba(212,162,76,0.2));border:1px solid var(--border);display:flex;align-items:flex-end;padding:20px;margin-bottom:20px;position:relative;overflow:hidden;border-radius:4px;';
const heroOverlay = document.createElement('div');
heroOverlay.style.cssText = 'font-size:32px;font-weight:700;color:var(--text);text-shadow:0 2px 8px rgba(0,0,0,0.6);';
heroOverlay.textContent = game.title;
hero.appendChild(heroOverlay);
mainArea.appendChild(hero);
// Description
const desc = document.createElement('p');
desc.style.cssText = 'font-size:13px;color:var(--text);line-height:1.7;margin-bottom:20px;max-width:600px;';
desc.textContent = game.desc;
mainArea.appendChild(desc);
// Install button
const installBtn = document.createElement('button');
installBtn.style.cssText = 'padding:10px 28px;background:var(--accent);color:#0f1114;border:none;border-radius:4px;font-size:14px;font-weight:600;cursor:pointer;transition:opacity 150ms ease-out;width:fit-content;';
installBtn.textContent = 'Install';
installBtn.addEventListener('click', () => startInstall(game, installBtn));
mainArea.appendChild(installBtn);
}
function startInstall(game, btn) {
installing = game.id;
btn.textContent = 'Downloading...';
btn.disabled = true;
const progressWrap = document.createElement('div');
progressWrap.style.cssText = 'width:280px;height:6px;background:var(--bg-3);border-radius:3px;margin-top:12px;overflow:hidden;';
const progressFill = document.createElement('div');
progressFill.style.cssText = 'width:0%;height:100%;background:var(--accent);border-radius:3px;transition:width 2s linear;';
progressWrap.appendChild(progressFill);
mainArea.appendChild(progressWrap);
// Animate progress over 2s
requestAnimationFrame(() => {
progressFill.style.width = '100%';
});
setTimeout(() => {
btn.textContent = 'Installed (in your imagination)';
btn.style.background = 'var(--bg-3)';
btn.style.color = 'var(--text-dim)';
btn.style.border = '1px solid var(--border)';
btn.disabled = false;
installing = null;
progressWrap.remove();
}, 2100);
}
},
};

316
js/apps/terminal.js Normal file
View File

@@ -0,0 +1,316 @@
export default {
id: 'terminal',
title: 'Terminal',
render: function (container, api) {
var commandHistory = [];
var historyIndex = -1;
var outputLines = [];
var bus = api.bus;
// ── DOM Structure ──────────────────────────────────────
container.style.cssText = 'height:100%;width:100%;background:#0a0b0d;color:#cfd3d8;display:flex;flex-direction:column;font-family:ui-monospace,"JetBrains Mono",Menlo,monospace;overflow:hidden;cursor:text;';
var outputEl = document.createElement('div');
outputEl.style.cssText = 'flex:1;overflow-y:auto;padding:12px;font-size:14px;line-height:1.5;white-space:pre-wrap;word-break:break-word;';
var inputRow = document.createElement('div');
inputRow.style.cssText = 'display:flex;align-items:center;padding:4px 12px 12px;';
var promptEl = document.createElement('span');
promptEl.style.cssText = 'color:#d4a24c;font-size:14px;line-height:1.5;white-space:pre;user-select:none;';
promptEl.textContent = 'tarnished@meridian:~$ ';
var inputEl = document.createElement('input');
inputEl.style.cssText = 'flex:1;background:transparent;border:none;color:inherit;outline:none;font-family:inherit;font-size:14px;line-height:1.5;cursor:text;';
inputEl.setAttribute('type', 'text');
inputEl.setAttribute('autocomplete', 'off');
inputEl.setAttribute('autocorrect', 'off');
inputEl.setAttribute('autocapitalize', 'off');
inputEl.setAttribute('spellcheck', 'false');
inputRow.appendChild(promptEl);
inputRow.appendChild(inputEl);
container.appendChild(outputEl);
container.appendChild(inputRow);
// ── Helpers ────────────────────────────────────────────
function appendLine(text, color) {
var line = document.createElement('div');
line.style.cssText = 'font-size:14px;line-height:1.5;';
line.style.color = color || '#cfd3d8';
line.textContent = text;
outputEl.appendChild(line);
outputLines.push(line);
outputEl.scrollTop = outputEl.scrollHeight;
}
function printBanner() {
appendLine('Meridian Shell 1.0 (kernel 4.19-browser)');
appendLine("Type 'help' to begin. Try 'praise_the_sun' if you know what you're doing.");
appendLine('');
}
// ── Real Commands ──────────────────────────────────────
function cmdHelp() {
appendLine('Available commands:');
appendLine(' help Show this help message');
appendLine(' ls List directory contents');
appendLine(' whoami Show current user');
appendLine(' date Show current date');
appendLine(' uname Show system info');
appendLine(' echo <text> Print text');
appendLine(' clear Clear terminal output');
appendLine(' cat <file> Read a file');
appendLine(' history Show command history');
appendLine(' achievements Show unlocked achievements');
appendLine(' exit Close terminal');
appendLine('');
appendLine("Try 'praise_the_sun' if you know what you're doing.");
}
function cmdLs() {
appendLine('Documents Downloads Music Pictures save_files.dat');
}
function cmdWhoami() {
var user = api.state.get('user');
appendLine(user ? user.name : 'tarnished');
}
function cmdDate() {
appendLine(new Date().toString());
}
function cmdUname() {
appendLine('Meridian 1.0 (browser-kernel)');
}
function cmdEcho(args) {
if (args.length === 0) return;
appendLine(args.join(' '));
}
function cmdClear() {
outputEl.innerHTML = '';
outputLines = [];
}
function cmdCat(file) {
if (!file) {
appendLine('cat: missing operand', '#c85d5d');
return;
}
if (file === 'save_files.dat') {
appendLine("Ah, you want to read your save file? Not today. Some mysteries are better left unsolved.", '#d4a24c');
return;
}
appendLine('cat: ' + file + ': No such file or directory', '#c85d5d');
}
function cmdHistory() {
if (commandHistory.length === 0) {
appendLine('No commands in history.');
return;
}
commandHistory.forEach(function (cmd, i) {
appendLine(' ' + String(i + 1).padStart(4) + ' ' + cmd);
});
}
function cmdAchievements() {
var achievements = api.state.get('achievements');
if (!achievements || achievements.length === 0) {
appendLine('No achievements unlocked yet.');
return;
}
appendLine('Unlocked achievements (' + achievements.length + '):');
achievements.forEach(function (a) {
appendLine(' [x] ' + a);
});
}
function cmdExit() {
api.close();
}
// ── Easter Eggs ────────────────────────────────────────
var easterEggs = {
'praise_the_sun': {
msg: 'A grace of Gold is bestowed upon you.\nMay it guide you in the dark times ahead.',
slug: 'er_grace'
},
'tarnished': {
msg: 'Well then, tarnished. Seek strength. For that is your duty.',
slug: 'er_tarnished'
},
'try finger, but hole': {
msg: 'Message left by a fellow traveler. Rating: brilliant. Rating: inappropriate.',
slug: 'er_bong_hits'
},
'dropshot': {
msg: 'Hitmarker. Clean drop.',
slug: 'er_dropshot'
},
'360_noscope': {
msg: ' |\n /|\\\n-------\n |/\nmontage material acquired.',
slug: 'er_360noscope'
},
'mw2': {
msg: 'A true classic. Soap would be proud.',
slug: 'er_mw2'
},
'siuuu': {
msg: 'SIUUUUU! The keeper had no chance.',
slug: 'er_siuuu'
},
'golazo': {
msg: 'Top bins. What a strike. What a moment.',
slug: 'er_golazo'
},
'wonderkid': {
msg: 'Regen detected. Potential: 5 stars.',
slug: 'er_wonderkid'
},
'konami': {
msg: 'Cheat mode enabled. (it does nothing. you are already a legend.)',
slug: 'er_konami'
},
'matrix': {
msg: null,
slug: 'er_matrix'
},
'sudo rm -rf /': {
msg: 'nice try, tarnished. root is a state of mind.',
slug: 'er_sudo_rm_rf'
}
};
function triggerEasterEgg(cmdName, egg) {
bus.emit('term:cmd', { cmd: cmdName });
bus.emit('easter:found', { id: egg.slug });
if (cmdName === 'matrix') {
appendLine('Entering the matrix...', '#d4a24c');
var mlines = [];
for (var mi = 0; mi < 8; mi++) {
var row = '';
for (var mj = 0; mj < 40; mj++) {
row += Math.random() < 0.5 ? '0' : '1';
}
mlines.push(row);
}
var mlIdx = 0;
function typeNext() {
if (mlIdx < mlines.length) {
appendLine(mlines[mlIdx], '#41c35a');
mlIdx++;
setTimeout(typeNext, 30);
}
}
setTimeout(typeNext, 30);
return;
}
if (cmdName === 'sudo rm -rf /') {
appendLine('...', '#d4a24c');
setTimeout(function () {
outputEl.removeChild(outputEl.lastChild);
appendLine('nice try, tarnished. root is a state of mind.', '#d4a24c');
}, 900);
return;
}
if (egg.msg && egg.msg.indexOf('\n') !== -1) {
egg.msg.split('\n').forEach(function (ln) {
appendLine(ln, '#d4a24c');
});
} else if (egg.msg) {
appendLine(egg.msg, '#d4a24c');
}
}
// ── Command Processing ─────────────────────────────────
function emitRealCmd(cmd) {
bus.emit('term:cmd', { cmd: cmd });
}
function processInput(raw) {
var trimmed = raw.trim();
if (!trimmed) return;
commandHistory.push(trimmed);
if (commandHistory.length > 50) {
commandHistory.shift();
}
historyIndex = commandHistory.length;
appendLine(promptEl.textContent + trimmed, '#d4a24c');
if (easterEggs[trimmed]) {
triggerEasterEgg(trimmed, easterEggs[trimmed]);
return;
}
var parts = trimmed.split(/\s+/);
var cmd = parts[0].toLowerCase();
if (easterEggs[cmd]) {
triggerEasterEgg(cmd, easterEggs[cmd]);
return;
}
emitRealCmd(cmd);
switch (cmd) {
case 'help': cmdHelp(); break;
case 'ls': cmdLs(); break;
case 'whoami': cmdWhoami(); break;
case 'date': cmdDate(); break;
case 'uname': cmdUname(); break;
case 'echo': cmdEcho(parts.slice(1)); break;
case 'clear': cmdClear(); break;
case 'cat': cmdCat(parts[1]); break;
case 'history': cmdHistory(); break;
case 'achievements': cmdAchievements(); break;
case 'exit': cmdExit(); break;
default:
appendLine('Command not found: ' + cmd, '#c85d5d');
}
}
// ── Keyboard Handling ──────────────────────────────────
inputEl.addEventListener('keydown', function (e) {
if (e.key === 'Enter') {
processInput(inputEl.value);
inputEl.value = '';
historyIndex = commandHistory.length;
} else if (e.key === 'ArrowUp') {
e.preventDefault();
if (historyIndex > 0) {
historyIndex--;
inputEl.value = commandHistory[historyIndex];
}
} else if (e.key === 'ArrowDown') {
e.preventDefault();
if (historyIndex < commandHistory.length - 1) {
historyIndex++;
inputEl.value = commandHistory[historyIndex];
} else {
historyIndex = commandHistory.length;
inputEl.value = '';
}
} else if (e.ctrlKey && e.key.toLowerCase() === 'l') {
e.preventDefault();
cmdClear();
}
});
// ── Click to Focus ─────────────────────────────────────
container.addEventListener('click', function () {
inputEl.focus();
});
// ── Initial Banner ─────────────────────────────────────
printBanner();
inputEl.focus();
}
};

214
js/apps/vscode.js Normal file
View File

@@ -0,0 +1,214 @@
// VS Code spoof — three-pane layout with file explorer and syntax-highlighted editor.
const FILES = [
{ path: 'src/index.ts', content: `import { Engine } from './engine';
const engine = new Engine({
title: 'Meridian OS',
version: '0.1.0',
antialias: true,
vsync: true,
});
// Entry point
engine.start();
console.log('Meridian OS initialized');
export default engine;` },
{ path: 'src/engine.ts', content: `export interface EngineConfig {
title: string;
version: string;
antialias: boolean;
vsync: boolean;
}
export class Engine {
private config: EngineConfig;
private running: boolean = false;
constructor(config: EngineConfig) {
this.config = config;
this.running = false;
}
start(): void {
if (this.running) return;
this.running = true;
console.log(\`Starting \${this.config.title} v\${this.config.version}\`);
this.renderLoop();
}
private renderLoop(): void {
while (this.running) {
this.update();
this.draw();
}
}
private update(): void {
// Game loop update
}
private draw(): void {
// Game loop render
}
stop(): void {
this.running = false;
}
}` },
{ path: 'README.md', content: `# Meridian OS
## Overview
A browser-based desktop environment for a video game.
Elegant, restrained, gamer-literate without being loud.
## Features
- Window manager with drag, focus, minimize, close
- Multiple apps: Notepad, Music, Terminal
- Spoof apps: Steam, VS Code, Postman, Chrome
- Achievement system
- localStorage persistence
## Tech Stack
- Vanilla JS
- CSS custom properties
- No frameworks. No excuses.` },
];
function highlightTS(code) {
// Very basic "syntax highlighting" — just colour types, strings, keywords
return code
.replace(/(import|export|from|const|let|var|function|class|private|public|return|if|while|interface|type|new|void|false|true|this|typeof|instanceof|extends)/g, '<span style="color:#c678dd">$1</span>')
.replace(/(\/\/.*)/g, '<span style="color:#6a9955">$1</span>')
.replace(/('.*?'|".*?"|`.*?`)/g, '<span style="color:#ce9178">$1</span>')
.replace(/\b(\d+)\b/g, '<span style="color:#b5cea8">$1</span>')
.replace(/(\w+)(?=\s*\()/g, '<span style="color:#61afef">$1</span>')
.replace(/(:\s*)(\w+)/g, '$1<span style="color:#e5c07b">$2</span>');
}
export default {
id: 'vscode',
title: 'VS Code',
render(container, api) {
let activeFile = 0;
const root = document.createElement('div');
root.style.cssText = 'height:100%;display:flex;flex-direction:column;background:#1e1e1e;font-family:var(--font-mono,monospace);font-size:13px;color:#d4d4d4;';
// Activity bar (leftmost, 40px wide)
const actBar = document.createElement('div');
actBar.style.cssText = 'width:40px;background:#333333;display:flex;flex-direction:column;align-items:center;padding-top:8px;border-right:1px solid #444444;flex-shrink:0;';
// 5 geometric icons as divs
const icons = [
{ shape: 'square', id: 'explorer' },
{ shape: 'hline', id: 'search' },
{ shape: 'dots', id: 'git' },
{ shape: 'circle', id: 'debug' },
{ shape: 'grid', id: 'extensions' },
];
const iconStyle = 'width:24px;height:24px;margin-bottom:16px;cursor:pointer;opacity:0.5;transition:opacity 150ms;';
icons.forEach((icon) => {
const el = document.createElement('div');
el.style.cssText = iconStyle;
el.id = `vscode-icon-${icon.id}`;
if (icon.shape === 'square') {
el.innerHTML = '<div style="width:18px;height:18px;border:2px solid #d4d4d4;"></div>';
} else if (icon.shape === 'hline') {
el.innerHTML = '<div style="width:18px;height:2px;background:#d4d4d4;margin-top:8px;"></div><div style="width:12px;height:2px;background:#d4d4d4;margin-top:4px;"></div><div style="width:16px;height:2px;background:#d4d4d4;margin-top:4px;"></div>';
} else if (icon.shape === 'dots') {
el.innerHTML = '<div style="display:flex;justify-content:space-around;align-items:center;height:100%;">' +
'<div style="width:5px;height:5px;border-radius:50%;background:#d4d4d4;"></div>' +
'<div style="width:5px;height:5px;border-radius:50%;background:#d4d4d4;"></div>' +
'<div style="width:5px;height:5px;border-radius:50%;background:#d4d4d4;"></div></div>';
} else if (icon.shape === 'circle') {
el.innerHTML = '<div style="width:18px;height:18px;border-radius:50%;border:2px solid #d4d4d4;"></div>';
} else if (icon.shape === 'grid') {
el.innerHTML = '<div style="display:grid;grid-template-columns:1fr 1fr;gap:2px;width:18px;height:18px;">' +
'<div style="background:#d4d4d4;"></div><div style="background:#d4d4d4;"></div>' +
'<div style="background:#d4d4d4;"></div><div style="background:#d4d4d4;"></div></div>';
}
if (icon.id === 'explorer') {
el.style.opacity = '1';
el.style.borderLeft = '2px solid var(--accent)';
el.style.marginLeft = '-2px';
}
el.addEventListener('click', () => {
icons.forEach((ic) => {
const e = document.getElementById(`vscode-icon-${ic.id}`);
if (e) { e.style.opacity = '0.5'; e.style.borderLeft = 'none'; }
});
el.style.opacity = '1';
el.style.borderLeft = '2px solid var(--accent)';
el.style.marginLeft = '-2px';
});
actBar.appendChild(el);
});
// File explorer (200px wide)
const explorer = document.createElement('div');
explorer.style.cssText = 'width:200px;background:#252526;border-right:1px solid #444444;display:flex;flex-direction:column;flex-shrink:0;';
const explLabel = document.createElement('div');
explLabel.style.cssText = 'padding:8px 12px;font-size:11px;font-weight:600;color:#bbbbbb;text-transform:uppercase;letter-spacing:0.05em;';
explLabel.textContent = 'Explorer';
explorer.appendChild(explLabel);
const folderLabel = document.createElement('div');
folderLabel.style.cssText = 'padding:4px 12px;font-size:12px;color:#9cdcfe;font-weight:600;cursor:pointer;';
folderLabel.textContent = 'MERIDIAN-OS';
explorer.appendChild(folderLabel);
FILES.forEach((file, i) => {
const row = document.createElement('div');
row.style.cssText = 'padding:4px 12px 4px 24px;font-size:13px;color:#cccccc;cursor:pointer;display:flex;align-items:center;transition:background 100ms;';
const ext = file.path.split('.').pop();
const tsColor = ext === 'ts' ? '#519aba' : (ext === 'md' ? '#82aaff' : '#cccccc');
row.innerHTML = `<span style="color:${tsColor};margin-right:6px;font-weight:600;">${ext === 'md' ? 'M' : '{ }'}</span>${file.path}`;
row.addEventListener('click', () => {
activeFile = i;
updateEditor();
});
explorer.appendChild(row);
});
// Editor area
const editor = document.createElement('div');
editor.style.cssText = 'flex:1;overflow:auto;padding:16px 20px;background:#1e1e1e;';
const editorContent = document.createElement('pre');
editorContent.style.cssText = 'margin:0;font-family:Consolas,Menlo,Monaco,monospace;font-size:13px;line-height:1.6;white-space:pre;tab-size:2;';
function updateEditor() {
editorContent.innerHTML = '<span style="color:#858585;">' +
Array.from({ length: FILES[activeFile].content.split('\n').length }, (_, i) => i + 1).join('\n') +
'</span> ' + highlightTS(FILES[activeFile].content);
}
updateEditor();
editor.appendChild(editorContent);
// Body container
const body = document.createElement('div');
body.style.cssText = 'flex:1;display:flex;overflow:hidden;';
body.appendChild(explorer);
body.appendChild(editor);
// Status bar
const statusBar = document.createElement('div');
statusBar.style.cssText = 'height:22px;background:#007acc;display:flex;align-items:center;padding:0 12px;font-size:12px;color:#ffffff;flex-shrink:0;gap:16px;';
statusBar.innerHTML = '<span>main</span><span>\u{2713} 0 problems</span><span>UTF-8</span><span>TypeScript</span>';
root.appendChild(actBar);
root.appendChild(body);
root.appendChild(statusBar);
container.appendChild(root);
},
};