-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
287 lines (278 loc) · 14.4 KB
/
Copy pathindex.html
File metadata and controls
287 lines (278 loc) · 14.4 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Valence</title>
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<link rel="stylesheet" href="/src/styles/main.css" />
</head>
<body>
<div id="app">
<div id="jsme-panel">
<div id="brand-bar">
<svg viewBox="0 0 32 32" width="24" height="24" aria-hidden="true">
<defs>
<linearGradient id="bg1" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#4488ff"/><stop offset="100%" stop-color="#2266dd"/>
</linearGradient>
<linearGradient id="bg2" x1="1" y1="0" x2="0" y2="1">
<stop offset="0%" stop-color="#4488ff"/><stop offset="100%" stop-color="#2266dd"/>
</linearGradient>
</defs>
<path d="M10 18 Q6 16 6 12 Q6 8 10 6 Q12 5 14 6 Q18 8 18 14 Q18 18 14 20 Q12 21 10 20 Z" fill="url(#bg1)" opacity="0.9"/>
<path d="M22 14 Q26 16 26 20 Q26 24 22 26 Q20 27 18 26 Q14 24 14 18 Q14 14 18 12 Q20 11 22 12 Z" fill="url(#bg2)" opacity="0.9"/>
<circle cx="10" cy="10" r="3" fill="#909090"/>
<circle cx="22" cy="22" r="3" fill="#909090"/>
</svg>
<span class="brand-title">Valence</span>
<span class="brand-version">v0.8.0</span>
<button id="cite-btn" class="brand-btn" title="How to cite">Cite</button>
<a href="https://github.com/exergonic/valence" target="_blank" rel="noopener" class="brand-link" title="GitHub">
<svg viewBox="0 0 16 16" width="18" height="18" fill="currentColor"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/></svg>
</a>
<span class="brand-copyright">© 2026 Billy Wayne McCann</span>
</div>
<div id="jsme_container"></div>
<button id="render-btn">Render Molecule</button>
</div>
<div id="splitter"></div>
<div id="canvas-container">
<!-- Persistent molecule info header -->
<div id="molecule-info" class="hidden">
<span id="mol-formula"></span>
<span id="mol-name"></span>
<span id="mol-weight"></span>
<span id="mol-source"></span>
<a id="mol-link" href="#" target="_blank" rel="noopener">View on PubChem ↗</a>
<span id="mol-warnings"></span>
</div>
<!-- Collapsible PubChem record, below the header on successful lookups -->
<details id="mol-data" class="hidden">
<summary>PubChem record <span id="mol-data-cid"></span></summary>
<dl id="mol-data-rows"></dl>
</details>
<!-- Tabbed controls panel -->
<div id="controls-panel">
<div id="controls-tabs">
<button class="tab-btn active" data-tab="build">Build</button>
<button class="tab-btn" data-tab="style">Style</button>
<button class="tab-btn" data-tab="export">Export</button>
<button class="tab-btn" data-tab="measure">Measure</button>
</div>
<div id="tab-build" class="tab-content active">
<div class="ctrl-section">
<span class="ctrl-label">Examples</span>
<select id="examples-dropdown" class="label-mode-select">
<option value="">Pick an example…</option>
</select>
</div>
<div class="ctrl-section">
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-show-mol" />
<span>Atoms & Bonds</span>
</label>
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-show-orb" checked />
<span>Orbitals</span>
</label>
<span class="ctrl-label">Labels</span>
<select id="ctrl-label-mode" class="label-mode-select">
<option value="atom">Element Symbols</option>
<option value="orbital">Orbital Types (σ/π/lp)</option>
<option value="hybrid">Hybridization (sp², sp³)</option>
<option value="off">Off</option>
</select>
</div>
<div class="ctrl-section">
<label class="ctrl-slider">
<span>Atom Size</span>
<input type="range" id="ctrl-atom-scale" min="0.2" max="2.5" step="0.05" />
</label>
<label class="ctrl-slider">
<span>Bond Size</span>
<input type="range" id="ctrl-bond-scale" min="0.2" max="3" step="0.1" />
</label>
</div>
<div class="ctrl-section">
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-force-fallback" />
<span>Force local lookup</span>
</label>
</div>
<div class="ctrl-section">
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-space-filling" />
<span>Space-filling (CPK)</span>
</label>
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-auto-rotate" />
<span>Auto-rotate</span>
</label>
<label class="ctrl-toggle">
<input type="checkbox" id="ctrl-highlight-pi" />
<span>Highlight π Systems</span>
</label>
</div>
</div>
<div id="tab-style" class="tab-content">
<div class="ctrl-section">
<span class="ctrl-label">View Preset</span>
<div class="preset-row">
<button class="view-preset-btn active" data-preset="all">All</button>
<button class="view-preset-btn" data-preset="sigma-only">σ</button>
</div>
<div class="preset-row">
<button class="view-preset-btn" data-preset="pi-only">π</button>
<button class="view-preset-btn" data-preset="lone-pairs-only">LP</button>
</div>
</div>
<div class="ctrl-section">
<span class="ctrl-label">Style</span>
<div class="preset-row">
<button class="preset-btn" data-preset="glass">Glass</button>
<button class="preset-btn" data-preset="glossy">Glossy</button>
<button class="preset-btn" data-preset="matte">Matte</button>
<button class="preset-btn active" data-preset="metallic">Metal</button>
</div>
</div>
<div class="ctrl-section">
<span class="ctrl-label">Colors</span>
<div class="cs-row" id="cs-presets">
<button class="cs-btn active" data-cs="element">Element</button>
<button class="cs-btn" data-cs="monochrome">Mono</button>
<button class="cs-btn" data-cs="pedagogical">Pedagog</button>
<button class="cs-btn" data-cs="complementary">Compl</button>
<button class="cs-btn" data-cs="cool">Cool</button>
<button class="cs-btn" data-cs="warm">Warm</button>
<button class="cs-btn" data-cs="highcontrast">HC</button>
<button class="cs-btn" data-cs="custom">Custom</button>
</div>
<div id="cs-custom" class="cs-custom hidden">
<div class="cs-channel"><span class="cs-label">σ</span><input type="color" class="cs-color" value="#4488ff" /></div>
<div class="cs-channel"><span class="cs-label">π</span><input type="color" class="cs-color" value="#4488ff" /></div>
<div class="cs-channel"><span class="cs-label">LP</span><input type="color" class="cs-color" value="#ffaa44" /></div>
</div>
</div>
<div class="ctrl-section">
<span class="ctrl-label">Background</span>
<div class="bg-row">
<button class="bg-btn" data-bg="#111118" style="background:#111118"></button>
<button class="bg-btn" data-bg="#1a1a2e" style="background:#1a1a2e"></button>
<button class="bg-btn" data-bg="#2d2d2d" style="background:#2d2d2d"></button>
<button class="bg-btn" data-bg="#cccccc" style="background:#cccccc"></button>
<button class="bg-btn active" data-bg="#ffffff" style="background:#ffffff"></button>
<input type="color" id="ctrl-bg-custom" value="#ffffff" title="Custom" />
</div>
</div>
</div>
<div id="tab-export" class="tab-content">
<div class="ctrl-section">
<span class="ctrl-label">Image</span>
<div class="export-row">
<button id="ctrl-export-png" class="export-btn">PNG</button>
<span class="export-note">2×</span>
</div>
</div>
<div class="ctrl-section">
<span class="ctrl-label">Structure</span>
<div class="export-row">
<button id="ctrl-export-sdf" class="export-btn">SDF</button>
<button id="ctrl-export-xyz" class="export-btn">XYZ</button>
</div>
</div>
<div class="ctrl-section">
<span class="clipboard-row">
<button id="ctrl-copy-smiles" class="export-btn">Copy SMILES</button>
<span id="clipboard-feedback" class="hidden">Copied!</span>
</span>
</div>
<div class="ctrl-section">
<span class="ctrl-label">View</span>
<div class="view-row">
<button id="ctrl-save-view" class="export-btn">Save View (.json)</button>
<button id="ctrl-load-view" class="export-btn">Load View</button>
<input type="file" id="ctrl-load-view-input" accept=".json,application/json" />
<button id="ctrl-share-link" class="export-btn">Copy Share Link</button>
<span id="share-feedback" class="hidden">Link copied!</span>
</div>
</div>
</div>
<div id="tab-measure" class="tab-content">
<div class="ctrl-section">
<span class="ctrl-label">Measurement Mode</span>
<div class="export-row">
<button id="ctrl-measure-toggle" class="export-btn">Enable</button>
</div>
<p class="measure-hint">Click 2 atoms for distance, 3 for angle, 4 for dihedral.</p>
<div id="measure-points"></div>
<div id="measure-result"></div>
<button id="ctrl-measure-clear" class="export-btn measure-clear hidden">Clear</button>
</div>
<div class="ctrl-section">
<span class="ctrl-label">Annotations</span>
<div class="export-row">
<button id="ctrl-add-annotation" class="export-btn">Add Annotation</button>
<button id="ctrl-clear-annotations" class="export-btn">Clear All</button>
</div>
<p class="measure-hint">Add a text callout to the canvas. Drag to position, type to edit.</p>
</div>
</div>
</div>
<!-- Floating action buttons -->
<div id="canvas-actions">
<button id="reset-view-btn" title="Reset view (R)">⟲</button>
<button id="help-btn" title="Help (?)">?</button>
</div>
<!-- Orbital labels legend -->
<div id="orbital-legend" class="hidden">
<span class="legend-item"><span class="legend-dot sigma"></span> σ</span>
<span class="legend-item"><span class="legend-dot pi"></span> π</span>
<span class="legend-item"><span class="legend-dot lone-pair"></span> Lone pair</span>
</div>
<!-- Loading overlay -->
<div id="loading-overlay" class="hidden">
<div class="loading-spinner"></div>
<span id="loading-text">Rendering...</span>
</div>
<div id="tooltip" class="hidden"></div>
</div>
</div>
<div id="cite-dialog" class="hidden">
<div id="cite-content">
<button id="cite-close">×</button>
<h3>How to cite Valence</h3>
<p>If you use Valence in your work, please cite it as:</p>
<code id="cite-text">Valence v0.8.0 — Valence Bond Visualization (2026).<br/>McCann, B. W. https://github.com/exergonic/valence</code>
<button id="cite-copy" class="brand-btn">Copy to clipboard</button>
</div>
</div>
<div id="help-dialog" class="hidden">
<div id="help-content">
<button id="help-close">×</button>
<h3>How to use Valence</h3>
<ul>
<li><strong>Draw</strong> a molecule in the sketcher (left panel)</li>
<li>Click <strong>Render Molecule</strong> or press <kbd>Enter</kbd></li>
<li><strong>Hover</strong> orbitals to see their type (σ, π, lone pair)</li>
<li><strong>Rotate</strong> the view by dragging, <strong>zoom</strong> with scroll</li>
<li>Press <strong>R</strong> to reset the view</li>
<li>Try the <strong>Examples</strong> dropdown in the <strong>Build</strong> tab for pre-built molecules</li>
<li>Use the <strong>Style</strong> tab to change colors and materials</li>
<li>Use <strong>Measure</strong> tab to click atoms and measure distances/angles/dihedrals</li>
<li><strong>Export</strong> as PNG, SDF, XYZ, or copy the SMILES</li>
</ul>
<button id="help-ok" class="brand-btn">Got it</button>
</div>
</div>
<script src="/jsme/jsme.nocache.js"></script>
<script>
function jsmeOnLoad() {
window.jsmeApplet = new JSApplet.JSME("jsme_container", "100%", "100%", {"options": "newlook,star", "guicolor": "#f5f5f5"});
window.jsmeApplet.setMenuScale(1.5);
window.jsmeApplet.setMolecularAreaScale(2.0);
}
</script>
<script type="module" src="/src/main.ts"></script>
</body>
</html>