iconpeek 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/index.html +397 -0
  2. package/package.json +3 -1
  3. package/server.js +81 -1014
  4. package/style.css +772 -0
package/index.html ADDED
@@ -0,0 +1,397 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>iconpeek</title>
7
+ <style id="main-styles"></style>
8
+ </head>
9
+ <body>
10
+ <header class="header">
11
+ <div class="brand">
12
+ <div class="brand-mark"></div>
13
+ <div>
14
+ <h1 class="brand-title">iconpeek</h1>
15
+ <p class="brand-copy">Your live real-time playground for Expo icons & splash screens ✨</p>
16
+ </div>
17
+ </div>
18
+ <div class="header-pill">Zero Dependencies</div>
19
+ </header>
20
+
21
+ <main class="page">
22
+
23
+
24
+ <section class="warning-banner" id="warningBanner"></section>
25
+
26
+ <section class="grid">
27
+ <article class="card">
28
+ <div class="card-head">
29
+ <h3 class="card-title">Android Adaptive Icon Simulator</h3>
30
+ <div class="controls">
31
+ <div class="segment" id="shapeControl">
32
+ <button type="button" data-shape="squircle" class="active">Squircle</button>
33
+ <button type="button" data-shape="rounded">Rounded</button>
34
+ <button type="button" data-shape="circle">Circle</button>
35
+ <button type="button" data-shape="square">Square</button>
36
+ </div>
37
+ <label class="toggle">
38
+ <input type="checkbox" id="safeZoneToggle">
39
+ Show safe zone
40
+ </label>
41
+ </div>
42
+ </div>
43
+
44
+ <div class="stage">
45
+ <div class="adaptive-wrap">
46
+ <div class="adaptive-mask mask-squircle" id="adaptiveMask">
47
+ <div class="adaptive-layer adaptive-bg" id="adaptiveBg"></div>
48
+ <div class="adaptive-layer adaptive-fg" id="adaptiveFg"></div>
49
+ <div class="safe-zone" id="safeZone">
50
+ <!-- <span>66dp Safe Zone</span> -->
51
+ </div>
52
+ </div>
53
+ <div class="shape-caption" id="shapeCaption">Android 12+ default squircle mask</div>
54
+ </div>
55
+ </div>
56
+
57
+ <div class="spec-grid">
58
+ <div class="spec-pill"><strong>Layer Canvas</strong><span>108dp / 324px</span></div>
59
+ <div class="spec-pill"><strong>Visible Mask</strong><span>72dp / 216px</span></div>
60
+ <div class="spec-pill"><strong>Safe Zone</strong><span>66dp / 198px</span></div>
61
+ <div class="spec-pill"><strong>BG Color</strong><span id="bgColorValue">#FFFFFF</span></div>
62
+ <div class="spec-pill"><strong>Crop Margin</strong><span>18dp / 54px</span></div>
63
+ <div class="spec-pill"><strong>Preview Scale</strong><span>3x</span></div>
64
+ </div>
65
+
66
+ <div class="size-row" id="androidSizeRow"></div>
67
+ </article>
68
+
69
+ <article class="card">
70
+ <div class="card-head">
71
+ <h3 class="card-title">iOS Icon Preview</h3>
72
+ <span class="header-pill" style="padding: 0.35rem 0.65rem; font-size: 0.66rem; letter-spacing: 0.04em;">Flat Asset</span>
73
+ </div>
74
+ <div class="ios-preview">
75
+ <div class="ios-mask">
76
+ <img src="/assets/ios-icon" alt="iOS app icon">
77
+ </div>
78
+ <div class="hint">iOS app icons should be opaque; this preview approximates the system mask so you can judge edge composition quickly.</div>
79
+ </div>
80
+ <div class="size-row" id="iosSizeRow"></div>
81
+ </article>
82
+ </section>
83
+
84
+ <section class="context">
85
+ <article class="card">
86
+ <div class="card-head">
87
+ <h3 class="card-title">Android Launcher Context</h3>
88
+ <div class="hint">96x96 highlight ring in a mock launcher grid</div>
89
+ </div>
90
+ <div class="screen android-screen">
91
+ <div class="screen-grid">
92
+ <div class="app-chip">
93
+ <div class="placeholder" style="background: linear-gradient(135deg, #2563eb, #38bdf8);">MSG</div>
94
+ <div class="app-label">Messages</div>
95
+ </div>
96
+ <div class="app-chip">
97
+ <div class="launcher-mask ring mask-squircle" id="launcherMask" style="width: 96px; height: 96px;">
98
+ <div class="launcher-bg" id="launcherBg"></div>
99
+ <div class="launcher-fg" id="launcherFg"></div>
100
+ </div>
101
+ <div class="app-label" id="androidAppLabel">{{EXPO_NAME}}</div>
102
+ </div>
103
+ <div class="app-chip">
104
+ <div class="placeholder" style="background: linear-gradient(135deg, #16a34a, #4ade80);">IMG</div>
105
+ <div class="app-label">Gallery</div>
106
+ </div>
107
+ <div class="app-chip">
108
+ <div class="placeholder" style="background: linear-gradient(135deg, #9333ea, #c084fc);">AUD</div>
109
+ <div class="app-label">Music</div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </article>
114
+
115
+ <article class="card">
116
+ <div class="card-head">
117
+ <h3 class="card-title">iOS Homescreen Context</h3>
118
+ <div class="hint">96x96 highlight ring in a mock homescreen grid</div>
119
+ </div>
120
+ <div class="screen ios-screen">
121
+ <div class="screen-grid">
122
+ <div class="app-chip">
123
+ <div class="placeholder ios-placeholder" style="background: linear-gradient(135deg, #0ea5e9, #67e8f9);">TEL</div>
124
+ <div class="app-label">Phone</div>
125
+ </div>
126
+ <div class="app-chip">
127
+ <div class="ios-placeholder ring" style="width: 96px; height: 96px; border-radius: 21px; overflow: hidden; background: #fff;">
128
+ <img src="/assets/ios-icon" alt="iOS homescreen icon" style="width: 100%; height: 100%; object-fit: cover; display: block;">
129
+ </div>
130
+ <div class="app-label" id="iosAppLabel">{{EXPO_NAME}}</div>
131
+ </div>
132
+ <div class="app-chip">
133
+ <div class="placeholder ios-placeholder" style="background: linear-gradient(135deg, #f59e0b, #fcd34d);">SET</div>
134
+ <div class="app-label">Settings</div>
135
+ </div>
136
+ <div class="app-chip">
137
+ <div class="placeholder ios-placeholder" style="background: linear-gradient(135deg, #dc2626, #fb7185);">HLT</div>
138
+ <div class="app-label">Health</div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+ </article>
143
+ </section>
144
+
145
+ <section class="card">
146
+ <div class="card-head">
147
+ <h3 class="card-title">Splash Screen Preview</h3>
148
+ <div class="hint">Light and dark frames with auto-inverted status bar text based on background luminance</div>
149
+ </div>
150
+ <div class="splash-pair">
151
+ <div class="phone">
152
+ <div class="notch"></div>
153
+ <div class="statusbar" id="statusbarLight">
154
+ <span>9:41</span>
155
+ <div style="display: flex; gap: 4px; align-items: center;">
156
+ <!-- Signal icon -->
157
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M2 22h20V2z"/></svg>
158
+ <!-- WiFi icon -->
159
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 21l-12-18c6.627-6 17.373-6 24 0z"/></svg>
160
+ <!-- Battery icon -->
161
+ <svg width="14" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M17 5H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm4 4v6h2V9h-2z"/></svg>
162
+ </div>
163
+ </div>
164
+ <div class="splash-surface" id="splashLightSurface">
165
+ <img class="splash-image" src="/assets/splash" alt="Light splash preview">
166
+ <div class="theme-chip light">Light Mode</div>
167
+ </div>
168
+ </div>
169
+ <div class="phone">
170
+ <div class="notch"></div>
171
+ <div class="statusbar" id="statusbarDark">
172
+ <span>9:41</span>
173
+ <div style="display: flex; gap: 4px; align-items: center;">
174
+ <!-- Signal icon -->
175
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M2 22h20V2z"/></svg>
176
+ <!-- WiFi icon -->
177
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M12 21l-12-18c6.627-6 17.373-6 24 0z"/></svg>
178
+ <!-- Battery icon -->
179
+ <svg width="14" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M17 5H3a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm4 4v6h2V9h-2z"/></svg>
180
+ </div>
181
+ </div>
182
+ <div class="splash-surface" id="splashDarkSurface">
183
+ <img class="splash-image" src="/assets/splash-dark" alt="Dark splash preview">
184
+ <div class="theme-chip dark">Dark Mode</div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+ <div class="footnote" id="splashFootnote">Splash image width defaults to 38% of the frame width unless imageWidth is set in Expo config.</div>
189
+ </section>
190
+ </main>
191
+
192
+ <script>
193
+ let STATE = {};
194
+ const shapeMap = {
195
+ squircle: { className: 'mask-squircle', caption: 'Android 12+ default squircle mask' },
196
+ rounded: { className: 'mask-rounded', caption: 'Rounded rectangle mask' },
197
+ circle: { className: 'mask-circle', caption: 'Circle mask' },
198
+ square: { className: 'mask-square', caption: 'Square mask' }
199
+ };
200
+ const maskClasses = Object.values(shapeMap).map((entry) => entry.className);
201
+ const androidSizes = [
202
+ { px: 36, label: 'Status bar', dp: '24dp' },
203
+ { px: 54, label: 'Notification', dp: '36dp' },
204
+ { px: 72, label: 'Launcher', dp: '48dp' },
205
+ { px: 96, label: 'App drawer', dp: '64dp' }
206
+ ];
207
+ const iosSizes = [
208
+ { px: 40, label: 'Settings', pt: '29pt' },
209
+ { px: 57, label: 'Spotlight', pt: '40pt' },
210
+ { px: 86, label: 'Home Screen', pt: '60pt' },
211
+ { px: 128, label: 'App Store display', pt: '1024px source' }
212
+ ];
213
+
214
+ function isDarkColor(hex) {
215
+ const normalized = (hex || '#FFFFFF').replace('#', '');
216
+ const expanded = normalized.length === 3
217
+ ? normalized.split('').map((char) => char + char).join('')
218
+ : normalized;
219
+ const r = parseInt(expanded.slice(0, 2), 16);
220
+ const g = parseInt(expanded.slice(2, 4), 16);
221
+ const b = parseInt(expanded.slice(4, 6), 16);
222
+ return (0.299 * r + 0.587 * g + 0.114 * b) < 128;
223
+ }
224
+
225
+ function buildAndroidSizeRow() {
226
+ const container = document.getElementById('androidSizeRow');
227
+ container.innerHTML = '';
228
+ const bgColor = STATE.expo.adaptiveBackgroundColor;
229
+ androidSizes.forEach((item) => {
230
+ const mask = document.createElement('div');
231
+ mask.className = 'mini-mask mask-squircle';
232
+ mask.style.width = item.px + 'px';
233
+ mask.style.height = item.px + 'px';
234
+
235
+ const layerSize = item.px * (108 / 72);
236
+ const offset = (layerSize - item.px) / 2;
237
+
238
+ const bg = document.createElement('div');
239
+ bg.className = 'mini-bg';
240
+ bg.style.width = layerSize + 'px';
241
+ bg.style.height = layerSize + 'px';
242
+ bg.style.left = (-offset) + 'px';
243
+ bg.style.top = (-offset) + 'px';
244
+ bg.style.backgroundColor = bgColor;
245
+
246
+ const fg = document.createElement('div');
247
+ fg.className = 'mini-fg';
248
+ fg.style.width = layerSize + 'px';
249
+ fg.style.height = layerSize + 'px';
250
+ fg.style.left = (-offset) + 'px';
251
+ fg.style.top = (-offset) + 'px';
252
+ fg.style.backgroundImage = "url('/assets/icon')";
253
+
254
+ mask.appendChild(bg);
255
+ mask.appendChild(fg);
256
+
257
+ const itemNode = document.createElement('div');
258
+ itemNode.className = 'size-item';
259
+ itemNode.appendChild(mask);
260
+
261
+ const label = document.createElement('div');
262
+ label.className = 'size-label';
263
+ label.innerHTML = item.px + '&times;' + item.px + 'px<br>' + item.dp + ' ' + item.label;
264
+ itemNode.appendChild(label);
265
+
266
+ container.appendChild(itemNode);
267
+ });
268
+ }
269
+
270
+ function buildIosSizeRow() {
271
+ const container = document.getElementById('iosSizeRow');
272
+ container.innerHTML = '';
273
+ iosSizes.forEach((item) => {
274
+ const itemNode = document.createElement('div');
275
+ itemNode.className = 'size-item';
276
+
277
+ const mask = document.createElement('div');
278
+ mask.style.width = item.px + 'px';
279
+ mask.style.height = item.px + 'px';
280
+ mask.style.borderRadius = Math.round(item.px * 0.2237) + 'px';
281
+ mask.style.overflow = 'hidden';
282
+ mask.style.background = '#fff';
283
+ mask.style.boxShadow = '0 10px 20px rgba(0,0,0,0.35)';
284
+
285
+ const img = document.createElement('img');
286
+ img.src = '/assets/ios-icon';
287
+ img.alt = item.label;
288
+ img.style.width = '100%';
289
+ img.style.height = '100%';
290
+ img.style.objectFit = 'cover';
291
+ img.style.display = 'block';
292
+ mask.appendChild(img);
293
+
294
+ const label = document.createElement('div');
295
+ label.className = 'size-label';
296
+ label.innerHTML = item.px + '&times;' + item.px + 'px<br>' + item.pt;
297
+
298
+ itemNode.appendChild(mask);
299
+ itemNode.appendChild(label);
300
+ container.appendChild(itemNode);
301
+ });
302
+ }
303
+
304
+ function setShape(shape) {
305
+ const mapping = shapeMap[shape] || shapeMap.squircle;
306
+ const adaptiveMask = document.getElementById('adaptiveMask');
307
+ const launcherMask = document.getElementById('launcherMask');
308
+
309
+ [adaptiveMask, launcherMask].forEach((element) => {
310
+ maskClasses.forEach((className) => element.classList.remove(className));
311
+ element.classList.add(mapping.className);
312
+ });
313
+
314
+ document.getElementById('shapeCaption').textContent = mapping.caption;
315
+ document.querySelectorAll('#shapeControl button').forEach((button) => {
316
+ button.classList.toggle('active', button.dataset.shape === shape);
317
+ });
318
+ }
319
+
320
+ function applyState() {
321
+ const warnings = STATE.warnings || [];
322
+ const warningBanner = document.getElementById('warningBanner');
323
+ if (warnings.length) {
324
+ warningBanner.style.display = 'block';
325
+ warningBanner.innerHTML = warnings.map((warning) => '<div>' + warning + '</div>').join('');
326
+ }
327
+
328
+ document.getElementById('adaptiveBg').style.backgroundColor = STATE.expo.adaptiveBackgroundColor;
329
+ document.getElementById('launcherBg').style.backgroundColor = STATE.expo.adaptiveBackgroundColor;
330
+ document.getElementById('bgColorValue').textContent = STATE.expo.adaptiveBackgroundColor;
331
+
332
+ document.getElementById('adaptiveFg').style.backgroundImage = "url('/assets/icon')";
333
+ document.getElementById('launcherFg').style.backgroundImage = "url('/assets/icon')";
334
+
335
+ document.getElementById('splashLightSurface').style.backgroundColor = STATE.expo.splashBackgroundColor;
336
+ document.getElementById('splashDarkSurface').style.backgroundColor = STATE.expo.splashDarkBackgroundColor;
337
+ document.getElementById('statusbarLight').style.color = isDarkColor(STATE.expo.splashBackgroundColor) ? '#FFFFFF' : '#000000';
338
+ document.getElementById('statusbarDark').style.color = isDarkColor(STATE.expo.splashDarkBackgroundColor) ? '#FFFFFF' : '#000000';
339
+ if (STATE.expo.splashImageWidth) {
340
+ document.querySelectorAll('.splash-image').forEach((image) => {
341
+ image.style.width = Math.max(24, Math.min(70, (STATE.expo.splashImageWidth / 200) * 100)) + '%';
342
+ });
343
+ document.getElementById('splashFootnote').textContent = 'Splash image width reflects Expo imageWidth: ' + STATE.expo.splashImageWidth + 'px.';
344
+ }
345
+
346
+ buildAndroidSizeRow();
347
+ buildIosSizeRow();
348
+ }
349
+
350
+ document.getElementById('shapeControl').addEventListener('click', (event) => {
351
+ if (event.target.tagName === 'BUTTON') {
352
+ setShape(event.target.dataset.shape);
353
+ }
354
+ });
355
+
356
+ document.getElementById('safeZoneToggle').addEventListener('change', (event) => {
357
+ document.getElementById('safeZone').style.display = event.target.checked ? 'block' : 'none';
358
+ });
359
+
360
+ const adaptiveMask = document.getElementById('adaptiveMask');
361
+ adaptiveMask.addEventListener('mousemove', (event) => {
362
+ const rect = adaptiveMask.getBoundingClientRect();
363
+ const x = event.clientX - rect.left;
364
+ const y = event.clientY - rect.top;
365
+ const dx = ((x / rect.width) - 0.5) * 32;
366
+ const dy = ((y / rect.height) - 0.5) * 32;
367
+ document.getElementById('adaptiveFg').style.transform = 'translate3d(' + dx.toFixed(2) + 'px,' + dy.toFixed(2) + 'px,0)';
368
+ });
369
+ adaptiveMask.addEventListener('mouseleave', () => {
370
+ document.getElementById('adaptiveFg').style.transform = 'translate3d(0,0,0)';
371
+ });
372
+
373
+ const launcherBg = document.getElementById('launcherBg');
374
+ const launcherFg = document.getElementById('launcherFg');
375
+ launcherBg.style.width = '144px';
376
+ launcherBg.style.height = '144px';
377
+ launcherBg.style.left = '-24px';
378
+ launcherBg.style.top = '-24px';
379
+ launcherFg.style.width = '144px';
380
+ launcherFg.style.height = '144px';
381
+ launcherFg.style.left = '-24px';
382
+ launcherFg.style.top = '-24px';
383
+
384
+ setShape('squircle');
385
+ applyState();
386
+
387
+ if (typeof EventSource !== 'undefined') {
388
+ const source = new EventSource('/events');
389
+ source.onmessage = function (event) {
390
+ if (event.data === 'reload') {
391
+ window.location.reload();
392
+ }
393
+ };
394
+ }
395
+ </script>
396
+ </body>
397
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iconpeek",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Live Expo app icon and splash preview with Android adaptive-icon mask checks - no native build required.",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -16,6 +16,8 @@
16
16
  },
17
17
  "files": [
18
18
  "server.js",
19
+ "style.css",
20
+ "index.html",
19
21
  "generate_icons.py",
20
22
  "README.md",
21
23
  "LICENSE",