@robert-stackflow/oneui 0.6.32 → 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 +8 -0
- package/README.md +6 -0
- package/components/Lightbox.js +413 -65
- package/components/Lightbox.module.css +224 -47
- package/components/useModalScrollLock.d.ts +1 -0
- package/components/useModalScrollLock.js +48 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
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
|
+
|
|
5
|
+
## 0.6.33
|
|
6
|
+
|
|
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.
|
|
8
|
+
|
|
1
9
|
## 0.6.32
|
|
2
10
|
|
|
3
11
|
- Give Lightbox an opaque black canvas and matching light controls in every document color mode; remove the dependency on an undefined background variable.
|
package/README.md
CHANGED
|
@@ -291,3 +291,9 @@ Menu 支持 iconOnly:`<Menu iconOnly label="更多操作" items={items} />`
|
|
|
291
291
|
`Lightbox` is a controlled image viewer: pass `open`, `items`, `index`, `onIndexChange` and `onClose`. Each item has a stable `id`, `src`, `alt` and optional `caption`, `thumbnailSrc`, `width` and `height`. The optional `sourceElement(item)` resolves the original image for Hero motion; `onLocate(item)` runs after exit and scroll unlocking. Supply `labels` for localization.
|
|
292
292
|
|
|
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
|
+
|
|
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
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useId,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
4
10
|
import { createPortal } from "react-dom";
|
|
5
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
X,
|
|
13
|
+
ChevronLeft,
|
|
14
|
+
ChevronRight,
|
|
15
|
+
ZoomIn,
|
|
16
|
+
ZoomOut,
|
|
17
|
+
LocateFixed,
|
|
18
|
+
RotateCw
|
|
19
|
+
} from "lucide-react";
|
|
6
20
|
import { IconButton } from "./IconButton.js";
|
|
7
21
|
import { Skeleton } from "./Skeleton.js";
|
|
8
22
|
import { usePortalRoot } from "./usePortalRoot.js";
|
|
9
23
|
import { useModalScrollLock } from "./useModalScrollLock.js";
|
|
10
24
|
import { useModalFocus } from "./useModalFocus.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
25
|
+
import {
|
|
26
|
+
SurfacePortalContext,
|
|
27
|
+
useSurfaceHost,
|
|
28
|
+
useSurfacePortal
|
|
29
|
+
} from "./surfacePortal.js";
|
|
30
|
+
import {
|
|
31
|
+
cancelMotion,
|
|
32
|
+
motionDuration,
|
|
33
|
+
reducedMotion,
|
|
34
|
+
surfaceMotion
|
|
35
|
+
} from "./motion.js";
|
|
13
36
|
import s from "./Lightbox.module.css";
|
|
14
37
|
const defaults = {
|
|
15
38
|
title: "Image viewer",
|
|
@@ -29,6 +52,9 @@ const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
|
29
52
|
function Lightbox(props) {
|
|
30
53
|
const portal = usePortalRoot(), owner = useSurfacePortal();
|
|
31
54
|
const { ref, host, setRef } = useSurfaceHost();
|
|
55
|
+
const outgoingRef = useRef(null), thumbnailsRef = useRef(null);
|
|
56
|
+
const [indicator, setIndicator] = useState(null);
|
|
57
|
+
const slideAnimations = useRef([]);
|
|
32
58
|
const imageRef = useRef(null), stageRef = useRef(null), closeRef = useRef(null);
|
|
33
59
|
const titleId = useId(), captionId = useId();
|
|
34
60
|
const live = useRef(props);
|
|
@@ -40,10 +66,33 @@ function Lightbox(props) {
|
|
|
40
66
|
const open = props.open && props.items.length > 0 && owner?.active !== false;
|
|
41
67
|
const opened = useRef(open);
|
|
42
68
|
opened.current = open;
|
|
69
|
+
const [present, setPresent] = useState(open);
|
|
43
70
|
const [closing, setClosing] = useState(false), [status, setStatus] = useState("loading");
|
|
44
71
|
const [zoom, setZoom] = useState(1), [pan, setPan] = useState({ x: 0, y: 0 });
|
|
72
|
+
const itemKey = item ? item.id + item.src : "";
|
|
73
|
+
const [slide, setSlide] = useState({ key: itemKey, index, current: item, direction: 0 });
|
|
74
|
+
if (slide.key !== itemKey)
|
|
75
|
+
setSlide({
|
|
76
|
+
key: itemKey,
|
|
77
|
+
index,
|
|
78
|
+
current: item,
|
|
79
|
+
previous: open && status === "loaded" && imageRef.current?.complete && imageRef.current.naturalWidth ? slide.current : void 0,
|
|
80
|
+
direction: index >= slide.index ? 1 : -1
|
|
81
|
+
});
|
|
82
|
+
const slideState = useRef(slide);
|
|
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");
|
|
45
86
|
const pointers = useRef(/* @__PURE__ */ new Map());
|
|
46
|
-
const gesture = useRef({
|
|
87
|
+
const gesture = useRef({
|
|
88
|
+
x: 0,
|
|
89
|
+
y: 0,
|
|
90
|
+
panX: 0,
|
|
91
|
+
panY: 0,
|
|
92
|
+
distance: 0,
|
|
93
|
+
scale: 1,
|
|
94
|
+
multi: false
|
|
95
|
+
});
|
|
47
96
|
const locate = useRef(null), heroPending = useRef(false), hero = useRef(null);
|
|
48
97
|
const { rememberFocus, restoreFocus } = useModalFocus(ref);
|
|
49
98
|
const t = { ...defaults, ...props.labels };
|
|
@@ -59,28 +108,130 @@ function Lightbox(props) {
|
|
|
59
108
|
return { x: clamp(x, -maxX, maxX), y: clamp(y, -maxY, maxY) };
|
|
60
109
|
};
|
|
61
110
|
const animateImage = (exit) => {
|
|
62
|
-
const img = imageRef.current
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const scale = Math.max(from.width / to.width, from.height / to.height);
|
|
68
|
-
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})`;
|
|
69
|
-
const clipPath = `inset(${Math.max(0, (to.height - from.height / scale) / 2)}px ${Math.max(0, (to.width - from.width / scale) / 2)}px)`;
|
|
111
|
+
const img = imageRef.current;
|
|
112
|
+
if (!img || !img.complete || !img.naturalWidth || reducedMotion())
|
|
113
|
+
return Promise.resolve();
|
|
114
|
+
const style = getComputedStyle(img);
|
|
115
|
+
const startTransform = style.transform || "none", startOpacity = style.opacity, startClip = style.clipPath || "inset(0px)";
|
|
70
116
|
hero.current?.cancel();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const fade = () => exit ? run([
|
|
138
|
+
{
|
|
139
|
+
opacity: startOpacity,
|
|
140
|
+
transform: startTransform,
|
|
141
|
+
clipPath: startClip
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
opacity: 0,
|
|
145
|
+
transform: `${startTransform === "none" ? "" : startTransform} scale(.985)`,
|
|
146
|
+
clipPath: startClip
|
|
147
|
+
}
|
|
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
|
+
}
|
|
76
176
|
};
|
|
177
|
+
const finishSlide = (key) => setSlide(
|
|
178
|
+
(current) => current.key === key ? { ...current, previous: void 0 } : current
|
|
179
|
+
);
|
|
77
180
|
const onLoaded = () => {
|
|
78
181
|
setStatus("loaded");
|
|
79
182
|
if (heroPending.current && opened.current) {
|
|
80
183
|
heroPending.current = false;
|
|
81
184
|
void animateImage(false);
|
|
185
|
+
finishSlide(itemKey);
|
|
186
|
+
return;
|
|
82
187
|
}
|
|
188
|
+
if (!slide.previous || !opened.current) return;
|
|
189
|
+
slideAnimations.current.forEach((animation) => animation.cancel());
|
|
190
|
+
if (reducedMotion()) {
|
|
191
|
+
finishSlide(itemKey);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const options = {
|
|
195
|
+
duration: motionDuration("--popup-enter", 180),
|
|
196
|
+
easing: "cubic-bezier(.2,.7,.2,1)"
|
|
197
|
+
};
|
|
198
|
+
const animations = [
|
|
199
|
+
imageRef.current?.animate(
|
|
200
|
+
[
|
|
201
|
+
{ opacity: 0, transform: `translateX(${slide.direction * 24}px)` },
|
|
202
|
+
{ opacity: 1, transform: "none" }
|
|
203
|
+
],
|
|
204
|
+
options
|
|
205
|
+
),
|
|
206
|
+
outgoingRef.current?.animate(
|
|
207
|
+
[
|
|
208
|
+
{ opacity: 1, transform: "none" },
|
|
209
|
+
{ opacity: 0, transform: `translateX(${-slide.direction * 24}px)` }
|
|
210
|
+
],
|
|
211
|
+
options
|
|
212
|
+
)
|
|
213
|
+
].filter((value) => !!value);
|
|
214
|
+
slideAnimations.current = animations;
|
|
215
|
+
void Promise.all(
|
|
216
|
+
animations.map((animation) => animation.finished.catch(() => {
|
|
217
|
+
}))
|
|
218
|
+
).then(() => {
|
|
219
|
+
if (slideState.current.key === itemKey) finishSlide(itemKey);
|
|
220
|
+
});
|
|
83
221
|
};
|
|
222
|
+
useLayoutEffect(() => {
|
|
223
|
+
if (!open) return;
|
|
224
|
+
const thumb = thumbnailsRef.current?.querySelector(
|
|
225
|
+
'[aria-current="true"]'
|
|
226
|
+
);
|
|
227
|
+
if (!thumb) return;
|
|
228
|
+
setIndicator({
|
|
229
|
+
x: thumb.offsetLeft,
|
|
230
|
+
y: thumb.offsetTop,
|
|
231
|
+
width: thumb.offsetWidth,
|
|
232
|
+
height: thumb.offsetHeight
|
|
233
|
+
});
|
|
234
|
+
}, [open, index, portal]);
|
|
84
235
|
useEffect(() => {
|
|
85
236
|
if (!open) return;
|
|
86
237
|
setStatus("loading");
|
|
@@ -92,8 +243,14 @@ function Lightbox(props) {
|
|
|
92
243
|
}, [open, item?.id, item?.src]);
|
|
93
244
|
useEffect(() => {
|
|
94
245
|
if (!open) return;
|
|
95
|
-
const thumb = ref.current?.querySelector(
|
|
96
|
-
|
|
246
|
+
const thumb = ref.current?.querySelector(
|
|
247
|
+
'[aria-current="true"]'
|
|
248
|
+
);
|
|
249
|
+
thumb?.scrollIntoView({
|
|
250
|
+
block: "nearest",
|
|
251
|
+
inline: "nearest",
|
|
252
|
+
behavior: reducedMotion() ? "instant" : "smooth"
|
|
253
|
+
});
|
|
97
254
|
const preload = [items[index - 1], items[index + 1]].filter(Boolean).map((entry) => {
|
|
98
255
|
const img = new Image();
|
|
99
256
|
img.src = entry.src;
|
|
@@ -115,12 +272,14 @@ function Lightbox(props) {
|
|
|
115
272
|
window.removeEventListener("resize", resize);
|
|
116
273
|
if (element) cancelMotion(element);
|
|
117
274
|
hero.current?.cancel();
|
|
275
|
+
slideAnimations.current.forEach((animation) => animation.cancel());
|
|
118
276
|
};
|
|
119
277
|
}, [portal]);
|
|
120
278
|
useLayoutEffect(() => {
|
|
121
279
|
const dialog = ref.current;
|
|
122
280
|
if (!dialog) return;
|
|
123
281
|
if (open) {
|
|
282
|
+
setPresent(true);
|
|
124
283
|
dialog.inert = false;
|
|
125
284
|
setClosing(false);
|
|
126
285
|
if (!dialog.open) {
|
|
@@ -139,44 +298,82 @@ function Lightbox(props) {
|
|
|
139
298
|
if (!dialog.open) return;
|
|
140
299
|
dialog.inert = true;
|
|
141
300
|
setClosing(true);
|
|
142
|
-
const imageExit =
|
|
143
|
-
void Promise.all([surfaceMotion(dialog, "exit", "0 0"), imageExit]).then(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
301
|
+
const imageExit = animateImage(true);
|
|
302
|
+
void Promise.all([surfaceMotion(dialog, "exit", "0 0"), imageExit]).then(
|
|
303
|
+
([done]) => {
|
|
304
|
+
if (!done || opened.current) return;
|
|
305
|
+
dialog.close();
|
|
306
|
+
setPresent(false);
|
|
307
|
+
setZoom(1);
|
|
308
|
+
setPan({ x: 0, y: 0 });
|
|
309
|
+
restoreFocus();
|
|
310
|
+
setClosing(false);
|
|
311
|
+
const target = locate.current;
|
|
312
|
+
locate.current = null;
|
|
313
|
+
if (target)
|
|
314
|
+
requestAnimationFrame(() => live.current.onLocate?.(target));
|
|
315
|
+
}
|
|
316
|
+
);
|
|
152
317
|
}, [open, portal, rememberFocus, restoreFocus]);
|
|
153
318
|
if (!portal || !item) return null;
|
|
154
319
|
const toggleZoom = () => {
|
|
155
320
|
const img = imageRef.current;
|
|
156
|
-
setZoom(
|
|
321
|
+
setZoom(
|
|
322
|
+
zoom === 1 ? clamp(
|
|
323
|
+
img ? img.naturalWidth / Math.max(1, img.offsetWidth) : 2,
|
|
324
|
+
1.5,
|
|
325
|
+
8
|
|
326
|
+
) : 1
|
|
327
|
+
);
|
|
157
328
|
setPan({ x: 0, y: 0 });
|
|
158
329
|
};
|
|
159
330
|
const pointerDown = (event) => {
|
|
160
331
|
if (event.button !== 0 || status !== "loaded") return;
|
|
161
332
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
162
|
-
pointers.current.set(event.pointerId, {
|
|
333
|
+
pointers.current.set(event.pointerId, {
|
|
334
|
+
x: event.clientX,
|
|
335
|
+
y: event.clientY
|
|
336
|
+
});
|
|
163
337
|
const points = [...pointers.current.values()];
|
|
164
|
-
gesture.current = {
|
|
338
|
+
gesture.current = {
|
|
339
|
+
x: event.clientX,
|
|
340
|
+
y: event.clientY,
|
|
341
|
+
panX: pan.x,
|
|
342
|
+
panY: pan.y,
|
|
343
|
+
scale: zoom,
|
|
344
|
+
distance: points.length === 2 ? Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y) : 0,
|
|
345
|
+
multi: points.length > 1
|
|
346
|
+
};
|
|
165
347
|
};
|
|
166
348
|
const pointerMove = (event) => {
|
|
167
349
|
if (!pointers.current.has(event.pointerId)) return;
|
|
168
|
-
pointers.current.set(event.pointerId, {
|
|
350
|
+
pointers.current.set(event.pointerId, {
|
|
351
|
+
x: event.clientX,
|
|
352
|
+
y: event.clientY
|
|
353
|
+
});
|
|
169
354
|
const points = [...pointers.current.values()], start = gesture.current;
|
|
170
355
|
if (points.length === 2 && start.distance) {
|
|
171
|
-
const scale = clamp(
|
|
356
|
+
const scale = clamp(
|
|
357
|
+
start.scale * Math.hypot(points[0].x - points[1].x, points[0].y - points[1].y) / start.distance,
|
|
358
|
+
1,
|
|
359
|
+
8
|
|
360
|
+
);
|
|
172
361
|
setZoom(scale);
|
|
173
362
|
setPan(bounds(pan.x, pan.y, scale));
|
|
174
|
-
} else if (zoom > 1 && !start.multi)
|
|
363
|
+
} else if (zoom > 1 && !start.multi)
|
|
364
|
+
setPan(
|
|
365
|
+
bounds(
|
|
366
|
+
start.panX + event.clientX - start.x,
|
|
367
|
+
start.panY + event.clientY - start.y,
|
|
368
|
+
zoom
|
|
369
|
+
)
|
|
370
|
+
);
|
|
175
371
|
};
|
|
176
372
|
const pointerEnd = (event) => {
|
|
177
373
|
const start = gesture.current, dx = event.clientX - start.x, dy = event.clientY - start.y;
|
|
178
374
|
pointers.current.delete(event.pointerId);
|
|
179
|
-
if (event.type !== "pointercancel" && !start.multi && zoom === 1 && Math.abs(dx) > 64 && Math.abs(dx) > Math.abs(dy) * 1.2)
|
|
375
|
+
if (event.type !== "pointercancel" && !start.multi && zoom === 1 && Math.abs(dx) > 64 && Math.abs(dx) > Math.abs(dy) * 1.2)
|
|
376
|
+
move(index + (dx < 0 ? 1 : -1));
|
|
180
377
|
};
|
|
181
378
|
return createPortal(
|
|
182
379
|
/* @__PURE__ */ jsx(SurfacePortalContext, { value: { host, active: open }, children: /* @__PURE__ */ jsxs(
|
|
@@ -187,6 +384,29 @@ function Lightbox(props) {
|
|
|
187
384
|
"aria-labelledby": titleId,
|
|
188
385
|
"aria-describedby": item.caption ? captionId : void 0,
|
|
189
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
|
+
},
|
|
190
410
|
onCancel: (event) => {
|
|
191
411
|
event.preventDefault();
|
|
192
412
|
props.onClose();
|
|
@@ -199,45 +419,173 @@ function Lightbox(props) {
|
|
|
199
419
|
},
|
|
200
420
|
children: [
|
|
201
421
|
/* @__PURE__ */ jsx("h2", { id: titleId, className: s.srOnly, children: t.title }),
|
|
202
|
-
/* @__PURE__ */ jsxs("header", { className: s.header, children: [
|
|
422
|
+
/* @__PURE__ */ jsxs("header", { className: s.header, "data-lightbox-blank": "", children: [
|
|
203
423
|
/* @__PURE__ */ jsxs("span", { className: s.counter, role: "status", "aria-live": "polite", children: [
|
|
204
424
|
index + 1,
|
|
205
425
|
" / ",
|
|
206
426
|
items.length
|
|
207
427
|
] }),
|
|
208
428
|
/* @__PURE__ */ jsxs("div", { className: s.actions, children: [
|
|
209
|
-
/* @__PURE__ */ jsx(
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
429
|
+
/* @__PURE__ */ jsx(
|
|
430
|
+
IconButton,
|
|
431
|
+
{
|
|
432
|
+
label: zoom > 1 ? t.zoomOut : t.zoomIn,
|
|
433
|
+
disabled: status !== "loaded",
|
|
434
|
+
onClick: toggleZoom,
|
|
435
|
+
children: zoom > 1 ? /* @__PURE__ */ jsx(ZoomOut, { size: 19 }) : /* @__PURE__ */ jsx(ZoomIn, { size: 19 })
|
|
436
|
+
}
|
|
437
|
+
),
|
|
438
|
+
props.onLocate && /* @__PURE__ */ jsx(
|
|
439
|
+
IconButton,
|
|
440
|
+
{
|
|
441
|
+
label: t.locate,
|
|
442
|
+
onClick: () => {
|
|
443
|
+
locate.current = item;
|
|
444
|
+
props.onClose();
|
|
445
|
+
},
|
|
446
|
+
children: /* @__PURE__ */ jsx(LocateFixed, { size: 19 })
|
|
447
|
+
}
|
|
448
|
+
),
|
|
214
449
|
/* @__PURE__ */ jsx(IconButton, { ref: closeRef, label: t.close, onClick: props.onClose, children: /* @__PURE__ */ jsx(X, { size: 20 }) })
|
|
215
450
|
] })
|
|
216
451
|
] }),
|
|
217
|
-
/* @__PURE__ */ jsxs("div", { className: s.canvas, children: [
|
|
218
|
-
items.length > 1 && /* @__PURE__ */ jsx(
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
452
|
+
/* @__PURE__ */ jsxs("div", { className: s.canvas, "data-lightbox-blank": "", children: [
|
|
453
|
+
items.length > 1 && /* @__PURE__ */ jsx(
|
|
454
|
+
IconButton,
|
|
455
|
+
{
|
|
456
|
+
className: s.previous,
|
|
457
|
+
label: t.previous,
|
|
458
|
+
disabled: index === 0,
|
|
459
|
+
onClick: () => move(index - 1),
|
|
460
|
+
children: /* @__PURE__ */ jsx(ChevronLeft, { size: 24 })
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
/* @__PURE__ */ jsxs(
|
|
464
|
+
"div",
|
|
465
|
+
{
|
|
466
|
+
ref: stageRef,
|
|
467
|
+
className: s.stage,
|
|
468
|
+
"data-zoomed": zoom > 1 || void 0,
|
|
469
|
+
onPointerDown: pointerDown,
|
|
470
|
+
onPointerMove: pointerMove,
|
|
471
|
+
onPointerUp: pointerEnd,
|
|
472
|
+
onPointerCancel: pointerEnd,
|
|
473
|
+
onDoubleClick: toggleZoom,
|
|
474
|
+
children: [
|
|
475
|
+
[...slide.previous ? [slide.previous] : [], item].map(
|
|
476
|
+
(entry, i, frames) => {
|
|
477
|
+
const current = i === frames.length - 1;
|
|
478
|
+
return /* @__PURE__ */ jsx(
|
|
479
|
+
"img",
|
|
480
|
+
{
|
|
481
|
+
ref: current ? imageRef : outgoingRef,
|
|
482
|
+
src: open || present ? entry.src : void 0,
|
|
483
|
+
alt: current ? entry.alt : "",
|
|
484
|
+
"aria-hidden": !current || void 0,
|
|
485
|
+
width: entry.width,
|
|
486
|
+
height: entry.height,
|
|
487
|
+
draggable: false,
|
|
488
|
+
onLoad: current ? onLoaded : void 0,
|
|
489
|
+
onError: current ? () => {
|
|
490
|
+
setStatus("error");
|
|
491
|
+
finishSlide(itemKey);
|
|
492
|
+
} : void 0,
|
|
493
|
+
className: `${s.image} ${!current ? s.outgoing : ""}`,
|
|
494
|
+
"data-image-phase": current ? "current" : "outgoing",
|
|
495
|
+
style: {
|
|
496
|
+
opacity: current ? status === "loaded" ? 1 : 0 : 1,
|
|
497
|
+
transform: current ? `translate(${pan.x}px, ${pan.y}px) scale(${zoom})` : "none"
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
entry.id + entry.src
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
status === "loading" && /* @__PURE__ */ jsx("div", { className: s.feedback, role: "status", "aria-label": t.loading, children: /* @__PURE__ */ jsx(
|
|
505
|
+
Skeleton,
|
|
506
|
+
{
|
|
507
|
+
width: "min(55vw, 560px)",
|
|
508
|
+
height: "min(45vh, 360px)",
|
|
509
|
+
rounded: true
|
|
510
|
+
}
|
|
511
|
+
) }),
|
|
512
|
+
status === "error" && /* @__PURE__ */ jsxs("div", { className: s.feedback, role: "status", children: [
|
|
513
|
+
/* @__PURE__ */ jsx("span", { children: t.error }),
|
|
514
|
+
/* @__PURE__ */ jsx(
|
|
515
|
+
IconButton,
|
|
516
|
+
{
|
|
517
|
+
label: t.retry,
|
|
518
|
+
onClick: () => {
|
|
519
|
+
closeRef.current?.focus({ preventScroll: true });
|
|
520
|
+
setStatus("loading");
|
|
521
|
+
const img = imageRef.current;
|
|
522
|
+
if (img) {
|
|
523
|
+
img.removeAttribute("src");
|
|
524
|
+
queueMicrotask(() => {
|
|
525
|
+
if (img.isConnected) img.src = item.src;
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
children: /* @__PURE__ */ jsx(RotateCw, { size: 18 })
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] })
|
|
533
|
+
]
|
|
534
|
+
}
|
|
535
|
+
),
|
|
536
|
+
items.length > 1 && /* @__PURE__ */ jsx(
|
|
537
|
+
IconButton,
|
|
538
|
+
{
|
|
539
|
+
className: s.next,
|
|
540
|
+
label: t.next,
|
|
541
|
+
disabled: index === items.length - 1,
|
|
542
|
+
onClick: () => move(index + 1),
|
|
543
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { size: 24 })
|
|
544
|
+
}
|
|
545
|
+
)
|
|
238
546
|
] }),
|
|
239
547
|
item.caption && /* @__PURE__ */ jsx("div", { id: captionId, className: s.caption, children: item.caption }),
|
|
240
|
-
items.length > 1 && /* @__PURE__ */
|
|
548
|
+
items.length > 1 && /* @__PURE__ */ jsxs(
|
|
549
|
+
"nav",
|
|
550
|
+
{
|
|
551
|
+
ref: thumbnailsRef,
|
|
552
|
+
className: s.thumbnails,
|
|
553
|
+
"aria-label": t.thumbnails,
|
|
554
|
+
children: [
|
|
555
|
+
indicator && /* @__PURE__ */ jsx(
|
|
556
|
+
"span",
|
|
557
|
+
{
|
|
558
|
+
"aria-hidden": "true",
|
|
559
|
+
className: s.thumbnailIndicator,
|
|
560
|
+
style: {
|
|
561
|
+
width: indicator.width,
|
|
562
|
+
height: indicator.height,
|
|
563
|
+
transform: `translate(${indicator.x}px, ${indicator.y}px)`
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
),
|
|
567
|
+
items.map((entry, i) => /* @__PURE__ */ jsx(
|
|
568
|
+
"button",
|
|
569
|
+
{
|
|
570
|
+
type: "button",
|
|
571
|
+
"aria-label": `${t.image} ${i + 1}`,
|
|
572
|
+
"aria-current": i === index ? "true" : void 0,
|
|
573
|
+
onClick: () => move(i),
|
|
574
|
+
children: /* @__PURE__ */ jsx(
|
|
575
|
+
"img",
|
|
576
|
+
{
|
|
577
|
+
src: open || present ? entry.thumbnailSrc || entry.src : void 0,
|
|
578
|
+
alt: "",
|
|
579
|
+
loading: "lazy",
|
|
580
|
+
draggable: false
|
|
581
|
+
}
|
|
582
|
+
)
|
|
583
|
+
},
|
|
584
|
+
entry.id
|
|
585
|
+
))
|
|
586
|
+
]
|
|
587
|
+
}
|
|
588
|
+
)
|
|
241
589
|
]
|
|
242
590
|
}
|
|
243
591
|
) }),
|
|
@@ -1,47 +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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
--
|
|
16
|
-
--
|
|
17
|
-
--
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
+
}
|
|
@@ -1,16 +1,58 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
3
3
|
let locks = 0;
|
|
4
|
-
let previous
|
|
4
|
+
let previous;
|
|
5
5
|
function useModalScrollLock(active) {
|
|
6
|
-
|
|
6
|
+
useLayoutEffect(() => {
|
|
7
7
|
if (!active) return;
|
|
8
|
+
const root = document.documentElement, body = document.body;
|
|
8
9
|
if (locks++ === 0) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const gap = root.clientWidth > 0 ? Math.max(0, innerWidth - root.clientWidth) : 0;
|
|
11
|
+
const stable = (getComputedStyle(root).scrollbarGutter || "").includes("stable");
|
|
12
|
+
const changedGutter = gap > 0 && !stable && typeof CSS !== "undefined" && typeof CSS.supports === "function" && CSS.supports("scrollbar-gutter", "stable");
|
|
13
|
+
const changedPadding = gap > 0 && !stable && !changedGutter;
|
|
14
|
+
previous = {
|
|
15
|
+
overflow: body.style.getPropertyValue("overflow"),
|
|
16
|
+
overflowPriority: body.style.getPropertyPriority("overflow"),
|
|
17
|
+
gutter: root.style.getPropertyValue("scrollbar-gutter"),
|
|
18
|
+
gutterPriority: root.style.getPropertyPriority("scrollbar-gutter"),
|
|
19
|
+
padding: body.style.getPropertyValue("padding-inline-end"),
|
|
20
|
+
paddingPriority: body.style.getPropertyPriority("padding-inline-end"),
|
|
21
|
+
changedGutter,
|
|
22
|
+
changedPadding
|
|
23
|
+
};
|
|
24
|
+
if (changedGutter) root.style.setProperty("scrollbar-gutter", "stable");
|
|
25
|
+
if (changedPadding)
|
|
26
|
+
body.style.setProperty(
|
|
27
|
+
"padding-inline-end",
|
|
28
|
+
`${(parseFloat(getComputedStyle(body).paddingInlineEnd) || 0) + gap}px`
|
|
29
|
+
);
|
|
30
|
+
body.style.setProperty("overflow", "hidden");
|
|
11
31
|
}
|
|
12
32
|
return () => {
|
|
13
|
-
if (--locks
|
|
33
|
+
if (--locks !== 0 || !previous) return;
|
|
34
|
+
const restore = (style, name, value, priority) => value ? style.setProperty(name, value, priority) : style.removeProperty(name);
|
|
35
|
+
restore(
|
|
36
|
+
body.style,
|
|
37
|
+
"overflow",
|
|
38
|
+
previous.overflow,
|
|
39
|
+
previous.overflowPriority
|
|
40
|
+
);
|
|
41
|
+
if (previous.changedGutter)
|
|
42
|
+
restore(
|
|
43
|
+
root.style,
|
|
44
|
+
"scrollbar-gutter",
|
|
45
|
+
previous.gutter,
|
|
46
|
+
previous.gutterPriority
|
|
47
|
+
);
|
|
48
|
+
if (previous.changedPadding)
|
|
49
|
+
restore(
|
|
50
|
+
body.style,
|
|
51
|
+
"padding-inline-end",
|
|
52
|
+
previous.padding,
|
|
53
|
+
previous.paddingPriority
|
|
54
|
+
);
|
|
55
|
+
previous = void 0;
|
|
14
56
|
};
|
|
15
57
|
}, [active]);
|
|
16
58
|
}
|