concept-collection / minwebide-demo
minwebide-demo / src / sampleWorkspace.ts
91 lines · 2.4 KBBlameHistoryRaw
1export const sampleWorkspace: Record<string, string> = {
2 '/README.md': `# Demo workspace
4This workspace lives entirely in your browser's IndexedDB, served through
5VS Code's own \`IndexedDBFileSystemProvider\` and \`FileService\`.
7- Edit a file and press **Ctrl+S** to save it.
8- Reload the page: your changes persist.
9- Open this app in a second tab: changes broadcast across tabs.
10`,
11 '/src/main.ts': `import { greet } from './utils';
13export function main(): void {
14 const message = greet('minwebide');
15 console.log(message);
18main();
19`,
20 '/src/utils.ts': `const EXCLAMATIONS = 3;
22export function greet(name: string): string {
23 return \`Hello, \${name}\` + '!'.repeat(EXCLAMATIONS);
25`,
26 '/src/styles.css': `:root {
27 --accent: #0078d4;
30body {
31 font-family: system-ui, sans-serif;
32 color: var(--accent);
34`,
35 '/data/measurements.csv': `sample,voltage_mV,current_uA,temperature_C,status
36s-001,12.4,340,21.5,ok
37s-002,11.9,332,21.7,ok
38s-003,12.1,,21.4,"missing current"
39s-004,13.0,355,22.1,ok
40s-005,12.6,349,21.9,recalibrated
41s-006,12.2,338,21.6,ok
42`,
43 '/data/config.json': `{
44 "name": "minwebide-demo",
45 "version": "0.1.0",
46 "features": {
47 "indexeddb": true,
48 "textmate": true
49 }
51`,
52 '/scripts/fibonacci.js': `// Press the ▶ button in the tab bar to run this file.
53// Output appears in the Output view of the bottom panel.
55function fib(n) {
56 return n < 2 ? n : fib(n - 1) + fib(n - 2);
59for (let i = 1; i <= 10; i++) {
60 console.log(\`fib(\${i}) = \${fib(i)}\`);
63console.warn('warnings and errors are colorized by the log grammar');
64`,
65 '/scripts/sine-wave.js': `// Run this file (▶): console output goes to the bottom panel,
66// while plot() renders into the runner's view in the secondary side bar.
68const xs = [];
69const ys = [];
70for (let i = 0; i <= 200; i++) {
71 const x = (i / 200) * 4 * Math.PI;
72 xs.push(x);
73 ys.push(Math.sin(x) * Math.exp(-x / 8));
75plot({ x: xs, y: ys, title: 'Damped sine wave' });
76console.log(\`plotted \${xs.length} samples\`);
78const primes = [];
79for (let n = 2; primes.length < 40; n++) {
80 if (primes.every((p) => n % p)) primes.push(n);
82plot({ y: primes, title: 'First 40 primes', color: 'orange' });
83console.log('largest prime plotted:', primes[primes.length - 1]);
84`,
85 '/docs/notes.md': `# Notes
87Everything you see is either VS Code's own code (editor, file tree,
88splitters, colors, icons) or a thin shell styled with VS Code's theme
89variables.
90`,
91};