-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
322 lines (305 loc) · 17.9 KB
/
Copy pathindex.html
File metadata and controls
322 lines (305 loc) · 17.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Interactive RLC Circuit Simulator - Analyze and simulate electronic circuits with real-time visualization">
<title>Circuit Simulator | RLC Analysis</title>
<link rel="stylesheet" href="index.css">
<script src="config.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap"
rel="stylesheet">
</head>
<body>
<div id="app">
<!-- Header -->
<header class="app-header">
<div class="logo">
<svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3" />
<path
d="M12 1v4M12 19v4M4.22 4.22l2.83 2.83M16.95 16.95l2.83 2.83M1 12h4M19 12h4M4.22 19.78l2.83-2.83M16.95 7.05l2.83-2.83" />
</svg>
<span class="logo-text">Circuit Simulator</span>
</div>
<div class="header-actions">
<a href="#" class="btn btn-secondary" id="btn-back-guide"
onclick="window.location.href = CONFIG.GUIDE_URL; return false;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 12H5" />
<polyline points="12 19 5 12 12 5" />
</svg>
Back to Guide
</a>
<a href="gallery.html" class="btn btn-secondary" id="btn-explore-gallery" style="text-decoration: none;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="7" height="7"></rect>
<rect x="14" y="3" width="7" height="7"></rect>
<rect x="14" y="14" width="7" height="7"></rect>
<rect x="3" y="14" width="7" height="7"></rect>
</svg>
Explore Gallery
</a>
<button class="btn btn-secondary" id="btn-change-config" style="display: none;">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="8" y1="13" x2="16" y2="13" />
<line x1="8" y1="17" x2="16" y2="17" />
</svg>
Change Config
</button>
<div class="header-divider"></div>
<button class="header-icon-btn" id="btn-new" title="New Circuit">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" />
<polyline points="14 2 14 8 20 8" />
<line x1="12" y1="18" x2="12" y2="12" />
<line x1="9" y1="15" x2="15" y2="15" />
</svg>
</button>
<button class="header-icon-btn" id="btn-save" title="Save Circuit">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" />
<polyline points="17 21 17 13 7 13 7 21" />
<polyline points="7 3 7 8 15 8" />
</svg>
</button>
<button class="header-icon-btn" id="btn-download" title="Download Circuit">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7 10 12 15 17 10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
</button>
<button class="header-icon-btn" id="btn-export-image" title="Export as Image (Screen Capture)">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" />
<circle cx="12" cy="13" r="4" />
</svg>
</button>
<button class="header-icon-btn" id="btn-load" title="Load Circuit">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="17 8 12 3 7 8" />
<line x1="12" y1="3" x2="12" y2="15" />
</svg>
</button>
</div>
</header>
<!-- Main Content -->
<main class="app-main">
<!-- Preset Selection Modal Overlay (Hidden by default) -->
<div id="preset-modal-overlay" class="preset-modal-overlay" style="display: none;">
<div class="preset-modal">
<h2 class="preset-modal-title">Select Circuit Configuration</h2>
<p class="preset-modal-desc">This experiment has multiple variants. Select one to continue.</p>
<div id="preset-grid" class="preset-grid">
<!-- Preset cards injected here via JS -->
</div>
</div>
</div>
<!-- Toolbar (Component Palette) -->
<aside class="toolbar" id="toolbar">
<h2 class="toolbar-title">Components</h2>
<div class="toolbar-search">
<svg class="search-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
</svg>
<input type="text" id="component-search" placeholder="Search components..." />
</div>
<div class="component-list" id="component-list">
<!-- Components will be dynamically populated from registry -->
</div>
</aside>
<!-- Drag handle: toolbar ↔ canvas -->
<div class="panel-drag-handle" id="drag-left" title="Drag to resize"></div>
<!-- Canvas Area -->
<section class="canvas-container" id="canvas-container">
<svg class="circuit-canvas" id="circuit-canvas">
<!-- Grid pattern -->
<defs>
<pattern id="grid-small" width="20" height="20" patternUnits="userSpaceOnUse">
<path d="M 20 0 L 0 0 0 20" fill="none" stroke="var(--grid-line)" stroke-width="0.5" />
</pattern>
<pattern id="grid-large" width="100" height="100" patternUnits="userSpaceOnUse">
<rect width="100" height="100" fill="url(#grid-small)" />
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="var(--grid-line-major)"
stroke-width="1" />
</pattern>
</defs>
<rect class="grid-background" width="100%" height="100%" fill="url(#grid-large)" />
<!-- Circuit components layer -->
<g class="components-layer" id="components-layer"></g>
<!-- Wires layer -->
<g class="wires-layer" id="wires-layer"></g>
<!-- Interaction layer (for drawing wires, selections) -->
<g class="interaction-layer" id="interaction-layer"></g>
</svg>
<!-- Canvas Controls (Zoom, Pan) -->
<div class="canvas-controls">
<button class="canvas-btn" id="btn-zoom-in" title="Zoom In">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="11" y1="8" x2="11" y2="14" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
</button>
<button class="canvas-btn" id="btn-zoom-out" title="Zoom Out">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="11" cy="11" r="8" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
<line x1="8" y1="11" x2="14" y2="11" />
</svg>
</button>
<button class="canvas-btn" id="btn-zoom-fit" title="Fit to View">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path
d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" />
</svg>
</button>
</div>
<!-- Chart Panel Overlay -->
<div class="chart-overlay" id="chart-overlay">
<div class="chart-header">
<span class="chart-title">Waveform</span>
<button class="chart-close" id="chart-close">×</button>
</div>
<div class="chart-container" id="chart-container"></div>
</div>
<!-- Oscilloscope Overlay -->
<div class="scope-overlay" id="scope-overlay">
<div class="chart-header">
<span class="chart-title">🔬 Oscilloscope</span>
<button class="chart-close" id="scope-close">×</button>
</div>
<div class="chart-container" id="scope-container"></div>
</div>
<!-- Sensor Overlay Controls (Floating top-right) -->
<div class="sensor-controls-overlay" id="sensor-controls-overlay" style="display: none;">
<div class="sensor-button-group">
<button class="btn btn-primary btn-sensor-play" id="btn-start-sensor">
<svg viewBox="0 0 24 24" fill="currentColor"><polygon points="5 3 19 12 5 21 5 3" /></svg>
Start Sensors
</button>
<button class="btn btn-secondary" id="btn-stop-sensor" disabled>
<svg viewBox="0 0 24 24" fill="currentColor"><rect x="6" y="4" width="4" height="16" /><rect x="14" y="4" width="4" height="16" /></svg>
Stop
</button>
</div>
<button class="btn btn-accent btn-sensor-note" id="btn-note-reading" disabled>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>
Note Reading (<span id="note-count">0</span>)
</button>
<div id="sensor-live-panel" class="sensor-live-panel" style="display: none;"></div>
</div>
</section>
<!-- Drag handle: canvas ↔ right panel -->
<div class="panel-drag-handle" id="drag-right" title="Drag to resize"></div>
<!-- Right Panel (Properties + Output) -->
<aside class="right-panel">
<!-- Property Panel -->
<section class="property-panel collapsible-section" id="property-panel">
<h2 class="panel-title collapsible-header" data-target="property-content">
<svg class="collapse-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
Properties
</h2>
<div class="collapsible-content" id="property-content">
<p class="placeholder-text">Select a component to view properties</p>
</div>
</section>
<!-- Simulation Controls -->
<section class="simulation-panel collapsible-section" id="simulation-panel">
<h2 class="panel-title collapsible-header" data-target="simulation-content">
<svg class="collapse-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
Simulation
</h2>
<div class="collapsible-content" id="simulation-content">
<div class="simulation-controls">
<div class="control-group">
<label for="analysis-type">Analysis Type</label>
<select id="analysis-type" class="select-input">
<option value="dc">DC Analysis</option>
<option value="ac">AC Analysis</option>
<option value="transient">Transient</option>
</select>
</div>
<div class="control-group" id="freq-group">
<label for="ac-frequency">Frequency (Hz)</label>
<input type="number" id="ac-frequency" class="number-input" value="60" min="0" step="1">
</div>
<div class="control-group">
<label for="sim-time">Simulation Time (s)</label>
<input type="number" id="sim-time" class="number-input" value="0.01" min="0.001"
step="0.001">
</div>
<div class="control-group">
<label for="time-step">Time Step (s)</label>
<input type="number" id="time-step" class="number-input" value="0.0001" min="0.00001"
step="0.00001">
</div>
<div class="sim-buttons">
<button class="btn btn-primary btn-run" id="btn-run">
<svg viewBox="0 0 24 24" fill="currentColor">
<polygon points="5 3 19 12 5 21 5 3" />
</svg>
Run
</button>
<button class="btn btn-secondary" id="btn-stop" disabled>
<svg viewBox="0 0 24 24" fill="currentColor">
<rect x="6" y="4" width="4" height="16" />
<rect x="14" y="4" width="4" height="16" />
</svg>
Stop
</button>
<button class="btn btn-secondary" id="btn-reset">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="1 4 1 10 7 10" />
<path d="M3.51 15a9 9 0 1 0 2.13-9.36L1 10" />
</svg>
Reset
</button>
</div>
</div>
</div>
</section>
<!-- Output Panel -->
<section class="output-panel collapsible-section" id="output-panel">
<h2 class="panel-title collapsible-header" data-target="output-content">
<svg class="collapse-arrow" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2">
<polyline points="6 9 12 15 18 9" />
</svg>
Output
</h2>
<div class="collapsible-content" id="output-content">
<p class="placeholder-text">Run simulation to see results</p>
</div>
</section>
</aside>
</main>
<!-- Status Bar -->
<footer class="status-bar">
<span class="status-item" id="status-mode">Mode: Edit</span>
<span class="status-item" id="status-coords">X: 0, Y: 0</span>
<span class="status-item" id="status-zoom">Zoom: 100%</span>
<span class="status-item" id="status-components">Components: 0</span>
<span class="status-credit">Designed & Developed by Akshay Ravikanti</span>
</footer>
</div>
<!-- Scripts -->
<script type="module" src="src/main.js"></script>
</body>
</html>