-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
348 lines (324 loc) · 19.2 KB
/
index.html
File metadata and controls
348 lines (324 loc) · 19.2 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
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DGMD</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="app">
<!-- ─── Title Bar ─── -->
<div class="titlebar">
<span class="title">DGMD</span>
<div class="titlebar-buttons">
<button class="titlebar-button" id="settingsBtn" title="Settings">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>
</button>
</div>
</div>
<!-- ─── Main View ─── -->
<div class="content" id="mainView">
<div class="provider-badge not-ready" id="providerBadge">○ No provider configured</div>
<!-- Drop zone + paste zone -->
<div class="drop-zone" id="dropZone">
<div class="drop-zone-content">
<div class="drop-icon">
<svg width="44" height="44" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5"><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>
</div>
<p class="drop-text">Drop or paste an image</p>
<p class="drop-subtext">PNG, JPG, GIF, WebP — or ⌘V from clipboard</p>
</div>
</div>
<!-- Paste button (always visible when no image loaded) -->
<button class="btn btn-secondary paste-btn" id="pasteBtn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/><rect x="8" y="2" width="8" height="4" rx="1" ry="1"/></svg>
Paste from clipboard
</button>
<!-- Image preview -->
<div class="preview-area" id="previewArea" style="display: none;">
<div class="preview-image-container">
<img id="previewImage" class="preview-image" alt="Preview">
<button class="remove-btn" id="removeBtn">×</button>
</div>
<div class="preview-info">
<span id="fileName">image.png</span>
<span id="fileSize">0 KB</span>
</div>
</div>
<div class="actions">
<button class="btn btn-primary" id="generateBtn" disabled>
<span class="btn-text">Generate design.md + Style Prompt</span>
<span class="btn-loading" style="display: none;">
<svg class="spinner" width="16" height="16" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3" fill="none" stroke-dasharray="30 70"/></svg>
Analyzing…
</span>
</button>
</div>
<div class="status" id="status" style="display: none;"></div>
</div>
<!-- ─── Settings Popup ─── -->
<div class="settings-modal" id="settingsView" aria-hidden="true">
<div class="settings-scrim" id="settingsScrim"></div>
<div class="settings-panel" role="dialog" aria-modal="true" aria-labelledby="settingsTitle">
<div class="settings-panel-header">
<div class="settings-header-copy">
<span class="settings-kicker">Preferences</span>
<span class="title" id="settingsTitle">Settings</span>
<p class="settings-subtitle">Choose a provider, save credentials, and apply provider changes when ready.</p>
</div>
<button class="settings-close-btn" id="backBtn" aria-label="Close settings">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>
</button>
</div>
<div class="settings-content">
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Provider</p>
<h2 class="settings-card-title">Active model source</h2>
<p class="settings-card-summary" id="providerSectionSummary">Current: OpenAI</p>
</div>
</div>
<div class="provider-grid">
<button class="toggle-btn active" id="providerOpenAI">OpenAI</button>
<button class="toggle-btn" id="providerAnthropic">Anthropic</button>
<button class="toggle-btn" id="providerGemini">Gemini</button>
<button class="toggle-btn" id="providerOllama">Ollama</button>
</div>
</section>
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Configuration</p>
<h2 class="settings-card-title">Credentials and connection</h2>
<p class="settings-card-summary" id="configSectionSummary">Set up the selected provider.</p>
</div>
</div>
<div class="provider-section" id="openaiSettings">
<div class="setting-group">
<label class="setting-label" for="apiKeyInput">OpenAI API Key</label>
<div class="setting-action-row">
<input type="password" class="input" id="apiKeyInput" placeholder="sk-…">
<button class="btn btn-secondary btn-sm" id="saveApiKeyBtn">Save</button>
</div>
</div>
</div>
<div class="provider-section" id="anthropicSettings" style="display:none;">
<div class="setting-group">
<label class="setting-label" for="anthropicKeyInput">Anthropic API Key</label>
<div class="setting-action-row">
<input type="password" class="input" id="anthropicKeyInput" placeholder="sk-ant-…">
<button class="btn btn-secondary btn-sm" id="saveAnthropicKeyBtn">Save</button>
</div>
</div>
</div>
<div class="provider-section" id="geminiSettings" style="display:none;">
<div class="setting-group">
<label class="setting-label" for="geminiKeyInput">Gemini API Key</label>
<div class="setting-action-row">
<input type="password" class="input" id="geminiKeyInput" placeholder="AI…">
<button class="btn btn-secondary btn-sm" id="saveGeminiKeyBtn">Save</button>
</div>
</div>
</div>
<div class="provider-section" id="ollamaSettings" style="display:none;">
<div class="setting-stack">
<div class="setting-group">
<label class="setting-label" for="ollamaUrlInput">Server URL</label>
<div class="setting-action-row">
<input type="text" class="input" id="ollamaUrlInput" placeholder="http://localhost:11434">
<button class="btn btn-secondary btn-icon" id="testOllamaBtn" title="Test & fetch models">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
</button>
</div>
</div>
<div class="settings-subcard">
<div class="setting-group">
<label class="setting-label" for="ollamaModelSelect">Model</label>
<select class="input select" id="ollamaModelSelect">
<option value="" disabled selected>— click ↻ to load —</option>
</select>
<p class="hint-block">Vision: <b>llava</b>, <b>gemma3</b>, <b>moondream</b></p>
</div>
<div class="ollama-status" id="ollamaStatus">
<span class="status-dot"></span>
<span class="status-text">Not connected</span>
</div>
</div>
</div>
</div>
<div class="settings-inline-actions">
<button class="btn btn-danger btn-sm" id="resetCredentialsBtn">Reset all credentials</button>
</div>
</section>
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Output</p>
<h2 class="settings-card-title">Generation mode</h2>
<p class="settings-card-summary" id="outputSectionSummary">Include text from image</p>
</div>
</div>
<div class="setting-row setting-row-surface setting-row-toggle">
<div class="setting-toggle-copy">
<span class="setting-label">Shell only</span>
<span class="hint-block">Ignore visible words and numbers from the screenshot. Keep only layout, structure, styling, and text hierarchy.</span>
</div>
<label class="switch">
<input type="checkbox" id="shellOnlyInput">
<span class="switch-ui"></span>
</label>
</div>
</section>
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Color locks</p>
<h2 class="settings-card-title">Lock design.md colors</h2>
<p class="settings-card-summary" id="colorLocksSummary">No locked colors</p>
</div>
<button class="settings-section-toggle" id="colorLocksToggle" type="button" aria-expanded="false" aria-controls="colorLocksBody">
<svg class="settings-section-chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>
</button>
</div>
<div class="settings-section-body is-collapsed" id="colorLocksBody">
<div class="color-lock-grid" id="colorLocksGrid">
<div class="color-lock-row">
<label class="color-lock-label" for="lock-primary">Primary</label>
<input type="checkbox" class="color-lock-check" id="lock-primary">
<input type="color" class="color-lock-picker" id="color-primary" value="#0A84FF">
<input type="text" class="input color-lock-hex" id="hex-primary" value="#0A84FF" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-secondary">Secondary</label>
<input type="checkbox" class="color-lock-check" id="lock-secondary">
<input type="color" class="color-lock-picker" id="color-secondary" value="#30D158">
<input type="text" class="input color-lock-hex" id="hex-secondary" value="#30D158" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-background">Background</label>
<input type="checkbox" class="color-lock-check" id="lock-background">
<input type="color" class="color-lock-picker" id="color-background" value="#111111">
<input type="text" class="input color-lock-hex" id="hex-background" value="#111111" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-surface">Surface</label>
<input type="checkbox" class="color-lock-check" id="lock-surface">
<input type="color" class="color-lock-picker" id="color-surface" value="#1C1C1E">
<input type="text" class="input color-lock-hex" id="hex-surface" value="#1C1C1E" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-accent">Accent</label>
<input type="checkbox" class="color-lock-check" id="lock-accent">
<input type="color" class="color-lock-picker" id="color-accent" value="#FFD60A">
<input type="text" class="input color-lock-hex" id="hex-accent" value="#FFD60A" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-success">Success</label>
<input type="checkbox" class="color-lock-check" id="lock-success">
<input type="color" class="color-lock-picker" id="color-success" value="#30D158">
<input type="text" class="input color-lock-hex" id="hex-success" value="#30D158" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-error">Error</label>
<input type="checkbox" class="color-lock-check" id="lock-error">
<input type="color" class="color-lock-picker" id="color-error" value="#FF453A">
<input type="text" class="input color-lock-hex" id="hex-error" value="#FF453A" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-textPrimary">Text Primary</label>
<input type="checkbox" class="color-lock-check" id="lock-textPrimary">
<input type="color" class="color-lock-picker" id="color-textPrimary" value="#F5F5F7">
<input type="text" class="input color-lock-hex" id="hex-textPrimary" value="#F5F5F7" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-textSecondary">Text Secondary</label>
<input type="checkbox" class="color-lock-check" id="lock-textSecondary">
<input type="color" class="color-lock-picker" id="color-textSecondary" value="#8E8E93">
<input type="text" class="input color-lock-hex" id="hex-textSecondary" value="#8E8E93" spellcheck="false">
</div>
<div class="color-lock-row">
<label class="color-lock-label" for="lock-border">Border</label>
<input type="checkbox" class="color-lock-check" id="lock-border">
<input type="color" class="color-lock-picker" id="color-border" value="#3A3A3C">
<input type="text" class="input color-lock-hex" id="hex-border" value="#3A3A3C" spellcheck="false">
</div>
</div>
</div>
</section>
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Storage</p>
<h2 class="settings-card-title">Output directory</h2>
<p class="settings-card-summary" id="storageSectionSummary">~/design-md-files</p>
</div>
</div>
<div class="setting-row setting-row-surface">
<span class="setting-value" id="outputDirValue">~/design-md-files</span>
<button class="btn btn-secondary btn-sm" id="changeDirBtn">Change</button>
</div>
</section>
<section class="settings-card">
<div class="settings-card-head">
<div>
<p class="settings-card-kicker">Status</p>
<h2 class="settings-card-title">Readiness</h2>
<p class="settings-card-summary" id="statusSectionSummary">No provider configured</p>
</div>
</div>
<div class="api-status" id="apiStatus">
<span class="status-dot"></span>
<span class="status-text">No provider configured</span>
</div>
</section>
</div>
<div class="settings-panel-footer">
<button class="btn btn-ghost btn-sm" id="cancelSettingsBtn">Cancel</button>
<button class="btn btn-primary btn-sm" id="applySettingsBtn" disabled>Apply</button>
</div>
</div>
</div>
<!-- ─── Result View ─── -->
<div class="content" id="resultView" style="display: none;">
<div class="settings-header">
<button class="back-btn" id="resultBackBtn"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="15 18 9 12 15 6"/></svg></button>
<span class="title">Result</span>
</div>
<div class="result-tabs">
<button class="result-tab active" id="tabDesignMd">
<svg width="12" height="12" 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"/></svg>
design.md
</button>
<button class="result-tab" id="tabStylePrompt">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
Style Prompt
</button>
<button class="result-tab" id="tabCombined">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M8 6h13"/><path d="M8 12h13"/><path d="M8 18h13"/><path d="M3 6h.01"/><path d="M3 12h.01"/><path d="M3 18h.01"/></svg>
Combined
</button>
</div>
<div class="result-content">
<textarea class="result-textarea" id="resultTextarea" readonly></textarea>
</div>
<div class="result-actions">
<button class="btn btn-primary" id="copyBtn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
Copy
</button>
<button class="btn btn-secondary" id="saveBtn">
<svg width="14" height="14" 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>
Save
</button>
<button class="btn btn-secondary" id="saveBothBtn">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
Both
</button>
</div>
</div>
</div>
<script src="renderer.js"></script>
</body>
</html>