@jekrch/react-viewport-lightbox 0.2.0 → 0.3.1
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/README.md +30 -22
- package/dist/index.cjs +88 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -1
- package/dist/index.d.ts +58 -1
- package/dist/index.js +88 -14
- package/dist/index.js.map +1 -1
- package/dist/styles.css +64 -7
- package/package.json +1 -1
package/dist/styles.css
CHANGED
|
@@ -14,9 +14,25 @@
|
|
|
14
14
|
--rvl-bar-fg-faint: rgba(255, 255, 255, 0.3);
|
|
15
15
|
--rvl-btn-bg: rgba(255, 255, 255, 0.1);
|
|
16
16
|
--rvl-btn-bg-hover: rgba(255, 255, 255, 0.2);
|
|
17
|
+
/* Toggled (`is-active`) button fill. Left undeclared so the active rule's
|
|
18
|
+
`var(--rvl-accent)` fallback resolves at the button (picking up an accent
|
|
19
|
+
overridden on an ancestor). Override it (e.g. to a translucent
|
|
20
|
+
`color-mix(in srgb, var(--rvl-accent) 20%, transparent)`) for a subtler
|
|
21
|
+
wash; setting it to `var(--rvl-accent)` here would re-freeze it to the
|
|
22
|
+
:root accent. */
|
|
23
|
+
/* Monospace stack for the counter / zoom-scale readout. Override to theme it
|
|
24
|
+
with an app font (e.g. a custom monospace face). */
|
|
25
|
+
--rvl-font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
17
26
|
--rvl-radius: 4px;
|
|
18
27
|
--rvl-anim-duration: 250ms;
|
|
19
28
|
--rvl-z: 50;
|
|
29
|
+
/* Size of the bottom prev/next nav arrows. Settable via the `navHeight` prop.
|
|
30
|
+
Defaults to 38px to match the comic-snaps viewer. */
|
|
31
|
+
--rvl-nav-height: 2.375rem;
|
|
32
|
+
/* Gap between the bottom nav controls and the viewport's bottom edge. Settable
|
|
33
|
+
via the `navInset` prop; floored by the device safe-area inset. Defaults to
|
|
34
|
+
1.3rem to match the comic-snaps viewer. */
|
|
35
|
+
--rvl-nav-inset: 1.3rem;
|
|
20
36
|
}
|
|
21
37
|
|
|
22
38
|
/* Root overlay -------------------------------------------------------------- */
|
|
@@ -32,6 +48,10 @@
|
|
|
32
48
|
background-color: rgba(0, 0, 0, 0);
|
|
33
49
|
transition: background-color var(--rvl-anim-duration) ease-out;
|
|
34
50
|
-webkit-tap-highlight-color: transparent;
|
|
51
|
+
/* Prevent iOS Safari from auto-inflating text on rotation to landscape and
|
|
52
|
+
failing to restore it on rotation back to portrait. */
|
|
53
|
+
-webkit-text-size-adjust: 100%;
|
|
54
|
+
text-size-adjust: 100%;
|
|
35
55
|
}
|
|
36
56
|
.rvl-root.rvl-visible {
|
|
37
57
|
background-color: var(--rvl-overlay-bg);
|
|
@@ -75,7 +95,7 @@
|
|
|
75
95
|
.rvl-bottom-bar {
|
|
76
96
|
bottom: 0;
|
|
77
97
|
padding-top: 1rem;
|
|
78
|
-
padding-bottom: max(
|
|
98
|
+
padding-bottom: max(var(--rvl-nav-inset), env(safe-area-inset-bottom));
|
|
79
99
|
opacity: 0;
|
|
80
100
|
transform: translateY(0.5rem);
|
|
81
101
|
}
|
|
@@ -151,11 +171,25 @@
|
|
|
151
171
|
}
|
|
152
172
|
.rvl-btn.is-active {
|
|
153
173
|
color: #fff;
|
|
154
|
-
background: var(--rvl-accent);
|
|
174
|
+
background: var(--rvl-btn-bg-active, var(--rvl-accent));
|
|
155
175
|
}
|
|
156
176
|
.rvl-btn-scale {
|
|
157
177
|
font-variant-numeric: tabular-nums;
|
|
158
|
-
font-family:
|
|
178
|
+
font-family: var(--rvl-font-mono);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Icons inherit their button's color so currentColor-based glyphs (e.g. lucide)
|
|
182
|
+
track the button's resting/hover/active color. The whole icon subtree is
|
|
183
|
+
covered, not just the root <svg>: a consumer's global `* { color }` rule sets
|
|
184
|
+
a color on the inner <path>/<line> nodes, and currentColor (the lucide stroke)
|
|
185
|
+
re-resolves against each node's own color — so without forcing the children to
|
|
186
|
+
inherit too, the strokes stay stuck at that color (looking permanently
|
|
187
|
+
"hovered" and the wrong hue). */
|
|
188
|
+
.rvl-btn svg,
|
|
189
|
+
.rvl-btn svg *,
|
|
190
|
+
.rvl-nav-btn svg,
|
|
191
|
+
.rvl-nav-btn svg * {
|
|
192
|
+
color: inherit;
|
|
159
193
|
}
|
|
160
194
|
|
|
161
195
|
/* Image stage --------------------------------------------------------------- */
|
|
@@ -294,6 +328,19 @@
|
|
|
294
328
|
right: 0;
|
|
295
329
|
}
|
|
296
330
|
|
|
331
|
+
/* Inline placement (`navSlotPlacement="inline"`): the nav slots sit directly
|
|
332
|
+
flanking the prev/counter/next group as one centered cluster, so an
|
|
333
|
+
info/details toggle hugs the arrows instead of being flung to the row edges.
|
|
334
|
+
The slots become normal flex children laid out by the inner's gap. */
|
|
335
|
+
.rvl-nav-inner.rvl-nav-inline {
|
|
336
|
+
gap: 0.75rem;
|
|
337
|
+
}
|
|
338
|
+
.rvl-nav-inline .rvl-nav-start,
|
|
339
|
+
.rvl-nav-inline .rvl-nav-end {
|
|
340
|
+
position: static;
|
|
341
|
+
transform: none;
|
|
342
|
+
}
|
|
343
|
+
|
|
297
344
|
.rvl-nav-btn {
|
|
298
345
|
display: inline-flex;
|
|
299
346
|
align-items: center;
|
|
@@ -306,11 +353,18 @@
|
|
|
306
353
|
color: rgba(255, 255, 255, 0.4);
|
|
307
354
|
transition: color 0.15s ease-out;
|
|
308
355
|
}
|
|
356
|
+
/* Drive the arrow glyph size from the theme var so `navHeight` resizes the
|
|
357
|
+
default (and any consumer-supplied) nav icons. CSS wins over the SVG's own
|
|
358
|
+
width/height attributes. */
|
|
359
|
+
.rvl-nav-btn svg {
|
|
360
|
+
width: var(--rvl-nav-height);
|
|
361
|
+
height: var(--rvl-nav-height);
|
|
362
|
+
}
|
|
309
363
|
.rvl-nav-btn:hover:not(:disabled) {
|
|
310
|
-
color: rgba(255, 255, 255, 0.
|
|
364
|
+
color: rgba(255, 255, 255, 0.6);
|
|
311
365
|
}
|
|
312
366
|
.rvl-nav-btn:active:not(:disabled) {
|
|
313
|
-
color: rgba(255, 255, 255, 0.
|
|
367
|
+
color: rgba(255, 255, 255, 0.8);
|
|
314
368
|
}
|
|
315
369
|
.rvl-nav-btn:disabled {
|
|
316
370
|
color: rgba(255, 255, 255, 0.1);
|
|
@@ -324,11 +378,14 @@
|
|
|
324
378
|
.rvl-counter {
|
|
325
379
|
display: inline-block;
|
|
326
380
|
text-align: center;
|
|
327
|
-
|
|
381
|
+
/* Scale the counter with the nav arrows so the whole cluster grows together
|
|
382
|
+
(0.29 ≈ 11px at the 38px default, matching comic-snaps). Set the
|
|
383
|
+
`counterFontSize` prop / `--rvl-counter-font-size` to override the ratio. */
|
|
384
|
+
font-size: var(--rvl-counter-font-size, calc(var(--rvl-nav-height) * 0.29));
|
|
328
385
|
letter-spacing: 0.02em;
|
|
329
386
|
color: var(--rvl-bar-fg-muted);
|
|
330
387
|
font-variant-numeric: tabular-nums;
|
|
331
|
-
font-family:
|
|
388
|
+
font-family: var(--rvl-font-mono);
|
|
332
389
|
user-select: none;
|
|
333
390
|
}
|
|
334
391
|
|
package/package.json
CHANGED