@robert-stackflow/oneui 0.6.33 → 0.6.34
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/CHANGELOG.md +4 -0
- package/README.md +4 -0
- package/components/Lightbox.js +95 -31
- package/components/Lightbox.module.css +224 -224
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.6.34
|
|
2
|
+
|
|
3
|
+
- Close Lightbox on empty-space clicks while guarding image/control clicks and drag/pinch gestures. Return visible images with Hero motion; missing, offscreen, zoomed or failed origins fade out gently together with the black canvas.
|
|
4
|
+
|
|
1
5
|
## 0.6.33
|
|
2
6
|
|
|
3
7
|
- Animate Lightbox image changes with directional transitions that retain the outgoing image, add a sliding thumbnail selection indicator and keyboard focus ring, and preserve document width in the shared nested modal scroll lock.
|
package/README.md
CHANGED
|
@@ -293,3 +293,7 @@ Menu 支持 iconOnly:`<Menu iconOnly label="更多操作" items={items} />`
|
|
|
293
293
|
The viewer uses an opaque black canvas with light controls independently of the document color mode. It supports captions, thumbnail navigation, non-wrapping previous/next, arrow keys, Escape, original-size zoom, bounded dragging, touch pinch/swipe and manual retry of the original URL. A single image hides navigation. Only adjacent full images are preloaded. It uses native modal isolation and shared OneUI focus, scroll lock and motion; reduced motion and missing/offscreen source elements use a quiet fallback. Keep the component mounted through exit and retain the selected index. Resolve resource permissions and document anchors in the host, not inside OneUI.
|
|
294
294
|
|
|
295
295
|
Image changes retain the existing outgoing image for a directional fade/slide, without remounting it for the animation. Thumbnail selection uses a moving outline and a separate keyboard focus ring. Shared modal scroll locking preserves classic scrollbar space, nested lock ownership and original document styles.
|
|
296
|
+
|
|
297
|
+
Clicking empty viewer space closes it. Pointer origin, movement and cancellation are tracked so image/control clicks, dragging and multi-pointer gestures do not accidentally dismiss it. Escape and the close button remain available.
|
|
298
|
+
|
|
299
|
+
Closing returns a visible source image with Hero motion. Missing/offscreen sources, zoomed images and origin-resolution errors use a gentle image fade/scale; the opaque black canvas fades with the surface rather than leaving a solid backdrop that snaps away. The canvas spans the viewport while the underlying document retains its scrollbar gutter.
|
package/components/Lightbox.js
CHANGED
|
@@ -66,6 +66,7 @@ function Lightbox(props) {
|
|
|
66
66
|
const open = props.open && props.items.length > 0 && owner?.active !== false;
|
|
67
67
|
const opened = useRef(open);
|
|
68
68
|
opened.current = open;
|
|
69
|
+
const [present, setPresent] = useState(open);
|
|
69
70
|
const [closing, setClosing] = useState(false), [status, setStatus] = useState("loading");
|
|
70
71
|
const [zoom, setZoom] = useState(1), [pan, setPan] = useState({ x: 0, y: 0 });
|
|
71
72
|
const itemKey = item ? item.id + item.src : "";
|
|
@@ -80,6 +81,8 @@ function Lightbox(props) {
|
|
|
80
81
|
});
|
|
81
82
|
const slideState = useRef(slide);
|
|
82
83
|
slideState.current = slide;
|
|
84
|
+
const blankGesture = useRef(null);
|
|
85
|
+
const isBlank = (target) => target === ref.current || target === stageRef.current || target instanceof HTMLElement && target.hasAttribute("data-lightbox-blank");
|
|
83
86
|
const pointers = useRef(/* @__PURE__ */ new Map());
|
|
84
87
|
const gesture = useRef({
|
|
85
88
|
x: 0,
|
|
@@ -105,37 +108,71 @@ function Lightbox(props) {
|
|
|
105
108
|
return { x: clamp(x, -maxX, maxX), y: clamp(y, -maxY, maxY) };
|
|
106
109
|
};
|
|
107
110
|
const animateImage = (exit) => {
|
|
108
|
-
const img = imageRef.current
|
|
109
|
-
|
|
110
|
-
if (!img || !origin?.isConnected || !img.complete || !img.naturalWidth || reducedMotion())
|
|
111
|
-
return Promise.resolve();
|
|
112
|
-
const from = origin.getBoundingClientRect(), to = img.getBoundingClientRect();
|
|
113
|
-
if (!from.width || !to.width || from.bottom <= 0 || from.top >= innerHeight || from.right <= 0 || from.left >= innerWidth)
|
|
111
|
+
const img = imageRef.current;
|
|
112
|
+
if (!img || !img.complete || !img.naturalWidth || reducedMotion())
|
|
114
113
|
return Promise.resolve();
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const clipPath = `inset(${Math.max(0, (to.height - from.height / scale) / 2)}px ${Math.max(0, (to.width - from.width / scale) / 2)}px)`;
|
|
114
|
+
const style = getComputedStyle(img);
|
|
115
|
+
const startTransform = style.transform || "none", startOpacity = style.opacity, startClip = style.clipPath || "inset(0px)";
|
|
118
116
|
hero.current?.cancel();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
if (exit)
|
|
118
|
+
slideAnimations.current.forEach((animation) => animation.cancel());
|
|
119
|
+
const options = {
|
|
120
|
+
duration: motionDuration(exit ? "--popup-exit" : "--popup-enter", 180),
|
|
121
|
+
easing: "cubic-bezier(.2,.7,.2,1)"
|
|
122
|
+
};
|
|
123
|
+
const run = (frames) => {
|
|
124
|
+
try {
|
|
125
|
+
const animation = img.animate(frames, options);
|
|
126
|
+
hero.current = animation;
|
|
127
|
+
return animation.finished.then(
|
|
128
|
+
() => {
|
|
129
|
+
},
|
|
130
|
+
() => {
|
|
131
|
+
}
|
|
132
|
+
);
|
|
133
|
+
} catch {
|
|
134
|
+
return Promise.resolve();
|
|
130
135
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
};
|
|
137
|
+
const fade = () => exit ? run([
|
|
138
|
+
{
|
|
139
|
+
opacity: startOpacity,
|
|
140
|
+
transform: startTransform,
|
|
141
|
+
clipPath: startClip
|
|
135
142
|
},
|
|
136
|
-
|
|
143
|
+
{
|
|
144
|
+
opacity: 0,
|
|
145
|
+
transform: `${startTransform === "none" ? "" : startTransform} scale(.985)`,
|
|
146
|
+
clipPath: startClip
|
|
137
147
|
}
|
|
138
|
-
);
|
|
148
|
+
]) : Promise.resolve();
|
|
149
|
+
if (exit && zoom !== 1) return fade();
|
|
150
|
+
try {
|
|
151
|
+
const current = items[clamp(live.current.index, 0, items.length - 1)];
|
|
152
|
+
const origin = current ? live.current.sourceElement?.(current) : null;
|
|
153
|
+
if (!origin?.isConnected) return fade();
|
|
154
|
+
const from = origin.getBoundingClientRect(), to = img.getBoundingClientRect();
|
|
155
|
+
if (!from.width || !from.height || !to.width || !to.height || from.bottom <= 0 || from.top >= innerHeight || from.right <= 0 || from.left >= innerWidth)
|
|
156
|
+
return fade();
|
|
157
|
+
const scale = Math.max(from.width / to.width, from.height / to.height);
|
|
158
|
+
const transform = `translate(${from.left + from.width / 2 - to.left - to.width / 2}px, ${from.top + from.height / 2 - to.top - to.height / 2}px) scale(${scale})`;
|
|
159
|
+
const clipPath = `inset(${Math.max(0, (to.height - from.height / scale) / 2)}px ${Math.max(0, (to.width - from.width / scale) / 2)}px)`;
|
|
160
|
+
return run(
|
|
161
|
+
exit ? [
|
|
162
|
+
{
|
|
163
|
+
transform: startTransform,
|
|
164
|
+
clipPath: startClip,
|
|
165
|
+
opacity: startOpacity
|
|
166
|
+
},
|
|
167
|
+
{ transform, clipPath, opacity: 0.3 }
|
|
168
|
+
] : [
|
|
169
|
+
{ transform, clipPath, opacity: 0.3 },
|
|
170
|
+
{ transform: "none", clipPath: "inset(0px)", opacity: 1 }
|
|
171
|
+
]
|
|
172
|
+
);
|
|
173
|
+
} catch {
|
|
174
|
+
return fade();
|
|
175
|
+
}
|
|
139
176
|
};
|
|
140
177
|
const finishSlide = (key) => setSlide(
|
|
141
178
|
(current) => current.key === key ? { ...current, previous: void 0 } : current
|
|
@@ -242,6 +279,7 @@ function Lightbox(props) {
|
|
|
242
279
|
const dialog = ref.current;
|
|
243
280
|
if (!dialog) return;
|
|
244
281
|
if (open) {
|
|
282
|
+
setPresent(true);
|
|
245
283
|
dialog.inert = false;
|
|
246
284
|
setClosing(false);
|
|
247
285
|
if (!dialog.open) {
|
|
@@ -260,11 +298,14 @@ function Lightbox(props) {
|
|
|
260
298
|
if (!dialog.open) return;
|
|
261
299
|
dialog.inert = true;
|
|
262
300
|
setClosing(true);
|
|
263
|
-
const imageExit =
|
|
301
|
+
const imageExit = animateImage(true);
|
|
264
302
|
void Promise.all([surfaceMotion(dialog, "exit", "0 0"), imageExit]).then(
|
|
265
303
|
([done]) => {
|
|
266
304
|
if (!done || opened.current) return;
|
|
267
305
|
dialog.close();
|
|
306
|
+
setPresent(false);
|
|
307
|
+
setZoom(1);
|
|
308
|
+
setPan({ x: 0, y: 0 });
|
|
268
309
|
restoreFocus();
|
|
269
310
|
setClosing(false);
|
|
270
311
|
const target = locate.current;
|
|
@@ -343,6 +384,29 @@ function Lightbox(props) {
|
|
|
343
384
|
"aria-labelledby": titleId,
|
|
344
385
|
"aria-describedby": item.caption ? captionId : void 0,
|
|
345
386
|
"aria-modal": "true",
|
|
387
|
+
onPointerDownCapture: (event) => {
|
|
388
|
+
blankGesture.current = event.isPrimary && event.button === 0 ? {
|
|
389
|
+
id: event.pointerId,
|
|
390
|
+
x: event.clientX,
|
|
391
|
+
y: event.clientY,
|
|
392
|
+
moved: false,
|
|
393
|
+
blank: isBlank(event.target)
|
|
394
|
+
} : null;
|
|
395
|
+
},
|
|
396
|
+
onPointerMoveCapture: (event) => {
|
|
397
|
+
const start = blankGesture.current;
|
|
398
|
+
if (start && Math.hypot(event.clientX - start.x, event.clientY - start.y) > 6)
|
|
399
|
+
start.moved = true;
|
|
400
|
+
},
|
|
401
|
+
onPointerUpCapture: (event) => {
|
|
402
|
+
const start = blankGesture.current;
|
|
403
|
+
blankGesture.current = null;
|
|
404
|
+
if (start?.id === event.pointerId && start.blank && !start.moved && isBlank(event.target))
|
|
405
|
+
props.onClose();
|
|
406
|
+
},
|
|
407
|
+
onPointerCancelCapture: () => {
|
|
408
|
+
blankGesture.current = null;
|
|
409
|
+
},
|
|
346
410
|
onCancel: (event) => {
|
|
347
411
|
event.preventDefault();
|
|
348
412
|
props.onClose();
|
|
@@ -355,7 +419,7 @@ function Lightbox(props) {
|
|
|
355
419
|
},
|
|
356
420
|
children: [
|
|
357
421
|
/* @__PURE__ */ jsx("h2", { id: titleId, className: s.srOnly, children: t.title }),
|
|
358
|
-
/* @__PURE__ */ jsxs("header", { className: s.header, children: [
|
|
422
|
+
/* @__PURE__ */ jsxs("header", { className: s.header, "data-lightbox-blank": "", children: [
|
|
359
423
|
/* @__PURE__ */ jsxs("span", { className: s.counter, role: "status", "aria-live": "polite", children: [
|
|
360
424
|
index + 1,
|
|
361
425
|
" / ",
|
|
@@ -385,7 +449,7 @@ function Lightbox(props) {
|
|
|
385
449
|
/* @__PURE__ */ jsx(IconButton, { ref: closeRef, label: t.close, onClick: props.onClose, children: /* @__PURE__ */ jsx(X, { size: 20 }) })
|
|
386
450
|
] })
|
|
387
451
|
] }),
|
|
388
|
-
/* @__PURE__ */ jsxs("div", { className: s.canvas, children: [
|
|
452
|
+
/* @__PURE__ */ jsxs("div", { className: s.canvas, "data-lightbox-blank": "", children: [
|
|
389
453
|
items.length > 1 && /* @__PURE__ */ jsx(
|
|
390
454
|
IconButton,
|
|
391
455
|
{
|
|
@@ -415,7 +479,7 @@ function Lightbox(props) {
|
|
|
415
479
|
"img",
|
|
416
480
|
{
|
|
417
481
|
ref: current ? imageRef : outgoingRef,
|
|
418
|
-
src: open ||
|
|
482
|
+
src: open || present ? entry.src : void 0,
|
|
419
483
|
alt: current ? entry.alt : "",
|
|
420
484
|
"aria-hidden": !current || void 0,
|
|
421
485
|
width: entry.width,
|
|
@@ -510,7 +574,7 @@ function Lightbox(props) {
|
|
|
510
574
|
children: /* @__PURE__ */ jsx(
|
|
511
575
|
"img",
|
|
512
576
|
{
|
|
513
|
-
src: open ||
|
|
577
|
+
src: open || present ? entry.thumbnailSrc || entry.src : void 0,
|
|
514
578
|
alt: "",
|
|
515
579
|
loading: "lazy",
|
|
516
580
|
draggable: false
|
|
@@ -1,224 +1,224 @@
|
|
|
1
|
-
.lightbox {
|
|
2
|
-
position: fixed;
|
|
3
|
-
inset: 0;
|
|
4
|
-
width:
|
|
5
|
-
height: 100dvh;
|
|
6
|
-
max-width: none;
|
|
7
|
-
max-height: none;
|
|
8
|
-
margin: 0;
|
|
9
|
-
border: 0;
|
|
10
|
-
padding: max(12px, env(safe-area-inset-top))
|
|
11
|
-
max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
|
|
12
|
-
max(16px, env(safe-area-inset-left));
|
|
13
|
-
/* Image viewing is an opaque dark surface in every document color mode. */
|
|
14
|
-
color-scheme: dark;
|
|
15
|
-
--surface: #1d1d1d;
|
|
16
|
-
--fg: #f5f5f5;
|
|
17
|
-
--accent: var(--fg);
|
|
18
|
-
--accent-ink: var(--fg);
|
|
19
|
-
--soft: #262626;
|
|
20
|
-
--muted: #b5b5b5;
|
|
21
|
-
--hover: #ffffff18;
|
|
22
|
-
--line: #ffffff24;
|
|
23
|
-
background: #111;
|
|
24
|
-
color: var(--fg);
|
|
25
|
-
overflow: hidden;
|
|
26
|
-
}
|
|
27
|
-
.lightbox[open] {
|
|
28
|
-
display: grid;
|
|
29
|
-
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
|
30
|
-
gap: 12px;
|
|
31
|
-
}
|
|
32
|
-
.lightbox::backdrop {
|
|
33
|
-
background:
|
|
34
|
-
}
|
|
35
|
-
.header {
|
|
36
|
-
display: flex;
|
|
37
|
-
align-items: center;
|
|
38
|
-
justify-content: space-between;
|
|
39
|
-
min-height: 40px;
|
|
40
|
-
}
|
|
41
|
-
.counter {
|
|
42
|
-
color: var(--muted);
|
|
43
|
-
font-size: 13px;
|
|
44
|
-
font-variant-numeric: tabular-nums;
|
|
45
|
-
padding-inline: 8px;
|
|
46
|
-
}
|
|
47
|
-
.actions {
|
|
48
|
-
display: flex;
|
|
49
|
-
gap: 4px;
|
|
50
|
-
align-items: center;
|
|
51
|
-
}
|
|
52
|
-
.canvas {
|
|
53
|
-
position: relative;
|
|
54
|
-
min-height: 0;
|
|
55
|
-
display: flex;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
align-items: stretch;
|
|
58
|
-
}
|
|
59
|
-
.stage {
|
|
60
|
-
flex: 1;
|
|
61
|
-
min-width: 0;
|
|
62
|
-
min-height: 0;
|
|
63
|
-
position: relative;
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
overflow: hidden;
|
|
68
|
-
touch-action: none;
|
|
69
|
-
user-select: none;
|
|
70
|
-
}
|
|
71
|
-
.stage[data-zoomed] {
|
|
72
|
-
cursor: grab;
|
|
73
|
-
}
|
|
74
|
-
.stage[data-zoomed]:active {
|
|
75
|
-
cursor: grabbing;
|
|
76
|
-
}
|
|
77
|
-
.image {
|
|
78
|
-
display: block;
|
|
79
|
-
width: auto;
|
|
80
|
-
height: auto;
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
max-height: 100%;
|
|
83
|
-
object-fit: contain;
|
|
84
|
-
transform-origin: center;
|
|
85
|
-
border-radius: 2px;
|
|
86
|
-
flex-shrink: 0;
|
|
87
|
-
}
|
|
88
|
-
.previous,
|
|
89
|
-
.next {
|
|
90
|
-
position: absolute;
|
|
91
|
-
top: calc(50% - 20px);
|
|
92
|
-
z-index: 1;
|
|
93
|
-
border-radius: 50%;
|
|
94
|
-
background: color-mix(in srgb, var(--surface) 90%, transparent);
|
|
95
|
-
}
|
|
96
|
-
.previous {
|
|
97
|
-
left: 0;
|
|
98
|
-
}
|
|
99
|
-
.next {
|
|
100
|
-
right: 0;
|
|
101
|
-
}
|
|
102
|
-
.feedback {
|
|
103
|
-
position: absolute;
|
|
104
|
-
inset: 0;
|
|
105
|
-
display: flex;
|
|
106
|
-
gap: 12px;
|
|
107
|
-
align-items: center;
|
|
108
|
-
justify-content: center;
|
|
109
|
-
color: var(--muted);
|
|
110
|
-
font-size: 13px;
|
|
111
|
-
}
|
|
112
|
-
.caption {
|
|
113
|
-
justify-self: center;
|
|
114
|
-
max-width: min(760px, 90vw);
|
|
115
|
-
max-height: 15dvh;
|
|
116
|
-
overflow: auto;
|
|
117
|
-
font-size: 13px;
|
|
118
|
-
line-height: 1.6;
|
|
119
|
-
text-align: center;
|
|
120
|
-
overflow-wrap: anywhere;
|
|
121
|
-
}
|
|
122
|
-
.thumbnails {
|
|
123
|
-
position: relative;
|
|
124
|
-
display: flex;
|
|
125
|
-
gap: 8px;
|
|
126
|
-
max-width: 100%;
|
|
127
|
-
margin-inline: auto;
|
|
128
|
-
overflow-x: auto;
|
|
129
|
-
padding: 4px;
|
|
130
|
-
}
|
|
131
|
-
.thumbnails button {
|
|
132
|
-
flex: 0 0 56px;
|
|
133
|
-
width: 56px;
|
|
134
|
-
height: 44px;
|
|
135
|
-
padding: 2px;
|
|
136
|
-
border: 1px solid transparent;
|
|
137
|
-
border-radius: var(--radius);
|
|
138
|
-
background: transparent;
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
opacity: 0.55;
|
|
141
|
-
transition:
|
|
142
|
-
opacity var(--motion-hover),
|
|
143
|
-
transform var(--motion-press),
|
|
144
|
-
background var(--motion-hover);
|
|
145
|
-
}
|
|
146
|
-
.thumbnails button:hover,
|
|
147
|
-
.thumbnails button[aria-current="true"] {
|
|
148
|
-
opacity: 1;
|
|
149
|
-
}
|
|
150
|
-
.thumbnailIndicator {
|
|
151
|
-
position: absolute;
|
|
152
|
-
left: 0;
|
|
153
|
-
top: 0;
|
|
154
|
-
pointer-events: none;
|
|
155
|
-
border: 1px solid var(--fg);
|
|
156
|
-
border-radius: var(--radius);
|
|
157
|
-
transition:
|
|
158
|
-
transform var(--motion-segment) var(--ease),
|
|
159
|
-
width var(--motion-segment) var(--ease);
|
|
160
|
-
}
|
|
161
|
-
.thumbnails button:focus-visible {
|
|
162
|
-
outline: none;
|
|
163
|
-
box-shadow:
|
|
164
|
-
0 0 0 2px #111,
|
|
165
|
-
0 0 0 3px var(--fg);
|
|
166
|
-
}
|
|
167
|
-
.thumbnails button:focus:not(:focus-visible) {
|
|
168
|
-
outline: none;
|
|
169
|
-
}
|
|
170
|
-
.thumbnails button:active {
|
|
171
|
-
transform: scale(0.96);
|
|
172
|
-
}
|
|
173
|
-
.thumbnails img {
|
|
174
|
-
width: 100%;
|
|
175
|
-
height: 100%;
|
|
176
|
-
object-fit: cover;
|
|
177
|
-
border-radius: calc(var(--radius) - 3px);
|
|
178
|
-
display: block;
|
|
179
|
-
}
|
|
180
|
-
.srOnly {
|
|
181
|
-
position: absolute;
|
|
182
|
-
width: 1px;
|
|
183
|
-
height: 1px;
|
|
184
|
-
padding: 0;
|
|
185
|
-
margin: -1px;
|
|
186
|
-
overflow: hidden;
|
|
187
|
-
clip-path: inset(50%);
|
|
188
|
-
white-space: nowrap;
|
|
189
|
-
}
|
|
190
|
-
@media (min-width: 800px) {
|
|
191
|
-
.stage {
|
|
192
|
-
margin-inline: 48px;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
@media (prefers-reduced-motion: reduce) {
|
|
196
|
-
.thumbnails button {
|
|
197
|
-
transition: none;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.actions button,
|
|
202
|
-
.canvas > button {
|
|
203
|
-
width: 40px;
|
|
204
|
-
height: 40px;
|
|
205
|
-
}
|
|
206
|
-
@media (pointer: coarse) {
|
|
207
|
-
.actions button,
|
|
208
|
-
.canvas > button {
|
|
209
|
-
width: 44px;
|
|
210
|
-
height: 44px;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
.outgoing {
|
|
215
|
-
position: absolute;
|
|
216
|
-
inset: 0;
|
|
217
|
-
margin: auto;
|
|
218
|
-
pointer-events: none;
|
|
219
|
-
}
|
|
220
|
-
@media (prefers-reduced-motion: reduce) {
|
|
221
|
-
.thumbnailIndicator {
|
|
222
|
-
transition: none;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
1
|
+
.lightbox {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset: 0;
|
|
4
|
+
width: 100vw;
|
|
5
|
+
height: 100dvh;
|
|
6
|
+
max-width: none;
|
|
7
|
+
max-height: none;
|
|
8
|
+
margin: 0;
|
|
9
|
+
border: 0;
|
|
10
|
+
padding: max(12px, env(safe-area-inset-top))
|
|
11
|
+
max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom))
|
|
12
|
+
max(16px, env(safe-area-inset-left));
|
|
13
|
+
/* Image viewing is an opaque dark surface in every document color mode. */
|
|
14
|
+
color-scheme: dark;
|
|
15
|
+
--surface: #1d1d1d;
|
|
16
|
+
--fg: #f5f5f5;
|
|
17
|
+
--accent: var(--fg);
|
|
18
|
+
--accent-ink: var(--fg);
|
|
19
|
+
--soft: #262626;
|
|
20
|
+
--muted: #b5b5b5;
|
|
21
|
+
--hover: #ffffff18;
|
|
22
|
+
--line: #ffffff24;
|
|
23
|
+
background: #111;
|
|
24
|
+
color: var(--fg);
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.lightbox[open] {
|
|
28
|
+
display: grid;
|
|
29
|
+
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
|
30
|
+
gap: 12px;
|
|
31
|
+
}
|
|
32
|
+
.lightbox::backdrop {
|
|
33
|
+
background: transparent;
|
|
34
|
+
}
|
|
35
|
+
.header {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
min-height: 40px;
|
|
40
|
+
}
|
|
41
|
+
.counter {
|
|
42
|
+
color: var(--muted);
|
|
43
|
+
font-size: 13px;
|
|
44
|
+
font-variant-numeric: tabular-nums;
|
|
45
|
+
padding-inline: 8px;
|
|
46
|
+
}
|
|
47
|
+
.actions {
|
|
48
|
+
display: flex;
|
|
49
|
+
gap: 4px;
|
|
50
|
+
align-items: center;
|
|
51
|
+
}
|
|
52
|
+
.canvas {
|
|
53
|
+
position: relative;
|
|
54
|
+
min-height: 0;
|
|
55
|
+
display: flex;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
align-items: stretch;
|
|
58
|
+
}
|
|
59
|
+
.stage {
|
|
60
|
+
flex: 1;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
min-height: 0;
|
|
63
|
+
position: relative;
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
justify-content: center;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
touch-action: none;
|
|
69
|
+
user-select: none;
|
|
70
|
+
}
|
|
71
|
+
.stage[data-zoomed] {
|
|
72
|
+
cursor: grab;
|
|
73
|
+
}
|
|
74
|
+
.stage[data-zoomed]:active {
|
|
75
|
+
cursor: grabbing;
|
|
76
|
+
}
|
|
77
|
+
.image {
|
|
78
|
+
display: block;
|
|
79
|
+
width: auto;
|
|
80
|
+
height: auto;
|
|
81
|
+
max-width: 100%;
|
|
82
|
+
max-height: 100%;
|
|
83
|
+
object-fit: contain;
|
|
84
|
+
transform-origin: center;
|
|
85
|
+
border-radius: 2px;
|
|
86
|
+
flex-shrink: 0;
|
|
87
|
+
}
|
|
88
|
+
.previous,
|
|
89
|
+
.next {
|
|
90
|
+
position: absolute;
|
|
91
|
+
top: calc(50% - 20px);
|
|
92
|
+
z-index: 1;
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
background: color-mix(in srgb, var(--surface) 90%, transparent);
|
|
95
|
+
}
|
|
96
|
+
.previous {
|
|
97
|
+
left: 0;
|
|
98
|
+
}
|
|
99
|
+
.next {
|
|
100
|
+
right: 0;
|
|
101
|
+
}
|
|
102
|
+
.feedback {
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset: 0;
|
|
105
|
+
display: flex;
|
|
106
|
+
gap: 12px;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
color: var(--muted);
|
|
110
|
+
font-size: 13px;
|
|
111
|
+
}
|
|
112
|
+
.caption {
|
|
113
|
+
justify-self: center;
|
|
114
|
+
max-width: min(760px, 90vw);
|
|
115
|
+
max-height: 15dvh;
|
|
116
|
+
overflow: auto;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
line-height: 1.6;
|
|
119
|
+
text-align: center;
|
|
120
|
+
overflow-wrap: anywhere;
|
|
121
|
+
}
|
|
122
|
+
.thumbnails {
|
|
123
|
+
position: relative;
|
|
124
|
+
display: flex;
|
|
125
|
+
gap: 8px;
|
|
126
|
+
max-width: 100%;
|
|
127
|
+
margin-inline: auto;
|
|
128
|
+
overflow-x: auto;
|
|
129
|
+
padding: 4px;
|
|
130
|
+
}
|
|
131
|
+
.thumbnails button {
|
|
132
|
+
flex: 0 0 56px;
|
|
133
|
+
width: 56px;
|
|
134
|
+
height: 44px;
|
|
135
|
+
padding: 2px;
|
|
136
|
+
border: 1px solid transparent;
|
|
137
|
+
border-radius: var(--radius);
|
|
138
|
+
background: transparent;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
opacity: 0.55;
|
|
141
|
+
transition:
|
|
142
|
+
opacity var(--motion-hover),
|
|
143
|
+
transform var(--motion-press),
|
|
144
|
+
background var(--motion-hover);
|
|
145
|
+
}
|
|
146
|
+
.thumbnails button:hover,
|
|
147
|
+
.thumbnails button[aria-current="true"] {
|
|
148
|
+
opacity: 1;
|
|
149
|
+
}
|
|
150
|
+
.thumbnailIndicator {
|
|
151
|
+
position: absolute;
|
|
152
|
+
left: 0;
|
|
153
|
+
top: 0;
|
|
154
|
+
pointer-events: none;
|
|
155
|
+
border: 1px solid var(--fg);
|
|
156
|
+
border-radius: var(--radius);
|
|
157
|
+
transition:
|
|
158
|
+
transform var(--motion-segment) var(--ease),
|
|
159
|
+
width var(--motion-segment) var(--ease);
|
|
160
|
+
}
|
|
161
|
+
.thumbnails button:focus-visible {
|
|
162
|
+
outline: none;
|
|
163
|
+
box-shadow:
|
|
164
|
+
0 0 0 2px #111,
|
|
165
|
+
0 0 0 3px var(--fg);
|
|
166
|
+
}
|
|
167
|
+
.thumbnails button:focus:not(:focus-visible) {
|
|
168
|
+
outline: none;
|
|
169
|
+
}
|
|
170
|
+
.thumbnails button:active {
|
|
171
|
+
transform: scale(0.96);
|
|
172
|
+
}
|
|
173
|
+
.thumbnails img {
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 100%;
|
|
176
|
+
object-fit: cover;
|
|
177
|
+
border-radius: calc(var(--radius) - 3px);
|
|
178
|
+
display: block;
|
|
179
|
+
}
|
|
180
|
+
.srOnly {
|
|
181
|
+
position: absolute;
|
|
182
|
+
width: 1px;
|
|
183
|
+
height: 1px;
|
|
184
|
+
padding: 0;
|
|
185
|
+
margin: -1px;
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
clip-path: inset(50%);
|
|
188
|
+
white-space: nowrap;
|
|
189
|
+
}
|
|
190
|
+
@media (min-width: 800px) {
|
|
191
|
+
.stage {
|
|
192
|
+
margin-inline: 48px;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
@media (prefers-reduced-motion: reduce) {
|
|
196
|
+
.thumbnails button {
|
|
197
|
+
transition: none;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.actions button,
|
|
202
|
+
.canvas > button {
|
|
203
|
+
width: 40px;
|
|
204
|
+
height: 40px;
|
|
205
|
+
}
|
|
206
|
+
@media (pointer: coarse) {
|
|
207
|
+
.actions button,
|
|
208
|
+
.canvas > button {
|
|
209
|
+
width: 44px;
|
|
210
|
+
height: 44px;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.outgoing {
|
|
215
|
+
position: absolute;
|
|
216
|
+
inset: 0;
|
|
217
|
+
margin: auto;
|
|
218
|
+
pointer-events: none;
|
|
219
|
+
}
|
|
220
|
+
@media (prefers-reduced-motion: reduce) {
|
|
221
|
+
.thumbnailIndicator {
|
|
222
|
+
transition: none;
|
|
223
|
+
}
|
|
224
|
+
}
|