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.
- package/index.html +397 -0
- package/package.json +3 -1
- package/server.js +81 -1014
- package/style.css +772 -0
package/server.js
CHANGED
|
@@ -9,6 +9,60 @@ const DEFAULT_PORT = 4200;
|
|
|
9
9
|
const PLACEHOLDER_ICON = path.join(__dirname, 'assets', 'placeholder-icon.png');
|
|
10
10
|
const PNG_SIGNATURE = Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
|
|
11
11
|
|
|
12
|
+
const sseClients = [];
|
|
13
|
+
const activeWatchers = new Map();
|
|
14
|
+
let notifyDebounceTimeout = null;
|
|
15
|
+
|
|
16
|
+
function notifyClients() {
|
|
17
|
+
clearTimeout(notifyDebounceTimeout);
|
|
18
|
+
notifyDebounceTimeout = setTimeout(() => {
|
|
19
|
+
for (const client of sseClients) {
|
|
20
|
+
client.write('data: reload\n\n');
|
|
21
|
+
}
|
|
22
|
+
}, 100);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function updateWatchers(projectRoot) {
|
|
26
|
+
const state = buildState(projectRoot);
|
|
27
|
+
const filesToWatch = [
|
|
28
|
+
path.join(__dirname, 'style.css'),
|
|
29
|
+
path.join(__dirname, 'index.html')
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
if (state.configPath) filesToWatch.push(state.configPath);
|
|
33
|
+
if (state.assets.icon.path && !state.assets.icon.placeholder) filesToWatch.push(state.assets.icon.path);
|
|
34
|
+
if (state.assets.iosIcon.path && !state.assets.iosIcon.placeholder) filesToWatch.push(state.assets.iosIcon.path);
|
|
35
|
+
if (state.assets.splash.path && !state.assets.splash.placeholder) filesToWatch.push(state.assets.splash.path);
|
|
36
|
+
if (state.assets.splashDark.path && !state.assets.splashDark.placeholder) filesToWatch.push(state.assets.splashDark.path);
|
|
37
|
+
|
|
38
|
+
// Clean up old watchers
|
|
39
|
+
for (const [filePath, watcher] of activeWatchers.entries()) {
|
|
40
|
+
if (!filesToWatch.includes(filePath)) {
|
|
41
|
+
watcher.close();
|
|
42
|
+
activeWatchers.delete(filePath);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Add new watchers
|
|
47
|
+
for (const filePath of filesToWatch) {
|
|
48
|
+
if (!activeWatchers.has(filePath)) {
|
|
49
|
+
try {
|
|
50
|
+
if (fs.existsSync(filePath)) {
|
|
51
|
+
const watcher = fs.watch(filePath, () => {
|
|
52
|
+
notifyClients();
|
|
53
|
+
// Re-evaluate files in case config path or assets changed
|
|
54
|
+
updateWatchers(projectRoot);
|
|
55
|
+
});
|
|
56
|
+
activeWatchers.set(filePath, watcher);
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
// File may be missing or locked
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
12
66
|
function parseArgs(argv) {
|
|
13
67
|
const options = {
|
|
14
68
|
projectRoot: process.cwd(),
|
|
@@ -322,1021 +376,15 @@ function createHtml(state) {
|
|
|
322
376
|
expo: state.expo,
|
|
323
377
|
}).replace(/</g, '\\u003c');
|
|
324
378
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
<head>
|
|
328
|
-
<meta charset="UTF-8">
|
|
329
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
330
|
-
<title>iconpeek</title>
|
|
331
|
-
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
332
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
333
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap" rel="stylesheet">
|
|
334
|
-
<style>
|
|
335
|
-
:root {
|
|
336
|
-
--bg: #0c0c0e;
|
|
337
|
-
--surface: #18181b;
|
|
338
|
-
--card: #1f1f23;
|
|
339
|
-
--border: #2e2e35;
|
|
340
|
-
--accent: #f97316;
|
|
341
|
-
--text: #fafafa;
|
|
342
|
-
--muted: #71717a;
|
|
343
|
-
--green: #22c55e;
|
|
344
|
-
--red: #ef4444;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
* { box-sizing: border-box; }
|
|
348
|
-
|
|
349
|
-
body {
|
|
350
|
-
margin: 0;
|
|
351
|
-
font-family: 'Inter', sans-serif;
|
|
352
|
-
color: var(--text);
|
|
353
|
-
background:
|
|
354
|
-
radial-gradient(circle at top left, rgba(249,115,22,0.12), transparent 22%),
|
|
355
|
-
radial-gradient(circle at top right, rgba(34,197,94,0.08), transparent 20%),
|
|
356
|
-
linear-gradient(180deg, #101014 0%, var(--bg) 18%, #09090b 100%);
|
|
357
|
-
min-height: 100vh;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
a { color: inherit; }
|
|
361
|
-
|
|
362
|
-
.header {
|
|
363
|
-
position: sticky;
|
|
364
|
-
top: 0;
|
|
365
|
-
z-index: 100;
|
|
366
|
-
display: flex;
|
|
367
|
-
justify-content: space-between;
|
|
368
|
-
gap: 1rem;
|
|
369
|
-
align-items: center;
|
|
370
|
-
padding: 1rem 1.5rem;
|
|
371
|
-
background: rgba(12, 12, 14, 0.72);
|
|
372
|
-
border-bottom: 1px solid rgba(46, 46, 53, 0.8);
|
|
373
|
-
backdrop-filter: blur(20px);
|
|
374
|
-
-webkit-backdrop-filter: blur(20px);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
.brand {
|
|
378
|
-
display: flex;
|
|
379
|
-
gap: 0.9rem;
|
|
380
|
-
align-items: center;
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
.brand-mark {
|
|
384
|
-
width: 12px;
|
|
385
|
-
height: 12px;
|
|
386
|
-
border-radius: 999px;
|
|
387
|
-
background: linear-gradient(135deg, #fb923c, #f97316);
|
|
388
|
-
box-shadow: 0 0 24px rgba(249,115,22,0.5);
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
.brand-title {
|
|
392
|
-
margin: 0;
|
|
393
|
-
font-size: 1.1rem;
|
|
394
|
-
font-weight: 800;
|
|
395
|
-
letter-spacing: -0.03em;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
.brand-copy {
|
|
399
|
-
margin: 0.15rem 0 0;
|
|
400
|
-
color: var(--muted);
|
|
401
|
-
font-size: 0.78rem;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
.header-pill {
|
|
405
|
-
padding: 0.45rem 0.8rem;
|
|
406
|
-
border-radius: 999px;
|
|
407
|
-
border: 1px solid rgba(249,115,22,0.3);
|
|
408
|
-
background: rgba(249,115,22,0.1);
|
|
409
|
-
color: var(--accent);
|
|
410
|
-
font-size: 0.72rem;
|
|
411
|
-
letter-spacing: 0.08em;
|
|
412
|
-
text-transform: uppercase;
|
|
413
|
-
font-weight: 700;
|
|
414
|
-
white-space: nowrap;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.page {
|
|
418
|
-
max-width: 1320px;
|
|
419
|
-
margin: 0 auto;
|
|
420
|
-
padding: 1.5rem;
|
|
421
|
-
display: flex;
|
|
422
|
-
flex-direction: column;
|
|
423
|
-
gap: 1.5rem;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
.summary {
|
|
427
|
-
display: grid;
|
|
428
|
-
grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
|
|
429
|
-
gap: 1rem;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.hero {
|
|
433
|
-
padding: 1.3rem 1.4rem;
|
|
434
|
-
border-radius: 16px;
|
|
435
|
-
border: 1px solid var(--border);
|
|
436
|
-
background:
|
|
437
|
-
linear-gradient(135deg, rgba(249,115,22,0.14), rgba(24,24,27,0.92) 36%),
|
|
438
|
-
var(--card);
|
|
439
|
-
box-shadow: 0 24px 60px rgba(0,0,0,0.25);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
.hero h2 {
|
|
443
|
-
margin: 0;
|
|
444
|
-
font-size: clamp(1.5rem, 3vw, 2.2rem);
|
|
445
|
-
letter-spacing: -0.04em;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
.hero p {
|
|
449
|
-
margin: 0.75rem 0 0;
|
|
450
|
-
color: #d4d4d8;
|
|
451
|
-
max-width: 62ch;
|
|
452
|
-
line-height: 1.55;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
.meta-card, .card {
|
|
456
|
-
background: rgba(31,31,35,0.92);
|
|
457
|
-
border: 1px solid var(--border);
|
|
458
|
-
border-radius: 16px;
|
|
459
|
-
box-shadow: 0 18px 48px rgba(0,0,0,0.22);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.meta-card {
|
|
463
|
-
padding: 1.15rem;
|
|
464
|
-
display: flex;
|
|
465
|
-
flex-direction: column;
|
|
466
|
-
gap: 0.8rem;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
.meta-label {
|
|
470
|
-
color: var(--muted);
|
|
471
|
-
text-transform: uppercase;
|
|
472
|
-
letter-spacing: 0.07em;
|
|
473
|
-
font-size: 0.72rem;
|
|
474
|
-
font-weight: 700;
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.meta-value {
|
|
478
|
-
font-size: 0.95rem;
|
|
479
|
-
word-break: break-word;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.warning-banner {
|
|
483
|
-
display: none;
|
|
484
|
-
padding: 0.9rem 1rem;
|
|
485
|
-
border-radius: 14px;
|
|
486
|
-
border: 1px solid rgba(239,68,68,0.3);
|
|
487
|
-
background: rgba(127,29,29,0.24);
|
|
488
|
-
color: #fecaca;
|
|
489
|
-
line-height: 1.45;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
.grid {
|
|
493
|
-
display: grid;
|
|
494
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
495
|
-
gap: 1.5rem;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
.card {
|
|
499
|
-
padding: 1.25rem;
|
|
500
|
-
display: flex;
|
|
501
|
-
flex-direction: column;
|
|
502
|
-
gap: 1rem;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
.card-head {
|
|
506
|
-
display: flex;
|
|
507
|
-
justify-content: space-between;
|
|
508
|
-
gap: 0.75rem;
|
|
509
|
-
align-items: center;
|
|
510
|
-
flex-wrap: wrap;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
.card-title {
|
|
514
|
-
margin: 0;
|
|
515
|
-
color: var(--muted);
|
|
516
|
-
text-transform: uppercase;
|
|
517
|
-
letter-spacing: 0.07em;
|
|
518
|
-
font-size: 0.78rem;
|
|
519
|
-
font-weight: 700;
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
.hint {
|
|
523
|
-
color: #d4d4d8;
|
|
524
|
-
font-size: 0.84rem;
|
|
525
|
-
line-height: 1.5;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
.controls {
|
|
529
|
-
display: flex;
|
|
530
|
-
flex-wrap: wrap;
|
|
531
|
-
gap: 0.75rem;
|
|
532
|
-
align-items: center;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
.segment {
|
|
536
|
-
display: inline-flex;
|
|
537
|
-
background: var(--surface);
|
|
538
|
-
border: 1px solid var(--border);
|
|
539
|
-
border-radius: 10px;
|
|
540
|
-
overflow: hidden;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
.segment button {
|
|
544
|
-
border: 0;
|
|
545
|
-
background: transparent;
|
|
546
|
-
color: var(--muted);
|
|
547
|
-
padding: 0.55rem 0.85rem;
|
|
548
|
-
font: inherit;
|
|
549
|
-
font-size: 0.82rem;
|
|
550
|
-
cursor: pointer;
|
|
551
|
-
transition: background 160ms ease, color 160ms ease;
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
.segment button.active {
|
|
555
|
-
background: var(--accent);
|
|
556
|
-
color: white;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
.segment button + button {
|
|
560
|
-
border-left: 1px solid var(--border);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
.toggle {
|
|
564
|
-
display: inline-flex;
|
|
565
|
-
align-items: center;
|
|
566
|
-
gap: 0.45rem;
|
|
567
|
-
color: #d4d4d8;
|
|
568
|
-
font-size: 0.82rem;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
.toggle input {
|
|
572
|
-
accent-color: var(--accent);
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
.stage {
|
|
576
|
-
display: flex;
|
|
577
|
-
justify-content: center;
|
|
578
|
-
align-items: center;
|
|
579
|
-
min-height: 360px;
|
|
580
|
-
padding: 1rem;
|
|
581
|
-
border-radius: 14px;
|
|
582
|
-
background:
|
|
583
|
-
radial-gradient(circle at top, rgba(249,115,22,0.12), transparent 38%),
|
|
584
|
-
linear-gradient(180deg, rgba(24,24,27,0.95), rgba(12,12,14,0.96));
|
|
585
|
-
border: 1px solid rgba(46,46,53,0.9);
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
.adaptive-wrap {
|
|
589
|
-
display: flex;
|
|
590
|
-
flex-direction: column;
|
|
591
|
-
gap: 0.9rem;
|
|
592
|
-
align-items: center;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
.adaptive-mask {
|
|
596
|
-
width: 216px;
|
|
597
|
-
height: 216px;
|
|
598
|
-
position: relative;
|
|
599
|
-
overflow: hidden;
|
|
600
|
-
box-shadow: 0 16px 44px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
|
|
601
|
-
background: #fff;
|
|
602
|
-
transition: border-radius 220ms ease, clip-path 220ms ease;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
.mask-squircle {
|
|
606
|
-
clip-path: path('M108,0 C173,0 216,43 216,108 C216,173 173,216 108,216 C43,216 0,173 0,108 C0,43 43,0 108,0 Z');
|
|
607
|
-
border-radius: 0;
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
.mask-rounded { border-radius: 48px; clip-path: none; }
|
|
611
|
-
.mask-circle { border-radius: 50%; clip-path: none; }
|
|
612
|
-
.mask-square { border-radius: 0; clip-path: none; }
|
|
613
|
-
|
|
614
|
-
.adaptive-layer {
|
|
615
|
-
position: absolute;
|
|
616
|
-
width: 324px;
|
|
617
|
-
height: 324px;
|
|
618
|
-
left: -54px;
|
|
619
|
-
top: -54px;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
.adaptive-bg {
|
|
623
|
-
background: #FFFFFF;
|
|
624
|
-
}
|
|
625
|
-
|
|
626
|
-
.adaptive-fg {
|
|
627
|
-
background-position: center;
|
|
628
|
-
background-repeat: no-repeat;
|
|
629
|
-
background-size: contain;
|
|
630
|
-
will-change: transform;
|
|
631
|
-
transition: transform 80ms ease-out;
|
|
632
|
-
}
|
|
379
|
+
const htmlTemplate = fs.readFileSync(path.join(__dirname, 'index.html'), 'utf8');
|
|
380
|
+
const styles = fs.readFileSync(path.join(__dirname, 'style.css'), 'utf8');
|
|
633
381
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
border-radius: 50%;
|
|
641
|
-
border: 2px dashed rgba(239,68,68,0.9);
|
|
642
|
-
z-index: 3;
|
|
643
|
-
display: none;
|
|
644
|
-
pointer-events: none;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
.safe-zone span {
|
|
648
|
-
position: absolute;
|
|
649
|
-
top: -1.6rem;
|
|
650
|
-
left: 50%;
|
|
651
|
-
transform: translateX(-50%);
|
|
652
|
-
font-size: 0.68rem;
|
|
653
|
-
color: #fca5a5;
|
|
654
|
-
font-weight: 700;
|
|
655
|
-
white-space: nowrap;
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
.shape-caption {
|
|
659
|
-
color: var(--muted);
|
|
660
|
-
font-size: 0.82rem;
|
|
661
|
-
text-align: center;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
.spec-grid {
|
|
665
|
-
display: grid;
|
|
666
|
-
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
667
|
-
gap: 0.75rem;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
.spec-pill {
|
|
671
|
-
padding: 0.75rem 0.85rem;
|
|
672
|
-
border-radius: 12px;
|
|
673
|
-
background: var(--surface);
|
|
674
|
-
border: 1px solid var(--border);
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
.spec-pill strong {
|
|
678
|
-
display: block;
|
|
679
|
-
font-size: 0.68rem;
|
|
680
|
-
text-transform: uppercase;
|
|
681
|
-
letter-spacing: 0.07em;
|
|
682
|
-
color: var(--muted);
|
|
683
|
-
margin-bottom: 0.28rem;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
.spec-pill span {
|
|
687
|
-
font-size: 0.93rem;
|
|
688
|
-
font-weight: 600;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
.size-row {
|
|
692
|
-
display: flex;
|
|
693
|
-
justify-content: center;
|
|
694
|
-
gap: 1.2rem;
|
|
695
|
-
flex-wrap: wrap;
|
|
696
|
-
padding: 1rem;
|
|
697
|
-
border-radius: 14px;
|
|
698
|
-
background: var(--surface);
|
|
699
|
-
border: 1px solid rgba(46,46,53,0.9);
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
.size-item {
|
|
703
|
-
display: flex;
|
|
704
|
-
flex-direction: column;
|
|
705
|
-
align-items: center;
|
|
706
|
-
gap: 0.45rem;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
.size-label {
|
|
710
|
-
color: var(--muted);
|
|
711
|
-
font-size: 0.73rem;
|
|
712
|
-
line-height: 1.3;
|
|
713
|
-
text-align: center;
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
.mini-mask, .launcher-mask {
|
|
717
|
-
position: relative;
|
|
718
|
-
overflow: hidden;
|
|
719
|
-
background: #fff;
|
|
720
|
-
box-shadow: 0 10px 20px rgba(0,0,0,0.35);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
.mini-bg, .mini-fg, .launcher-bg, .launcher-fg {
|
|
724
|
-
position: absolute;
|
|
725
|
-
background-position: center;
|
|
726
|
-
background-repeat: no-repeat;
|
|
727
|
-
background-size: contain;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
.ios-preview {
|
|
731
|
-
display: flex;
|
|
732
|
-
flex-direction: column;
|
|
733
|
-
align-items: center;
|
|
734
|
-
gap: 1rem;
|
|
735
|
-
padding: 1rem;
|
|
736
|
-
border-radius: 14px;
|
|
737
|
-
background: linear-gradient(180deg, rgba(24,24,27,0.95), rgba(12,12,14,0.96));
|
|
738
|
-
border: 1px solid rgba(46,46,53,0.9);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
.ios-mask {
|
|
742
|
-
width: 216px;
|
|
743
|
-
height: 216px;
|
|
744
|
-
border-radius: 47px;
|
|
745
|
-
overflow: hidden;
|
|
746
|
-
background: #fff;
|
|
747
|
-
box-shadow: 0 16px 44px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.04);
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
.ios-mask img {
|
|
751
|
-
width: 100%;
|
|
752
|
-
height: 100%;
|
|
753
|
-
object-fit: cover;
|
|
754
|
-
display: block;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
.context {
|
|
758
|
-
display: grid;
|
|
759
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
760
|
-
gap: 1.5rem;
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
.screen {
|
|
764
|
-
border-radius: 16px;
|
|
765
|
-
padding: 1rem;
|
|
766
|
-
overflow: hidden;
|
|
767
|
-
position: relative;
|
|
768
|
-
min-height: 250px;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
.android-screen {
|
|
772
|
-
background: linear-gradient(155deg, #231942, #1d3557 55%, #0b1020);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
.ios-screen {
|
|
776
|
-
background: linear-gradient(160deg, #11324d, #0b1c2d 55%, #191936);
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
.screen::before {
|
|
780
|
-
content: '';
|
|
781
|
-
position: absolute;
|
|
782
|
-
inset: 0;
|
|
783
|
-
background:
|
|
784
|
-
radial-gradient(circle at 20% 10%, rgba(255,255,255,0.06), transparent 18%),
|
|
785
|
-
radial-gradient(circle at 80% 40%, rgba(255,255,255,0.06), transparent 20%);
|
|
786
|
-
pointer-events: none;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
.screen-grid {
|
|
790
|
-
position: relative;
|
|
791
|
-
display: grid;
|
|
792
|
-
grid-template-columns: repeat(4, 1fr);
|
|
793
|
-
gap: 0.8rem;
|
|
794
|
-
align-items: start;
|
|
795
|
-
justify-items: center;
|
|
796
|
-
z-index: 1;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
.app-chip {
|
|
800
|
-
display: flex;
|
|
801
|
-
flex-direction: column;
|
|
802
|
-
align-items: center;
|
|
803
|
-
gap: 0.4rem;
|
|
804
|
-
width: 100%;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
.app-label {
|
|
808
|
-
width: 100%;
|
|
809
|
-
text-align: center;
|
|
810
|
-
color: rgba(255,255,255,0.92);
|
|
811
|
-
text-shadow: 0 1px 3px rgba(0,0,0,0.6);
|
|
812
|
-
font-size: 0.7rem;
|
|
813
|
-
overflow: hidden;
|
|
814
|
-
text-overflow: ellipsis;
|
|
815
|
-
white-space: nowrap;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
.placeholder {
|
|
819
|
-
width: 96px;
|
|
820
|
-
height: 96px;
|
|
821
|
-
border-radius: 24px;
|
|
822
|
-
display: flex;
|
|
823
|
-
align-items: center;
|
|
824
|
-
justify-content: center;
|
|
825
|
-
font-size: 1.7rem;
|
|
826
|
-
box-shadow: 0 10px 20px rgba(0,0,0,0.35);
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
.ios-placeholder {
|
|
830
|
-
border-radius: 21px;
|
|
831
|
-
}
|
|
832
|
-
|
|
833
|
-
.ring {
|
|
834
|
-
box-shadow: 0 0 0 3px rgba(249,115,22,0.95), 0 10px 20px rgba(0,0,0,0.35);
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
.splash-pair {
|
|
838
|
-
display: flex;
|
|
839
|
-
justify-content: center;
|
|
840
|
-
gap: 1.4rem;
|
|
841
|
-
flex-wrap: wrap;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
.phone {
|
|
845
|
-
width: 200px;
|
|
846
|
-
height: 420px;
|
|
847
|
-
border-radius: 34px;
|
|
848
|
-
border: 7px solid #232329;
|
|
849
|
-
overflow: hidden;
|
|
850
|
-
position: relative;
|
|
851
|
-
box-shadow: 0 22px 60px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,0.04);
|
|
852
|
-
background: #000;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
.notch {
|
|
856
|
-
position: absolute;
|
|
857
|
-
top: 0;
|
|
858
|
-
left: 50%;
|
|
859
|
-
transform: translateX(-50%);
|
|
860
|
-
width: 82px;
|
|
861
|
-
height: 14px;
|
|
862
|
-
border-bottom-left-radius: 10px;
|
|
863
|
-
border-bottom-right-radius: 10px;
|
|
864
|
-
background: #18181b;
|
|
865
|
-
z-index: 3;
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
.statusbar {
|
|
869
|
-
position: absolute;
|
|
870
|
-
top: 0;
|
|
871
|
-
left: 0;
|
|
872
|
-
right: 0;
|
|
873
|
-
height: 26px;
|
|
874
|
-
display: flex;
|
|
875
|
-
justify-content: space-between;
|
|
876
|
-
align-items: flex-end;
|
|
877
|
-
padding: 0 14px 4px;
|
|
878
|
-
font-size: 0.62rem;
|
|
879
|
-
font-weight: 700;
|
|
880
|
-
z-index: 4;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
.splash-surface {
|
|
884
|
-
position: absolute;
|
|
885
|
-
inset: 0;
|
|
886
|
-
display: flex;
|
|
887
|
-
align-items: center;
|
|
888
|
-
justify-content: center;
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
.splash-image {
|
|
892
|
-
width: 38%;
|
|
893
|
-
height: auto;
|
|
894
|
-
object-fit: contain;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
.theme-chip {
|
|
898
|
-
position: absolute;
|
|
899
|
-
bottom: 15px;
|
|
900
|
-
left: 50%;
|
|
901
|
-
transform: translateX(-50%);
|
|
902
|
-
padding: 0.28rem 0.7rem;
|
|
903
|
-
border-radius: 999px;
|
|
904
|
-
font-size: 0.64rem;
|
|
905
|
-
letter-spacing: 0.08em;
|
|
906
|
-
text-transform: uppercase;
|
|
907
|
-
font-weight: 700;
|
|
908
|
-
}
|
|
909
|
-
|
|
910
|
-
.theme-chip.light {
|
|
911
|
-
color: rgba(0,0,0,0.52);
|
|
912
|
-
background: rgba(0,0,0,0.08);
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
.theme-chip.dark {
|
|
916
|
-
color: rgba(255,255,255,0.72);
|
|
917
|
-
background: rgba(255,255,255,0.08);
|
|
918
|
-
}
|
|
919
|
-
|
|
920
|
-
.footnote {
|
|
921
|
-
color: var(--muted);
|
|
922
|
-
font-size: 0.78rem;
|
|
923
|
-
line-height: 1.5;
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
@media (max-width: 900px) {
|
|
927
|
-
.summary, .grid, .context {
|
|
928
|
-
grid-template-columns: 1fr;
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
.header {
|
|
932
|
-
padding: 1rem;
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
.page {
|
|
936
|
-
padding: 1rem;
|
|
937
|
-
}
|
|
938
|
-
|
|
939
|
-
.spec-grid {
|
|
940
|
-
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
@media (max-width: 640px) {
|
|
945
|
-
.spec-grid {
|
|
946
|
-
grid-template-columns: 1fr;
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
.screen-grid {
|
|
950
|
-
grid-template-columns: repeat(2, 1fr);
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
</style>
|
|
954
|
-
</head>
|
|
955
|
-
<body>
|
|
956
|
-
<header class="header">
|
|
957
|
-
<div class="brand">
|
|
958
|
-
<div class="brand-mark"></div>
|
|
959
|
-
<div>
|
|
960
|
-
<h1 class="brand-title">iconpeek</h1>
|
|
961
|
-
<p class="brand-copy">Local Expo icon and splash previewer</p>
|
|
962
|
-
</div>
|
|
963
|
-
</div>
|
|
964
|
-
<div class="header-pill">Zero Dependencies</div>
|
|
965
|
-
</header>
|
|
966
|
-
|
|
967
|
-
<main class="page">
|
|
968
|
-
<section class="summary">
|
|
969
|
-
<div class="hero">
|
|
970
|
-
<h2>Preview Android adaptive icons, iOS icons, and splash screens without a native build.</h2>
|
|
971
|
-
<p>iconpeek reads your Expo config directly, mirrors Android adaptive icon canvas and safe-zone math, and gives you instant browser feedback while you tweak assets in your project.</p>
|
|
972
|
-
</div>
|
|
973
|
-
<aside class="meta-card">
|
|
974
|
-
<div>
|
|
975
|
-
<div class="meta-label">Project Root</div>
|
|
976
|
-
<div class="meta-value">${escapeHtml(state.projectRoot)}</div>
|
|
977
|
-
</div>
|
|
978
|
-
<div>
|
|
979
|
-
<div class="meta-label">Config Source</div>
|
|
980
|
-
<div class="meta-value">${escapeHtml(state.configName || 'Not found')}</div>
|
|
981
|
-
</div>
|
|
982
|
-
<div>
|
|
983
|
-
<div class="meta-label">App Label</div>
|
|
984
|
-
<div class="meta-value" id="appLabelMeta">${escapeHtml(state.expo.name)}</div>
|
|
985
|
-
</div>
|
|
986
|
-
</aside>
|
|
987
|
-
</section>
|
|
988
|
-
|
|
989
|
-
<section class="warning-banner" id="warningBanner"></section>
|
|
990
|
-
|
|
991
|
-
<section class="grid">
|
|
992
|
-
<article class="card">
|
|
993
|
-
<div class="card-head">
|
|
994
|
-
<h3 class="card-title">Android Adaptive Icon Simulator</h3>
|
|
995
|
-
<div class="controls">
|
|
996
|
-
<div class="segment" id="shapeControl">
|
|
997
|
-
<button type="button" data-shape="squircle" class="active">Squircle</button>
|
|
998
|
-
<button type="button" data-shape="rounded">Rounded</button>
|
|
999
|
-
<button type="button" data-shape="circle">Circle</button>
|
|
1000
|
-
<button type="button" data-shape="square">Square</button>
|
|
1001
|
-
</div>
|
|
1002
|
-
<label class="toggle">
|
|
1003
|
-
<input type="checkbox" id="safeZoneToggle">
|
|
1004
|
-
Show safe zone
|
|
1005
|
-
</label>
|
|
1006
|
-
</div>
|
|
1007
|
-
</div>
|
|
1008
|
-
|
|
1009
|
-
<div class="stage">
|
|
1010
|
-
<div class="adaptive-wrap">
|
|
1011
|
-
<div class="adaptive-mask mask-squircle" id="adaptiveMask">
|
|
1012
|
-
<div class="adaptive-layer adaptive-bg" id="adaptiveBg"></div>
|
|
1013
|
-
<div class="adaptive-layer adaptive-fg" id="adaptiveFg"></div>
|
|
1014
|
-
<div class="safe-zone" id="safeZone">
|
|
1015
|
-
<span>66dp Safe Zone</span>
|
|
1016
|
-
</div>
|
|
1017
|
-
</div>
|
|
1018
|
-
<div class="shape-caption" id="shapeCaption">Android 12+ default squircle mask</div>
|
|
1019
|
-
</div>
|
|
1020
|
-
</div>
|
|
1021
|
-
|
|
1022
|
-
<div class="spec-grid">
|
|
1023
|
-
<div class="spec-pill"><strong>Layer Canvas</strong><span>108dp / 324px</span></div>
|
|
1024
|
-
<div class="spec-pill"><strong>Visible Mask</strong><span>72dp / 216px</span></div>
|
|
1025
|
-
<div class="spec-pill"><strong>Safe Zone</strong><span>66dp / 198px</span></div>
|
|
1026
|
-
<div class="spec-pill"><strong>BG Color</strong><span id="bgColorValue">#FFFFFF</span></div>
|
|
1027
|
-
<div class="spec-pill"><strong>Crop Margin</strong><span>18dp / 54px</span></div>
|
|
1028
|
-
<div class="spec-pill"><strong>Preview Scale</strong><span>3x</span></div>
|
|
1029
|
-
</div>
|
|
1030
|
-
|
|
1031
|
-
<div class="size-row" id="androidSizeRow"></div>
|
|
1032
|
-
</article>
|
|
1033
|
-
|
|
1034
|
-
<article class="card">
|
|
1035
|
-
<div class="card-head">
|
|
1036
|
-
<h3 class="card-title">iOS Icon Preview</h3>
|
|
1037
|
-
<div class="header-pill" style="padding:0.35rem 0.65rem;font-size:0.66rem;">Flat Asset</div>
|
|
1038
|
-
</div>
|
|
1039
|
-
<div class="ios-preview">
|
|
1040
|
-
<div class="ios-mask">
|
|
1041
|
-
<img src="/assets/ios-icon" alt="iOS app icon">
|
|
1042
|
-
</div>
|
|
1043
|
-
<div class="hint">iOS app icons should be opaque; this preview approximates the system mask so you can judge edge composition quickly.</div>
|
|
1044
|
-
</div>
|
|
1045
|
-
<div class="size-row" id="iosSizeRow"></div>
|
|
1046
|
-
</article>
|
|
1047
|
-
</section>
|
|
1048
|
-
|
|
1049
|
-
<section class="context">
|
|
1050
|
-
<article class="card">
|
|
1051
|
-
<div class="card-head">
|
|
1052
|
-
<h3 class="card-title">Android Launcher Context</h3>
|
|
1053
|
-
<div class="hint">96x96 highlight ring in a mock launcher grid</div>
|
|
1054
|
-
</div>
|
|
1055
|
-
<div class="screen android-screen">
|
|
1056
|
-
<div class="screen-grid">
|
|
1057
|
-
<div class="app-chip">
|
|
1058
|
-
<div class="placeholder" style="background:linear-gradient(135deg,#2563eb,#38bdf8)">MSG</div>
|
|
1059
|
-
<div class="app-label">Messages</div>
|
|
1060
|
-
</div>
|
|
1061
|
-
<div class="app-chip">
|
|
1062
|
-
<div class="launcher-mask ring mask-squircle" id="launcherMask" style="width:96px;height:96px;">
|
|
1063
|
-
<div class="launcher-bg" id="launcherBg"></div>
|
|
1064
|
-
<div class="launcher-fg" id="launcherFg"></div>
|
|
1065
|
-
</div>
|
|
1066
|
-
<div class="app-label" id="androidAppLabel">${escapeHtml(state.expo.name)}</div>
|
|
1067
|
-
</div>
|
|
1068
|
-
<div class="app-chip">
|
|
1069
|
-
<div class="placeholder" style="background:linear-gradient(135deg,#16a34a,#4ade80)">IMG</div>
|
|
1070
|
-
<div class="app-label">Gallery</div>
|
|
1071
|
-
</div>
|
|
1072
|
-
<div class="app-chip">
|
|
1073
|
-
<div class="placeholder" style="background:linear-gradient(135deg,#9333ea,#c084fc)">AUD</div>
|
|
1074
|
-
<div class="app-label">Music</div>
|
|
1075
|
-
</div>
|
|
1076
|
-
</div>
|
|
1077
|
-
</div>
|
|
1078
|
-
</article>
|
|
1079
|
-
|
|
1080
|
-
<article class="card">
|
|
1081
|
-
<div class="card-head">
|
|
1082
|
-
<h3 class="card-title">iOS Homescreen Context</h3>
|
|
1083
|
-
<div class="hint">96x96 highlight ring in a mock homescreen grid</div>
|
|
1084
|
-
</div>
|
|
1085
|
-
<div class="screen ios-screen">
|
|
1086
|
-
<div class="screen-grid">
|
|
1087
|
-
<div class="app-chip">
|
|
1088
|
-
<div class="placeholder ios-placeholder" style="background:linear-gradient(135deg,#0ea5e9,#67e8f9)">TEL</div>
|
|
1089
|
-
<div class="app-label">Phone</div>
|
|
1090
|
-
</div>
|
|
1091
|
-
<div class="app-chip">
|
|
1092
|
-
<div class="ios-placeholder ring" style="width:96px;height:96px;border-radius:21px;overflow:hidden;background:#fff;">
|
|
1093
|
-
<img src="/assets/ios-icon" alt="iOS homescreen icon" style="width:100%;height:100%;object-fit:cover;display:block;">
|
|
1094
|
-
</div>
|
|
1095
|
-
<div class="app-label" id="iosAppLabel">${escapeHtml(state.expo.name)}</div>
|
|
1096
|
-
</div>
|
|
1097
|
-
<div class="app-chip">
|
|
1098
|
-
<div class="placeholder ios-placeholder" style="background:linear-gradient(135deg,#f59e0b,#fcd34d)">SET</div>
|
|
1099
|
-
<div class="app-label">Settings</div>
|
|
1100
|
-
</div>
|
|
1101
|
-
<div class="app-chip">
|
|
1102
|
-
<div class="placeholder ios-placeholder" style="background:linear-gradient(135deg,#dc2626,#fb7185)">HLT</div>
|
|
1103
|
-
<div class="app-label">Health</div>
|
|
1104
|
-
</div>
|
|
1105
|
-
</div>
|
|
1106
|
-
</div>
|
|
1107
|
-
</article>
|
|
1108
|
-
</section>
|
|
1109
|
-
|
|
1110
|
-
<section class="card">
|
|
1111
|
-
<div class="card-head">
|
|
1112
|
-
<h3 class="card-title">Splash Screen Preview</h3>
|
|
1113
|
-
<div class="hint">Light and dark frames with auto-inverted status bar text based on background luminance</div>
|
|
1114
|
-
</div>
|
|
1115
|
-
<div class="splash-pair">
|
|
1116
|
-
<div class="phone">
|
|
1117
|
-
<div class="notch"></div>
|
|
1118
|
-
<div class="statusbar" id="statusbarLight">
|
|
1119
|
-
<span>9:41</span>
|
|
1120
|
-
<span>||| 100%</span>
|
|
1121
|
-
</div>
|
|
1122
|
-
<div class="splash-surface" id="splashLightSurface">
|
|
1123
|
-
<img class="splash-image" src="/assets/splash" alt="Light splash preview">
|
|
1124
|
-
<div class="theme-chip light">Light Mode</div>
|
|
1125
|
-
</div>
|
|
1126
|
-
</div>
|
|
1127
|
-
<div class="phone">
|
|
1128
|
-
<div class="notch"></div>
|
|
1129
|
-
<div class="statusbar" id="statusbarDark">
|
|
1130
|
-
<span>9:41</span>
|
|
1131
|
-
<span>||| 100%</span>
|
|
1132
|
-
</div>
|
|
1133
|
-
<div class="splash-surface" id="splashDarkSurface">
|
|
1134
|
-
<img class="splash-image" src="/assets/splash-dark" alt="Dark splash preview">
|
|
1135
|
-
<div class="theme-chip dark">Dark Mode</div>
|
|
1136
|
-
</div>
|
|
1137
|
-
</div>
|
|
1138
|
-
</div>
|
|
1139
|
-
<div class="footnote" id="splashFootnote">Splash image width defaults to 38% of the frame width unless imageWidth is set in Expo config.</div>
|
|
1140
|
-
</section>
|
|
1141
|
-
</main>
|
|
1142
|
-
|
|
1143
|
-
<script>
|
|
1144
|
-
const STATE = ${payload};
|
|
1145
|
-
const shapeMap = {
|
|
1146
|
-
squircle: { className: 'mask-squircle', caption: 'Android 12+ default squircle mask' },
|
|
1147
|
-
rounded: { className: 'mask-rounded', caption: 'Rounded rectangle mask' },
|
|
1148
|
-
circle: { className: 'mask-circle', caption: 'Circle mask' },
|
|
1149
|
-
square: { className: 'mask-square', caption: 'Square mask' }
|
|
1150
|
-
};
|
|
1151
|
-
const maskClasses = Object.values(shapeMap).map((entry) => entry.className);
|
|
1152
|
-
const androidSizes = [
|
|
1153
|
-
{ px: 36, label: 'Status bar', dp: '24dp' },
|
|
1154
|
-
{ px: 54, label: 'Notification', dp: '36dp' },
|
|
1155
|
-
{ px: 72, label: 'Launcher', dp: '48dp' },
|
|
1156
|
-
{ px: 96, label: 'App drawer', dp: '64dp' }
|
|
1157
|
-
];
|
|
1158
|
-
const iosSizes = [
|
|
1159
|
-
{ px: 40, label: 'Settings', pt: '29pt' },
|
|
1160
|
-
{ px: 57, label: 'Spotlight', pt: '40pt' },
|
|
1161
|
-
{ px: 86, label: 'Home Screen', pt: '60pt' },
|
|
1162
|
-
{ px: 128, label: 'App Store display', pt: '1024px source' }
|
|
1163
|
-
];
|
|
1164
|
-
|
|
1165
|
-
function isDarkColor(hex) {
|
|
1166
|
-
const normalized = (hex || '#FFFFFF').replace('#', '');
|
|
1167
|
-
const expanded = normalized.length === 3
|
|
1168
|
-
? normalized.split('').map((char) => char + char).join('')
|
|
1169
|
-
: normalized;
|
|
1170
|
-
const r = parseInt(expanded.slice(0, 2), 16);
|
|
1171
|
-
const g = parseInt(expanded.slice(2, 4), 16);
|
|
1172
|
-
const b = parseInt(expanded.slice(4, 6), 16);
|
|
1173
|
-
return (0.299 * r + 0.587 * g + 0.114 * b) < 128;
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
function buildAndroidSizeRow() {
|
|
1177
|
-
const container = document.getElementById('androidSizeRow');
|
|
1178
|
-
container.innerHTML = '';
|
|
1179
|
-
const bgColor = STATE.expo.adaptiveBackgroundColor;
|
|
1180
|
-
androidSizes.forEach((item) => {
|
|
1181
|
-
const mask = document.createElement('div');
|
|
1182
|
-
mask.className = 'mini-mask mask-squircle';
|
|
1183
|
-
mask.style.width = item.px + 'px';
|
|
1184
|
-
mask.style.height = item.px + 'px';
|
|
1185
|
-
|
|
1186
|
-
const layerSize = item.px * (108 / 72);
|
|
1187
|
-
const offset = (layerSize - item.px) / 2;
|
|
1188
|
-
|
|
1189
|
-
const bg = document.createElement('div');
|
|
1190
|
-
bg.className = 'mini-bg';
|
|
1191
|
-
bg.style.width = layerSize + 'px';
|
|
1192
|
-
bg.style.height = layerSize + 'px';
|
|
1193
|
-
bg.style.left = (-offset) + 'px';
|
|
1194
|
-
bg.style.top = (-offset) + 'px';
|
|
1195
|
-
bg.style.backgroundColor = bgColor;
|
|
1196
|
-
|
|
1197
|
-
const fg = document.createElement('div');
|
|
1198
|
-
fg.className = 'mini-fg';
|
|
1199
|
-
fg.style.width = layerSize + 'px';
|
|
1200
|
-
fg.style.height = layerSize + 'px';
|
|
1201
|
-
fg.style.left = (-offset) + 'px';
|
|
1202
|
-
fg.style.top = (-offset) + 'px';
|
|
1203
|
-
fg.style.backgroundImage = "url('/assets/icon')";
|
|
1204
|
-
|
|
1205
|
-
mask.appendChild(bg);
|
|
1206
|
-
mask.appendChild(fg);
|
|
1207
|
-
|
|
1208
|
-
const itemNode = document.createElement('div');
|
|
1209
|
-
itemNode.className = 'size-item';
|
|
1210
|
-
itemNode.appendChild(mask);
|
|
1211
|
-
|
|
1212
|
-
const label = document.createElement('div');
|
|
1213
|
-
label.className = 'size-label';
|
|
1214
|
-
label.innerHTML = item.px + '×' + item.px + 'px<br>' + item.dp + ' ' + item.label;
|
|
1215
|
-
itemNode.appendChild(label);
|
|
1216
|
-
|
|
1217
|
-
container.appendChild(itemNode);
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
function buildIosSizeRow() {
|
|
1222
|
-
const container = document.getElementById('iosSizeRow');
|
|
1223
|
-
container.innerHTML = '';
|
|
1224
|
-
iosSizes.forEach((item) => {
|
|
1225
|
-
const itemNode = document.createElement('div');
|
|
1226
|
-
itemNode.className = 'size-item';
|
|
1227
|
-
|
|
1228
|
-
const mask = document.createElement('div');
|
|
1229
|
-
mask.style.width = item.px + 'px';
|
|
1230
|
-
mask.style.height = item.px + 'px';
|
|
1231
|
-
mask.style.borderRadius = Math.round(item.px * 0.2237) + 'px';
|
|
1232
|
-
mask.style.overflow = 'hidden';
|
|
1233
|
-
mask.style.background = '#fff';
|
|
1234
|
-
mask.style.boxShadow = '0 10px 20px rgba(0,0,0,0.35)';
|
|
1235
|
-
|
|
1236
|
-
const img = document.createElement('img');
|
|
1237
|
-
img.src = '/assets/ios-icon';
|
|
1238
|
-
img.alt = item.label;
|
|
1239
|
-
img.style.width = '100%';
|
|
1240
|
-
img.style.height = '100%';
|
|
1241
|
-
img.style.objectFit = 'cover';
|
|
1242
|
-
img.style.display = 'block';
|
|
1243
|
-
mask.appendChild(img);
|
|
1244
|
-
|
|
1245
|
-
const label = document.createElement('div');
|
|
1246
|
-
label.className = 'size-label';
|
|
1247
|
-
label.innerHTML = item.px + '×' + item.px + 'px<br>' + item.pt;
|
|
1248
|
-
|
|
1249
|
-
itemNode.appendChild(mask);
|
|
1250
|
-
itemNode.appendChild(label);
|
|
1251
|
-
container.appendChild(itemNode);
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
|
|
1255
|
-
function setShape(shape) {
|
|
1256
|
-
const mapping = shapeMap[shape] || shapeMap.squircle;
|
|
1257
|
-
const adaptiveMask = document.getElementById('adaptiveMask');
|
|
1258
|
-
const launcherMask = document.getElementById('launcherMask');
|
|
1259
|
-
|
|
1260
|
-
[adaptiveMask, launcherMask].forEach((element) => {
|
|
1261
|
-
maskClasses.forEach((className) => element.classList.remove(className));
|
|
1262
|
-
element.classList.add(mapping.className);
|
|
1263
|
-
});
|
|
1264
|
-
|
|
1265
|
-
document.getElementById('shapeCaption').textContent = mapping.caption;
|
|
1266
|
-
document.querySelectorAll('#shapeControl button').forEach((button) => {
|
|
1267
|
-
button.classList.toggle('active', button.dataset.shape === shape);
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
function applyState() {
|
|
1272
|
-
const warnings = STATE.warnings || [];
|
|
1273
|
-
const warningBanner = document.getElementById('warningBanner');
|
|
1274
|
-
if (warnings.length) {
|
|
1275
|
-
warningBanner.style.display = 'block';
|
|
1276
|
-
warningBanner.innerHTML = warnings.map((warning) => '<div>' + warning + '</div>').join('');
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
document.getElementById('adaptiveBg').style.backgroundColor = STATE.expo.adaptiveBackgroundColor;
|
|
1280
|
-
document.getElementById('launcherBg').style.backgroundColor = STATE.expo.adaptiveBackgroundColor;
|
|
1281
|
-
document.getElementById('bgColorValue').textContent = STATE.expo.adaptiveBackgroundColor;
|
|
1282
|
-
|
|
1283
|
-
document.getElementById('adaptiveFg').style.backgroundImage = "url('/assets/icon')";
|
|
1284
|
-
document.getElementById('launcherFg').style.backgroundImage = "url('/assets/icon')";
|
|
1285
|
-
|
|
1286
|
-
document.getElementById('splashLightSurface').style.backgroundColor = STATE.expo.splashBackgroundColor;
|
|
1287
|
-
document.getElementById('splashDarkSurface').style.backgroundColor = STATE.expo.splashDarkBackgroundColor;
|
|
1288
|
-
document.getElementById('statusbarLight').style.color = isDarkColor(STATE.expo.splashBackgroundColor) ? '#FFFFFF' : '#000000';
|
|
1289
|
-
document.getElementById('statusbarDark').style.color = isDarkColor(STATE.expo.splashDarkBackgroundColor) ? '#FFFFFF' : '#000000';
|
|
1290
|
-
if (STATE.expo.splashImageWidth) {
|
|
1291
|
-
document.querySelectorAll('.splash-image').forEach((image) => {
|
|
1292
|
-
image.style.width = Math.max(24, Math.min(70, (STATE.expo.splashImageWidth / 200) * 100)) + '%';
|
|
1293
|
-
});
|
|
1294
|
-
document.getElementById('splashFootnote').textContent = 'Splash image width reflects Expo imageWidth: ' + STATE.expo.splashImageWidth + 'px.';
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
buildAndroidSizeRow();
|
|
1298
|
-
buildIosSizeRow();
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
document.getElementById('shapeControl').addEventListener('click', (event) => {
|
|
1302
|
-
if (event.target.tagName === 'BUTTON') {
|
|
1303
|
-
setShape(event.target.dataset.shape);
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
|
|
1307
|
-
document.getElementById('safeZoneToggle').addEventListener('change', (event) => {
|
|
1308
|
-
document.getElementById('safeZone').style.display = event.target.checked ? 'block' : 'none';
|
|
1309
|
-
});
|
|
1310
|
-
|
|
1311
|
-
const adaptiveMask = document.getElementById('adaptiveMask');
|
|
1312
|
-
adaptiveMask.addEventListener('mousemove', (event) => {
|
|
1313
|
-
const rect = adaptiveMask.getBoundingClientRect();
|
|
1314
|
-
const x = event.clientX - rect.left;
|
|
1315
|
-
const y = event.clientY - rect.top;
|
|
1316
|
-
const dx = ((x / rect.width) - 0.5) * 32;
|
|
1317
|
-
const dy = ((y / rect.height) - 0.5) * 32;
|
|
1318
|
-
document.getElementById('adaptiveFg').style.transform = 'translate3d(' + dx.toFixed(2) + 'px,' + dy.toFixed(2) + 'px,0)';
|
|
1319
|
-
});
|
|
1320
|
-
adaptiveMask.addEventListener('mouseleave', () => {
|
|
1321
|
-
document.getElementById('adaptiveFg').style.transform = 'translate3d(0,0,0)';
|
|
1322
|
-
});
|
|
1323
|
-
|
|
1324
|
-
const launcherBg = document.getElementById('launcherBg');
|
|
1325
|
-
const launcherFg = document.getElementById('launcherFg');
|
|
1326
|
-
launcherBg.style.width = '144px';
|
|
1327
|
-
launcherBg.style.height = '144px';
|
|
1328
|
-
launcherBg.style.left = '-24px';
|
|
1329
|
-
launcherBg.style.top = '-24px';
|
|
1330
|
-
launcherFg.style.width = '144px';
|
|
1331
|
-
launcherFg.style.height = '144px';
|
|
1332
|
-
launcherFg.style.left = '-24px';
|
|
1333
|
-
launcherFg.style.top = '-24px';
|
|
1334
|
-
|
|
1335
|
-
setShape('squircle');
|
|
1336
|
-
applyState();
|
|
1337
|
-
</script>
|
|
1338
|
-
</body>
|
|
1339
|
-
</html>`;
|
|
382
|
+
return htmlTemplate
|
|
383
|
+
.replace('<style id="main-styles"></style>', `<style>\n${styles}\n </style>`)
|
|
384
|
+
.replace('{{PROJECT_ROOT}}', escapeHtml(state.projectRoot))
|
|
385
|
+
.replace('{{CONFIG_NAME}}', escapeHtml(state.configName || 'Not found'))
|
|
386
|
+
.replace(/\{\{EXPO_NAME\}\}/g, escapeHtml(state.expo.name))
|
|
387
|
+
.replace('let STATE = {};', `let STATE = ${payload};`);
|
|
1340
388
|
}
|
|
1341
389
|
|
|
1342
390
|
function openBrowser(url) {
|
|
@@ -1388,6 +436,24 @@ function createServer(options) {
|
|
|
1388
436
|
return;
|
|
1389
437
|
}
|
|
1390
438
|
|
|
439
|
+
if (requestUrl.pathname === '/events') {
|
|
440
|
+
res.writeHead(200, {
|
|
441
|
+
'Content-Type': 'text/event-stream',
|
|
442
|
+
'Cache-Control': 'no-cache',
|
|
443
|
+
'Connection': 'keep-alive',
|
|
444
|
+
});
|
|
445
|
+
res.write('\n');
|
|
446
|
+
sseClients.push(res);
|
|
447
|
+
|
|
448
|
+
req.on('close', () => {
|
|
449
|
+
const index = sseClients.indexOf(res);
|
|
450
|
+
if (index !== -1) {
|
|
451
|
+
sseClients.splice(index, 1);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
|
|
1391
457
|
if (requestUrl.pathname === '/assets/icon') {
|
|
1392
458
|
servePng(res, state.assets.icon.path);
|
|
1393
459
|
return;
|
|
@@ -1435,6 +501,7 @@ function startServer(options) {
|
|
|
1435
501
|
server.on('listening', () => {
|
|
1436
502
|
const url = `http://localhost:${currentPort}`;
|
|
1437
503
|
process.stdout.write(`iconpeek running at ${url}\n`);
|
|
504
|
+
updateWatchers(options.projectRoot);
|
|
1438
505
|
if (options.open && !browserOpened) {
|
|
1439
506
|
browserOpened = true;
|
|
1440
507
|
openBrowser(url);
|