@allons-y/actions-file-diff 0.0.0-stage → 0.2.0

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.
@@ -0,0 +1,1115 @@
1
+ /* Styles for the published visual diff page (page.js → renderHtml). Bundled as text. */
2
+
3
+ /* ---- Tokens ------------------------------------------------------------ */
4
+ :root {
5
+ color-scheme: light dark;
6
+
7
+ --bg: light-dark(#f5f6f8, #0b0d12);
8
+ --surface: light-dark(#fff, #12151c);
9
+ --surface-2: light-dark(#f1f3f6, #181c25);
10
+ --line: light-dark(#e2e5ea, #252a35);
11
+ --line-strong: light-dark(#cdd2da, #353b48);
12
+ --fg: light-dark(#151821, #e6e9ef);
13
+ --muted: light-dark(#5b6372, #98a1b0);
14
+ --accent: light-dark(#4f46e5, #8f8aff);
15
+ --accent-soft: light-dark(#eef0ff, #1d1f3a);
16
+
17
+ --add: light-dark(#1a7f37, #3fb950);
18
+ --add-bg: light-dark(#e9f8ee, #10241a);
19
+ --add-mark: light-dark(#b7ebc6, #1f5130);
20
+ --del: light-dark(#cf222e, #f85149);
21
+ --del-bg: light-dark(#fdeeee, #2a1517);
22
+ --del-mark: light-dark(#f8c4c4, #6b2328);
23
+ --mod: light-dark(#9a6700, #d29922);
24
+ --mod-bg: light-dark(#fff6dd, #2a2110);
25
+ --hunk-bg: light-dark(#f0f4ff, #141b2c);
26
+
27
+ --base: light-dark(#9aa3b2, #5d6676);
28
+ --head: var(--accent);
29
+ --checker-a: light-dark(#e6e8ec, #2a2f3a);
30
+ --checker-b: light-dark(#fff, #1b1f28);
31
+
32
+ --radius: 10px;
33
+ --radius-sm: 6px;
34
+ --shadow: 0 1px 2px light-dark(rgb(16 24 40 / 6%), rgb(0 0 0 / 40%));
35
+ --topbar: 52px;
36
+ --font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
37
+ --mono: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
38
+ }
39
+
40
+ /* ---- Base -------------------------------------------------------------- */
41
+ *,
42
+ *::before,
43
+ *::after {
44
+ box-sizing: border-box;
45
+ }
46
+
47
+ body {
48
+ margin: 0;
49
+ background: var(--bg);
50
+ color: var(--fg);
51
+ font: var(--font);
52
+ -webkit-font-smoothing: antialiased;
53
+ }
54
+
55
+ a {
56
+ color: var(--accent);
57
+ text-decoration: none;
58
+ }
59
+
60
+ a:hover {
61
+ text-decoration: underline;
62
+ }
63
+
64
+ :focus-visible {
65
+ outline: 2px solid var(--accent);
66
+ outline-offset: 2px;
67
+ }
68
+
69
+ svg {
70
+ inline-size: 16px;
71
+ block-size: 16px;
72
+ flex: none;
73
+ fill: none;
74
+ stroke: currentColor;
75
+ stroke-width: 2;
76
+ stroke-linecap: round;
77
+ stroke-linejoin: round;
78
+ }
79
+
80
+ kbd {
81
+ padding: 2px 5px;
82
+ border: 1px solid var(--line-strong);
83
+ border-block-end-width: 2px;
84
+ border-radius: 4px;
85
+ background: var(--surface);
86
+ font:
87
+ 11px/1 ui-monospace,
88
+ monospace;
89
+ }
90
+
91
+ .sr-only {
92
+ position: absolute;
93
+ inline-size: 1px;
94
+ block-size: 1px;
95
+ overflow: hidden;
96
+ clip-path: inset(50%);
97
+ white-space: nowrap;
98
+ }
99
+
100
+ .muted {
101
+ color: var(--muted);
102
+ font-weight: 400;
103
+ }
104
+
105
+ .wrap {
106
+ max-inline-size: 1280px;
107
+ margin-inline: auto;
108
+ padding-inline: 16px;
109
+ }
110
+
111
+ /* ---- Top bar ----------------------------------------------------------- */
112
+ .topbar {
113
+ position: sticky;
114
+ inset-block-start: 0;
115
+ z-index: 10;
116
+ background: color-mix(in srgb, var(--surface) 88%, transparent);
117
+ backdrop-filter: blur(8px);
118
+ border-block-end: 1px solid var(--line);
119
+ }
120
+
121
+ .topbar-inner {
122
+ display: flex;
123
+ align-items: center;
124
+ gap: 12px;
125
+ min-block-size: var(--topbar);
126
+ }
127
+
128
+ .brand {
129
+ display: inline-flex;
130
+ align-items: center;
131
+ gap: 8px;
132
+ font-weight: 600;
133
+ white-space: nowrap;
134
+ }
135
+
136
+ .brand svg {
137
+ inline-size: 20px;
138
+ block-size: 20px;
139
+ color: var(--accent);
140
+ stroke: none;
141
+ }
142
+
143
+ .context {
144
+ overflow: hidden;
145
+ color: var(--muted);
146
+ font: var(--mono);
147
+ text-overflow: ellipsis;
148
+ white-space: nowrap;
149
+ }
150
+
151
+ /* ---- Summary cards ----------------------------------------------------- */
152
+ .cards {
153
+ display: grid;
154
+ grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
155
+ gap: 12px;
156
+ margin-block: 20px 16px;
157
+ }
158
+
159
+ .card {
160
+ padding: 14px 16px;
161
+ background: var(--surface);
162
+ border: 1px solid var(--line);
163
+ border-radius: var(--radius);
164
+ box-shadow: var(--shadow);
165
+ }
166
+
167
+ .card h2 {
168
+ margin: 0;
169
+ color: var(--muted);
170
+ font-size: 12px;
171
+ font-weight: 500;
172
+ letter-spacing: 0.04em;
173
+ text-transform: uppercase;
174
+ }
175
+
176
+ .metric {
177
+ margin: 4px 0 2px;
178
+ font-size: 24px;
179
+ font-weight: 600;
180
+ font-variant-numeric: tabular-nums;
181
+ letter-spacing: -0.01em;
182
+ }
183
+
184
+ .sub {
185
+ margin: 0;
186
+ color: var(--muted);
187
+ font-size: 13px;
188
+ }
189
+
190
+ .chips {
191
+ display: flex;
192
+ flex-wrap: wrap;
193
+ gap: 4px;
194
+ }
195
+
196
+ .chip,
197
+ .pill {
198
+ display: inline-flex;
199
+ align-items: center;
200
+ padding: 0 8px;
201
+ border-radius: 999px;
202
+ font-size: 12px;
203
+ font-weight: 500;
204
+ line-height: 20px;
205
+ white-space: nowrap;
206
+ }
207
+
208
+ .chip.added,
209
+ .pill.added {
210
+ background: var(--add-bg);
211
+ color: var(--add);
212
+ }
213
+
214
+ .chip.removed,
215
+ .pill.removed {
216
+ background: var(--del-bg);
217
+ color: var(--del);
218
+ }
219
+
220
+ .chip.modified,
221
+ .pill.modified {
222
+ background: var(--mod-bg);
223
+ color: var(--mod);
224
+ }
225
+
226
+ .ratio {
227
+ display: block;
228
+ block-size: 6px;
229
+ margin-block-start: 8px;
230
+ overflow: hidden;
231
+ border-radius: 999px;
232
+ background: var(--del);
233
+ }
234
+
235
+ .ratio > span {
236
+ display: block;
237
+ block-size: 100%;
238
+ background: var(--add);
239
+ }
240
+
241
+ .add {
242
+ color: var(--add);
243
+ }
244
+
245
+ .del {
246
+ color: var(--del);
247
+ }
248
+
249
+ .delta {
250
+ font-variant-numeric: tabular-nums;
251
+ white-space: nowrap;
252
+ }
253
+
254
+ .delta small {
255
+ opacity: 0.75;
256
+ }
257
+
258
+ .delta.up {
259
+ color: var(--del);
260
+ }
261
+
262
+ .delta.down {
263
+ color: var(--add);
264
+ }
265
+
266
+ .delta.same {
267
+ color: var(--muted);
268
+ }
269
+
270
+ /* ---- Tabs -------------------------------------------------------------- */
271
+ .tablist {
272
+ display: flex;
273
+ gap: 4px;
274
+ overflow-x: auto;
275
+ border-block-end: 1px solid var(--line);
276
+ scrollbar-width: none;
277
+ }
278
+
279
+ [role="tab"] {
280
+ position: relative;
281
+ display: inline-flex;
282
+ flex: none;
283
+ align-items: center;
284
+ gap: 8px;
285
+ padding: 10px 12px;
286
+ border: 0;
287
+ background: none;
288
+ color: var(--muted);
289
+ font: inherit;
290
+ font-weight: 500;
291
+ cursor: pointer;
292
+ }
293
+
294
+ [role="tab"]:hover,
295
+ [role="tab"][aria-selected="true"] {
296
+ color: var(--fg);
297
+ }
298
+
299
+ /* Underline drawn with a border so it survives forced colors. */
300
+ [role="tab"][aria-selected="true"]::after {
301
+ content: "";
302
+ position: absolute;
303
+ inset: auto 8px -1px;
304
+ border-block-end: 2px solid var(--accent);
305
+ }
306
+
307
+ .count {
308
+ min-inline-size: 20px;
309
+ padding: 0 6px;
310
+ border-radius: 999px;
311
+ background: var(--surface-2);
312
+ color: var(--muted);
313
+ font-size: 12px;
314
+ font-variant-numeric: tabular-nums;
315
+ line-height: 20px;
316
+ text-align: center;
317
+ }
318
+
319
+ [role="tab"][aria-selected="true"] .count {
320
+ background: var(--accent-soft);
321
+ color: var(--accent);
322
+ }
323
+
324
+ /* Spacing lives on the inner wrapper: hidden="until-found" panels still render their own box. */
325
+ .panel {
326
+ padding-block: 16px 32px;
327
+ }
328
+
329
+ .empty-state {
330
+ padding: 48px 16px;
331
+ border: 1px dashed var(--line-strong);
332
+ border-radius: var(--radius);
333
+ background: var(--surface);
334
+ color: var(--muted);
335
+ text-align: center;
336
+ }
337
+
338
+ /* ---- Overview table ---------------------------------------------------- */
339
+ .table-card {
340
+ overflow-x: auto;
341
+ border: 1px solid var(--line);
342
+ border-radius: var(--radius);
343
+ background: var(--surface);
344
+ box-shadow: var(--shadow);
345
+ }
346
+
347
+ .sizes {
348
+ inline-size: 100%;
349
+ border-collapse: collapse;
350
+ font-variant-numeric: tabular-nums;
351
+ }
352
+
353
+ .sizes th,
354
+ .sizes td {
355
+ padding: 8px 12px;
356
+ border-block-end: 1px solid var(--line);
357
+ text-align: start;
358
+ white-space: nowrap;
359
+ }
360
+
361
+ .sizes thead th {
362
+ color: var(--muted);
363
+ font-size: 12px;
364
+ font-weight: 500;
365
+ }
366
+
367
+ .sizes tbody:last-child tr:last-child > * {
368
+ border-block-end: 0;
369
+ }
370
+
371
+ .sizes tr.pkg > * {
372
+ background: var(--surface-2);
373
+ font-weight: 600;
374
+ }
375
+
376
+ .sizes .num {
377
+ text-align: end;
378
+ }
379
+
380
+ .sizes .file-cell {
381
+ inline-size: 100%;
382
+ font: var(--mono);
383
+ }
384
+
385
+ .sizes td:first-child {
386
+ inline-size: 1%;
387
+ padding-inline-end: 0;
388
+ }
389
+
390
+ .sizes .chart {
391
+ min-inline-size: 180px;
392
+ }
393
+
394
+ .bar {
395
+ display: block;
396
+ block-size: 6px;
397
+ margin-block: 3px;
398
+ border-radius: 999px;
399
+ }
400
+
401
+ .bar.base,
402
+ .key.base {
403
+ background: var(--base);
404
+ }
405
+
406
+ .bar.head,
407
+ .key.head {
408
+ background: var(--head);
409
+ }
410
+
411
+ .key {
412
+ display: inline-block;
413
+ margin-inline-start: 6px;
414
+ padding: 0 6px;
415
+ border-radius: 4px;
416
+ color: light-dark(#fff, #0b0d12);
417
+ font-size: 11px;
418
+ line-height: 18px;
419
+ }
420
+
421
+ .dot {
422
+ display: inline-block;
423
+ flex: none;
424
+ inline-size: 8px;
425
+ block-size: 8px;
426
+ border-radius: 50%;
427
+ background: var(--muted);
428
+ }
429
+
430
+ .dot.added {
431
+ background: var(--add);
432
+ }
433
+
434
+ .dot.removed {
435
+ background: var(--del);
436
+ }
437
+
438
+ .dot.modified {
439
+ background: var(--mod);
440
+ }
441
+
442
+ .dot.unchanged {
443
+ background: transparent;
444
+ box-shadow: inset 0 0 0 1.5px var(--line-strong);
445
+ }
446
+
447
+ /* ---- Two-column layout (code + visual) --------------------------------- */
448
+ .layout {
449
+ display: grid;
450
+ grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
451
+ gap: 16px;
452
+ align-items: start;
453
+ }
454
+
455
+ .filelist {
456
+ position: sticky;
457
+ inset-block-start: calc(var(--topbar) + 12px);
458
+ max-block-size: calc(100dvh - var(--topbar) - 24px);
459
+ overflow-y: auto;
460
+ padding: 6px;
461
+ border: 1px solid var(--line);
462
+ border-radius: var(--radius);
463
+ background: var(--surface);
464
+ box-shadow: var(--shadow);
465
+ }
466
+
467
+ @media (width < 860px) {
468
+ .layout {
469
+ grid-template-columns: minmax(0, 1fr);
470
+ }
471
+
472
+ .filelist {
473
+ position: static;
474
+ max-block-size: 220px;
475
+ }
476
+ }
477
+
478
+ .filelist ul {
479
+ margin: 0;
480
+ padding: 0;
481
+ list-style: none;
482
+ }
483
+
484
+ .filelist a,
485
+ .filelist button {
486
+ display: grid;
487
+ grid-template-columns: auto minmax(0, 1fr) auto;
488
+ align-items: center;
489
+ gap: 8px;
490
+ inline-size: 100%;
491
+ padding: 6px 8px;
492
+ border: 0;
493
+ border-radius: var(--radius-sm);
494
+ background: none;
495
+ color: var(--fg);
496
+ font: inherit;
497
+ font-size: 13px;
498
+ text-align: start;
499
+ cursor: pointer;
500
+ }
501
+
502
+ .filelist a:hover,
503
+ .filelist button:hover {
504
+ background: var(--surface-2);
505
+ text-decoration: none;
506
+ }
507
+
508
+ .filelist button[aria-current="true"] {
509
+ background: var(--accent-soft);
510
+ box-shadow: inset 2px 0 0 var(--accent);
511
+ }
512
+
513
+ /* Long paths truncate from the left so the file name stays visible. */
514
+ .path {
515
+ min-inline-size: 0;
516
+ overflow: hidden;
517
+ direction: rtl;
518
+ font: var(--mono);
519
+ text-align: left;
520
+ text-overflow: ellipsis;
521
+ white-space: nowrap;
522
+ }
523
+
524
+ .path > bdi {
525
+ direction: ltr;
526
+ }
527
+
528
+ .dir {
529
+ color: var(--muted);
530
+ }
531
+
532
+ .name {
533
+ font-weight: 600;
534
+ }
535
+
536
+ .meta {
537
+ color: var(--muted);
538
+ font-size: 12px;
539
+ font-variant-numeric: tabular-nums;
540
+ white-space: nowrap;
541
+ }
542
+
543
+ /* ---- Toolbar + segmented controls -------------------------------------- */
544
+ .toolbar {
545
+ display: flex;
546
+ flex-wrap: wrap;
547
+ align-items: center;
548
+ gap: 8px;
549
+ margin-block-end: 12px;
550
+ }
551
+
552
+ .spacer {
553
+ flex: 1;
554
+ }
555
+
556
+ .segmented {
557
+ display: inline-flex;
558
+ max-inline-size: 100%;
559
+ padding: 2px;
560
+ border: 1px solid var(--line);
561
+ border-radius: 8px;
562
+ background: var(--surface-2);
563
+ }
564
+
565
+ .segmented button,
566
+ button.ghost {
567
+ display: inline-flex;
568
+ align-items: center;
569
+ gap: 6px;
570
+ min-block-size: 28px;
571
+ padding: 0 10px;
572
+ border: 1px solid transparent;
573
+ border-radius: 6px;
574
+ background: none;
575
+ color: var(--muted);
576
+ font: inherit;
577
+ font-size: 13px;
578
+ font-weight: 500;
579
+ cursor: pointer;
580
+ }
581
+
582
+ .segmented button[aria-pressed="true"] {
583
+ border-color: var(--line-strong);
584
+ background: var(--surface);
585
+ color: var(--fg);
586
+ box-shadow: var(--shadow);
587
+ }
588
+
589
+ .segmented button[aria-disabled="true"] {
590
+ opacity: 0.4;
591
+ cursor: not-allowed;
592
+ }
593
+
594
+ button.ghost {
595
+ border-color: var(--line);
596
+ background: var(--surface);
597
+ color: var(--fg);
598
+ }
599
+
600
+ @media (hover: hover) {
601
+ .segmented button:not([aria-pressed="true"], [aria-disabled="true"]):hover {
602
+ color: var(--fg);
603
+ }
604
+
605
+ button.ghost:hover {
606
+ border-color: var(--line-strong);
607
+ }
608
+ }
609
+
610
+ @media (pointer: coarse) {
611
+ .segmented button,
612
+ button.ghost {
613
+ min-block-size: 36px;
614
+ }
615
+ }
616
+
617
+ /* Narrow screens: mode buttons keep their icons, and the label stays for screen readers and as a tooltip. */
618
+ @media (width < 560px) {
619
+ .modes button span {
620
+ position: absolute;
621
+ inline-size: 1px;
622
+ block-size: 1px;
623
+ overflow: hidden;
624
+ clip-path: inset(50%);
625
+ white-space: nowrap;
626
+ }
627
+ }
628
+
629
+ /* ---- Code diffs -------------------------------------------------------- */
630
+ .file {
631
+ margin-block-end: 12px;
632
+ overflow: hidden;
633
+ border: 1px solid var(--line);
634
+ border-radius: var(--radius);
635
+ background: var(--surface);
636
+ box-shadow: var(--shadow);
637
+ scroll-margin-block-start: calc(var(--topbar) + 12px);
638
+ /* Skip layout and paint for files scrolled out of view; the size is remembered once they render. */
639
+ content-visibility: auto;
640
+ contain-intrinsic-size: auto none auto 150px;
641
+ }
642
+
643
+ .file summary {
644
+ display: flex;
645
+ align-items: center;
646
+ gap: 10px;
647
+ padding: 8px 12px;
648
+ background: var(--surface-2);
649
+ cursor: pointer;
650
+ list-style: none;
651
+ }
652
+
653
+ .file summary::-webkit-details-marker {
654
+ display: none;
655
+ }
656
+
657
+ .file details[open] > summary {
658
+ border-block-end: 1px solid var(--line);
659
+ }
660
+
661
+ .file summary .path {
662
+ flex: 1;
663
+ }
664
+
665
+ .chev svg {
666
+ display: block;
667
+ color: var(--muted);
668
+ }
669
+
670
+ @media (prefers-reduced-motion: no-preference) {
671
+ .chev svg {
672
+ transition: rotate 0.15s;
673
+ }
674
+ }
675
+
676
+ .file details[open] .chev svg {
677
+ rotate: 90deg;
678
+ }
679
+
680
+ .note {
681
+ margin: 0;
682
+ padding: 12px;
683
+ color: var(--muted);
684
+ }
685
+
686
+ .diff-scroll {
687
+ overflow-x: auto;
688
+ }
689
+
690
+ .diff {
691
+ inline-size: 100%;
692
+ border-collapse: collapse;
693
+ font: var(--mono);
694
+ tab-size: 4;
695
+ }
696
+
697
+ .diff td {
698
+ padding: 0 10px;
699
+ vertical-align: top;
700
+ }
701
+
702
+ .diff .code {
703
+ overflow-wrap: anywhere;
704
+ white-space: pre-wrap;
705
+ }
706
+
707
+ .diff .ln {
708
+ inline-size: 1%;
709
+ color: var(--muted);
710
+ text-align: end;
711
+ white-space: nowrap;
712
+ opacity: 0.8;
713
+ user-select: none;
714
+ }
715
+
716
+ .diff .sign {
717
+ display: inline-block;
718
+ inline-size: 1.5ch;
719
+ color: var(--muted);
720
+ user-select: none;
721
+ }
722
+
723
+ .diff tr.add,
724
+ .diff td.add {
725
+ background: var(--add-bg);
726
+ }
727
+
728
+ .diff tr.del,
729
+ .diff td.del {
730
+ background: var(--del-bg);
731
+ }
732
+
733
+ .diff tr.add .sign {
734
+ color: var(--add);
735
+ }
736
+
737
+ .diff tr.del .sign {
738
+ color: var(--del);
739
+ }
740
+
741
+ .diff mark {
742
+ border-radius: 3px;
743
+ color: inherit;
744
+ }
745
+
746
+ .diff tr.add mark,
747
+ .diff td.add mark {
748
+ background: var(--add-mark);
749
+ }
750
+
751
+ .diff tr.del mark,
752
+ .diff td.del mark {
753
+ background: var(--del-mark);
754
+ }
755
+
756
+ .diff tr.hunk td,
757
+ .diff tr.meta td {
758
+ padding-block: 4px;
759
+ background: var(--hunk-bg);
760
+ color: var(--muted);
761
+ }
762
+
763
+ .diff td.empty {
764
+ background: repeating-linear-gradient(-45deg, transparent 0 6px, var(--surface-2) 6px 12px);
765
+ }
766
+
767
+ .diff.split {
768
+ table-layout: fixed;
769
+ }
770
+
771
+ .diff.split .ln-col {
772
+ inline-size: 52px;
773
+ }
774
+
775
+ .diff.split td.code + td.ln {
776
+ border-inline-start: 1px solid var(--line);
777
+ }
778
+
779
+ /* ---- Visual viewer ----------------------------------------------------- */
780
+ .viewer {
781
+ padding: 12px;
782
+ border: 1px solid var(--line);
783
+ border-radius: var(--radius);
784
+ background: var(--surface);
785
+ box-shadow: var(--shadow);
786
+ }
787
+
788
+ .image-head {
789
+ display: flex;
790
+ flex-wrap: wrap;
791
+ align-items: center;
792
+ gap: 6px 10px;
793
+ margin-block-end: 10px;
794
+ }
795
+
796
+ .image-head .path {
797
+ flex: 1 1 200px;
798
+ }
799
+
800
+ .dims {
801
+ display: inline-flex;
802
+ gap: 8px;
803
+ }
804
+
805
+ .dims span:empty {
806
+ display: none;
807
+ }
808
+
809
+ /* Always rendered so switching modes doesn't shift the image. */
810
+ .sliders {
811
+ display: flex;
812
+ align-items: center;
813
+ gap: 16px;
814
+ min-block-size: 28px;
815
+ margin-block-end: 10px;
816
+ }
817
+
818
+ .slider-field,
819
+ .sliders .hint {
820
+ display: none;
821
+ align-items: center;
822
+ gap: 10px;
823
+ margin: 0;
824
+ color: var(--muted);
825
+ font-size: 13px;
826
+ }
827
+
828
+ .viewer[data-mode="overlay"] .opacity-field,
829
+ .viewer[data-mode="swipe"] .swipe-field,
830
+ .viewer[data-mode="diff"] .diff-hint,
831
+ .viewer[data-mode="side"] .side-hint {
832
+ display: flex;
833
+ }
834
+
835
+ .slider-field output {
836
+ min-inline-size: 4ch;
837
+ color: var(--fg);
838
+ font-variant-numeric: tabular-nums;
839
+ }
840
+
841
+ /* Native range input with custom track, fill and thumb. */
842
+ input[type="range"] {
843
+ --slider-track-size: 4px;
844
+ --slider-thumb-size: 16px;
845
+ --slider-track-color: var(--line-strong);
846
+ --slider-fill-color: var(--accent);
847
+ --attr-min: 0;
848
+ --attr-max: 100;
849
+ --control-value: 50;
850
+ --slider-progress: calc((var(--control-value) - var(--attr-min)) / (var(--attr-max) - var(--attr-min)) * 100%);
851
+
852
+ appearance: none;
853
+ inline-size: min(280px, 50vw);
854
+ block-size: 28px;
855
+ margin: 0;
856
+ padding: 0;
857
+ border: 0;
858
+ background: transparent;
859
+ cursor: pointer;
860
+ }
861
+
862
+ input[type="range"]::-webkit-slider-runnable-track {
863
+ block-size: var(--slider-track-size);
864
+ border-radius: 999px;
865
+ background: linear-gradient(to right, var(--slider-fill-color) var(--slider-progress), var(--slider-track-color) var(--slider-progress));
866
+ }
867
+
868
+ input[type="range"]::-webkit-slider-thumb {
869
+ -webkit-appearance: none;
870
+ appearance: none;
871
+ inline-size: var(--slider-thumb-size);
872
+ block-size: var(--slider-thumb-size);
873
+ margin-block-start: calc((var(--slider-track-size) - var(--slider-thumb-size)) / 2);
874
+ border: 2px solid var(--surface);
875
+ border-radius: 50%;
876
+ background: var(--slider-fill-color);
877
+ box-shadow: 0 0 0 1px var(--slider-fill-color);
878
+ }
879
+
880
+ input[type="range"]::-moz-range-track {
881
+ block-size: var(--slider-track-size);
882
+ border-radius: 999px;
883
+ background: var(--slider-track-color);
884
+ }
885
+
886
+ input[type="range"]::-moz-range-progress {
887
+ block-size: var(--slider-track-size);
888
+ border-radius: 999px;
889
+ background: var(--slider-fill-color);
890
+ }
891
+
892
+ input[type="range"]::-moz-range-thumb {
893
+ inline-size: var(--slider-thumb-size);
894
+ block-size: var(--slider-thumb-size);
895
+ border: 2px solid var(--surface);
896
+ border-radius: 50%;
897
+ background: var(--slider-fill-color);
898
+ }
899
+
900
+ input[type="range"]:focus-visible {
901
+ outline: 2px solid var(--accent);
902
+ outline-offset: 4px;
903
+ }
904
+
905
+ /* Stage + layers. Side by side: two cells. Other modes: one stacked cell. */
906
+ .stage {
907
+ display: grid;
908
+ place-items: center;
909
+ min-block-size: 260px;
910
+ padding: 16px;
911
+ overflow: auto;
912
+ border: 1px solid var(--line);
913
+ border-radius: var(--radius-sm);
914
+ background: var(--surface-2);
915
+ }
916
+
917
+ .layers {
918
+ position: relative;
919
+ display: grid;
920
+ grid-template-columns: repeat(2, auto);
921
+ gap: 16px;
922
+ align-items: start;
923
+ max-inline-size: 100%;
924
+ touch-action: pan-y;
925
+ }
926
+
927
+ .layer {
928
+ display: grid;
929
+ justify-items: center;
930
+ gap: 6px;
931
+ min-inline-size: 0;
932
+ margin: 0;
933
+ }
934
+
935
+ .layer img {
936
+ display: block;
937
+ max-inline-size: 100%;
938
+ block-size: auto;
939
+ border-radius: 2px;
940
+ }
941
+
942
+ /* Script sets each image's width; zoomed images may exceed the stage and scroll. */
943
+ .viewer:not([data-zoom="fit"]) .layer img {
944
+ max-inline-size: none;
945
+ }
946
+
947
+ .layer img.upscaled {
948
+ image-rendering: pixelated;
949
+ }
950
+
951
+ .layer figcaption {
952
+ color: var(--muted);
953
+ font-size: 12px;
954
+ }
955
+
956
+ .layer.missing {
957
+ place-items: center;
958
+ min-inline-size: 160px;
959
+ min-block-size: 120px;
960
+ border: 1px dashed var(--line-strong);
961
+ border-radius: var(--radius-sm);
962
+ }
963
+
964
+ /* Image backgrounds: checker shows transparency. */
965
+ .viewer[data-bg="checker"] .layer img {
966
+ background: repeating-conic-gradient(var(--checker-a) 0 25%, var(--checker-b) 0 50%) 0 0 / 16px 16px;
967
+ }
968
+
969
+ .viewer[data-bg="light"] :is(.layer img, .stage) {
970
+ background: #fff;
971
+ }
972
+
973
+ .viewer[data-bg="dark"] :is(.layer img, .stage) {
974
+ background: #111;
975
+ }
976
+
977
+ /* Stacked modes: base and head share one grid cell. */
978
+ .viewer:is([data-mode="overlay"], [data-mode="swipe"], [data-mode="diff"]) .image-item:not([data-single]) {
979
+ .layers {
980
+ grid-template-columns: auto;
981
+ gap: 0;
982
+ }
983
+
984
+ .layer {
985
+ grid-area: 1 / 1;
986
+ }
987
+
988
+ .layer figcaption {
989
+ display: none;
990
+ }
991
+
992
+ /* Only the base draws a background, so it can't hide behind the head. */
993
+ .layer.head img {
994
+ background: none;
995
+ }
996
+ }
997
+
998
+ .viewer[data-mode="overlay"] .image-item:not([data-single]) .layer.head {
999
+ opacity: var(--opacity);
1000
+ }
1001
+
1002
+ .viewer[data-mode="swipe"] .image-item:not([data-single]) {
1003
+ .layers {
1004
+ cursor: ew-resize;
1005
+ touch-action: none;
1006
+ }
1007
+
1008
+ .layer.head {
1009
+ clip-path: inset(0 0 0 var(--pos));
1010
+ }
1011
+
1012
+ .divider,
1013
+ .tag {
1014
+ display: block;
1015
+ }
1016
+
1017
+ .divider {
1018
+ inset-inline-start: var(--pos);
1019
+ }
1020
+ }
1021
+
1022
+ .viewer[data-mode="diff"] .image-item:not([data-single]) {
1023
+ .stage,
1024
+ .layer.base img {
1025
+ background: #000;
1026
+ }
1027
+
1028
+ .layer.head {
1029
+ mix-blend-mode: difference;
1030
+ }
1031
+ }
1032
+
1033
+ /* Single-version images always show one cell. */
1034
+ .image-item[data-single] .layer.missing {
1035
+ display: none;
1036
+ }
1037
+
1038
+ .divider {
1039
+ position: absolute;
1040
+ inset-block: 0;
1041
+ display: none;
1042
+ inline-size: 2px;
1043
+ margin-inline-start: -1px;
1044
+ background: var(--accent);
1045
+ box-shadow: 0 0 0 1px light-dark(rgb(255 255 255 / 70%), rgb(0 0 0 / 60%));
1046
+ pointer-events: none;
1047
+ }
1048
+
1049
+ .divider::after {
1050
+ content: "";
1051
+ position: absolute;
1052
+ inset-block-start: 50%;
1053
+ inset-inline-start: 50%;
1054
+ inline-size: 14px;
1055
+ block-size: 28px;
1056
+ border: 2px solid var(--surface);
1057
+ border-radius: 999px;
1058
+ background: var(--accent);
1059
+ translate: -50% -50%;
1060
+ }
1061
+
1062
+ .tag {
1063
+ position: absolute;
1064
+ inset-block-start: 6px;
1065
+ display: none;
1066
+ padding: 0 6px;
1067
+ border-radius: 4px;
1068
+ background: rgb(0 0 0 / 60%);
1069
+ color: #fff;
1070
+ font-size: 11px;
1071
+ line-height: 18px;
1072
+ pointer-events: none;
1073
+ }
1074
+
1075
+ .tag-base {
1076
+ inset-inline-start: 6px;
1077
+ }
1078
+
1079
+ .tag-head {
1080
+ inset-inline-end: 6px;
1081
+ }
1082
+
1083
+ .pager {
1084
+ display: flex;
1085
+ flex-wrap: wrap;
1086
+ align-items: center;
1087
+ gap: 8px;
1088
+ margin-block-start: 12px;
1089
+ }
1090
+
1091
+ .pager-count,
1092
+ .pager .hint {
1093
+ color: var(--muted);
1094
+ font-size: 13px;
1095
+ font-variant-numeric: tabular-nums;
1096
+ }
1097
+
1098
+ .pager .hint {
1099
+ margin-inline-start: auto;
1100
+ }
1101
+
1102
+ /* ---- Footer ------------------------------------------------------------ */
1103
+ .footer {
1104
+ padding-block: 8px 32px;
1105
+ color: var(--muted);
1106
+ font-size: 12px;
1107
+ }
1108
+
1109
+ @media (forced-colors: active) {
1110
+ .bar,
1111
+ .dot,
1112
+ .ratio > span {
1113
+ forced-color-adjust: none;
1114
+ }
1115
+ }