-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
243 lines (239 loc) · 12.4 KB
/
index.html
File metadata and controls
243 lines (239 loc) · 12.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
<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, orientation=portrait, maximum-scale=1.0, user-scalable=no, viewport-fit=cover">
<meta name="screen-orientation" content="portrait">
<meta name="x5-orientation" content="portrait">
<title>K-Map Solver</title>
<meta name="description"
content="A lightweight, dependency-free Karnaugh map solver with truth table visualization and 2-4 variable support. Features color-coded term grouping with wraparound highlighting. Works offline and includes light/dark themes for enhanced usability.">
<meta property="og:title" content="K-Map Solver">
<meta property="og:description"
content="A lightweight, dependency-free Karnaugh map solver with truth table visualization and 2-4 variable support. Features color-coded term grouping with wraparound highlighting. Works offline and includes light/dark themes for enhanced usability.">
<meta property="og:type" content="website">
<meta property="og:image" content="https://kmap.robonxt.xyz/assets/logo/kmap-logo-v1.jpeg">
<meta property="og:url" content="https://kmap.robonxt.xyz">
<link rel="icon" type="image/x-icon" href="assets/icon/favicon.ico">
<link rel="icon" type="image/svg+xml" href="assets/icon/favicon.svg" />
<link rel="icon" type="image/png" sizes="192x192" href="assets/icon/android-chrome-192.png">
<link rel="icon" type="image/png" sizes="512x512" href="assets/icon/android-chrome-512.png">
<link rel="apple-touch-icon" href="assets/icon/apple-touch-icon.png">
<meta name="msapplication-TileImage" content="assets/icon/mstile.png">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="theme-color" content="#ffffff">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="guidelines/tokens.css">
<link rel="stylesheet" href="guidelines/components.css">
<link rel="stylesheet" href="styles.css">
<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=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0&display=swap"
rel="stylesheet">
<!-- Prevent Theme Flash -->
<script>
(function () {
const saved = localStorage.getItem('theme');
const theme = saved || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', theme);
})();
</script>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('sw.js')
.then(registration => {
console.log('Service Worker registered successfully');
})
.catch(error => {
console.warn('Service Worker registration failed:', error);
});
});
}
</script>
</head>
<body>
<div class="container">
<div class="overlay-popup" id="popup-settings">
<div class="wrapper-popup">
<div class="modal-header">
<h2>Settings</h2>
<button class="btn btn-icon" id="btn-popup-close-settings" aria-label="Close">
<span class="material-symbols-rounded">close</span>
</button>
</div>
<div class="modal-body" id="content-settings">
<div class="settings-grid">
<button id="btn-toggle-theme" class="btn btn-outline">
<span class="material-symbols-rounded icon-theme-light">light_mode</span>
<span class="material-symbols-rounded icon-theme-dark">dark_mode</span>
Toggle Theme
</button>
<button id="btn-toggle-zeros" class="btn btn-outline">
<span class="material-symbols-rounded">visibility_off</span>
Toggle Zeros
</button>
<button id="btn-update-app" class="btn btn-danger">
<span class="material-symbols-rounded">refresh</span>
Update
</button>
</div>
</div>
</div>
</div>
<div class="overlay-popup" id="popup-info">
<div class="wrapper-popup">
<div class="modal-header">
<div class="modal-titlebar">
<img src="assets/icon/android-chrome-192.png" alt="K-Map Logo" class="modal-logo">
<h2>K-Map Solver</h2>
</div>
<button class="btn btn-icon" id="btn-popup-close-info" aria-label="Close">
<span class="material-symbols-rounded">close</span>
</button>
</div>
<div class="modal-body" id="content-info">
<p>
Quickly simplify Boolean logic with an interactive Karnaugh map (K-map) for 2–4 variables.
Toggle cells, see solutions instantly, and switch between K-map and truth table views.
</p>
<ul>
<li><b>Set Variables:</b> Choose 2–4 variables. The grid updates automatically.</li>
<li><b>Edit Cells:</b> Click cells to cycle: 0 → 1 → X (“don’t care”).</li>
<li><b>Features:</b> Color-coded groups, Gray/Binary layouts, hide zeros, light/dark themes, PWA
offline support.</li>
<li><b>Solution:</b> Minimal SOP form, copyable, multiple solutions if available.</li>
</ul>
<ul>
<li><b>A</b> = 1 (true), <b>A̅</b> = 0 (false), blank = 0</li>
<li>Example: A̅BC̅ means A=0, B=1, C=0</li>
</ul>
</div>
<div class="modal-footer has-credit">
<span class="modal-credit">Created by <a href="https://robonxt.xyz"
target="_blank">robonxt</a></span>
<a href="https://github.com/robonxt/web-kmap" target="_blank" class="btn btn-outline">
<span class="material-symbols-rounded">info</span>
View on GitHub
</a>
</div>
</div>
</div>
<header class="kmap-header">
<nav class="header-nav" id="header-nav">
<button class="nav-toggle btn btn-icon" id="nav-toggle" aria-label="Toggle menu" aria-expanded="false">
<span class="material-symbols-rounded">menu</span>
</button>
<span class="nav-title" id="nav-title">K-Map</span>
<div class="nav-items pill-selector-group" id="nav-items">
<div class="pill-selector-slider"></div>
<button class="btn-pill active" id="btn-tab-kmap" data-tab="kmap">K-Map</button>
<button class="btn-pill" id="btn-tab-truthtable" data-tab="truthtable">Truth Table</button>
</div>
</nav>
<div class="header-actions">
<button class="btn btn-icon" id="btn-show-settings" aria-label="Settings">
<span class="material-symbols-rounded">settings</span>
</button>
<button class="btn btn-icon" id="btn-show-info" aria-label="Information">
<span class="material-symbols-rounded">info</span>
</button>
</div>
</header>
<div class="container-solution">
<div class="solution-toolbar">
<div id="solution" class="solution-text"></div>
<div class="dropdown" id="dropdown-solutions-container" style="display: none;">
<button class="btn-dropdown" id="dropdown-solutions-toggle">
<span id="dropdown-solutions-label">Solutions</span>
</button>
<div class="dropdown-menu" id="dropdown-solutions-menu"></div>
</div>
<button id="btn-copy-solution" class="btn btn-icon" title="Copy to clipboard">
<span class="material-symbols-rounded">content_copy</span>
</button>
</div>
</div>
<div class="container-control">
<div class="dropdown" id="dropdown-variables-container">
<button class="btn-dropdown" id="dropdown-variables-toggle">
<span id="dropdown-variables-label">4 Vars</span>
</button>
<div class="dropdown-menu" id="dropdown-variables-menu">
<button class="dropdown-item" data-value="4">4 Vars</button>
<button class="dropdown-item" data-value="3">3 Vars</button>
<button class="dropdown-item" data-value="2">2 Vars</button>
</div>
</div>
<button id="btn-toggle-layout" class="svg-button gray-layout" aria-label="Toggle Layout"
title="Switch Layout">
<span class="material-symbols-rounded icon-layout-gray">grid_view</span>
<span class="material-symbols-rounded icon-layout-binary">view_module</span>
<span class="layout-text">CD/AB</span>
</button>
<button class="svg-button" id="btn-set-ones">
<span class="material-symbols-rounded">check</span>
All 1
</button>
<button class="svg-button" id="btn-set-xs">
<span class="material-symbols-rounded">close</span>
All X
</button>
<button class="svg-button" id="btn-set-zeros">
<span class="material-symbols-rounded">radio_button_unchecked</span>
All 0
</button>
</div>
<div class="tab-content-container active" id="kmap">
<div class="kmap-grid" id="kmap-grid"></div>
</div>
<div class="tab-content-container" id="truthtable">
<table class="truth-table">
<thead>
<tr>
<th>#</th>
<th>A</th>
<th>B</th>
<th class="var-c">C</th>
<th class="var-d">D</th>
<th>Output</th>
</tr>
</thead>
<tbody id="truth-table-body"></tbody>
</table>
</div>
</div>
<div class="overlay-popup" id="popup-update-confirm">
<div class="wrapper-popup">
<div class="modal-header">
<h2>Confirm update</h2>
<button class="btn btn-icon" id="btn-popup-close-update-confirm" aria-label="Close">
<span class="material-symbols-rounded">close</span>
</button>
</div>
<div class="modal-body" id="content-update-confirm">
<p>This will clear ALL cached data (including preferences) and force a fresh update. Continue?</p>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" id="btn-cancel-update">Cancel</button>
<button class="btn btn-danger" id="btn-confirm-update">Update</button>
</div>
</div>
</div>
<script src="kmap-solver.js" defer></script>
<script src="kmap-interface.js" defer></script>
<script>
document.addEventListener('DOMContentLoaded', () => {
new KMapInterface();
const btnUpdateApp = document.getElementById('btn-update-app');
const btnConfirmUpdate = document.getElementById('btn-confirm-update');
const btnCancelUpdate = document.getElementById('btn-cancel-update');
const popupUpdateConfirm = document.getElementById('popup-update-confirm');
});
</script>
</body>
</html>