@robert-stackflow/oneui 0.6.33 → 0.6.35
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 +8 -0
- package/components/IconButton.d.ts +4 -2
- package/components/IconButton.js +15 -10
- package/components/IconButton.module.css +21 -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,11 @@
|
|
|
1
|
+
## 0.6.35
|
|
2
|
+
|
|
3
|
+
- Add an optional `IconButton text` slot for unified icon/text or count actions, sharing one hover, focus, pressed and click region without application styling. Preserve icon-only and disclosure variants.
|
|
4
|
+
|
|
5
|
+
## 0.6.34
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
1
9
|
## 0.6.33
|
|
2
10
|
|
|
3
11
|
- 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
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
|
|
4
4
|
|
|
5
|
+
## 图文操作按钮(0.6.35)
|
|
6
|
+
|
|
7
|
+
`<IconButton label="点赞 12" text={12}><Heart /></IconButton>` 将图标和文字/数字放在同一个按钮内,共享 hover、键盘焦点、按下与选中区域。`text="回复"` / `text="分享"` 使用相同布局;数字 0 也会显示。不要在按钮外再放计数文字。`label` 是完整可访问名称及提示,`text` 是可见内容;省略 `text` 时保留原图标按钮行为。loading 时文字保留,图标替换为 Spinner。
|
|
8
|
+
|
|
5
9
|
## 密码输入(0.6.29)
|
|
6
10
|
|
|
7
11
|
`PasswordField` 统一提供显示/隐藏密码操作,在 Edge 中隐藏重复的原生显示按钮。应用无需为该输入框覆盖浏览器伪元素样式。
|
|
@@ -293,3 +297,7 @@ Menu 支持 iconOnly:`<Menu iconOnly label="更多操作" items={items} />`
|
|
|
293
297
|
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
298
|
|
|
295
299
|
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.
|
|
300
|
+
|
|
301
|
+
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.
|
|
302
|
+
|
|
303
|
+
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.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ComponentPropsWithRef } from "react";
|
|
2
|
-
export declare function IconButton({ label, loading, children, variant, size, disclosure, ...props }: ComponentPropsWithRef<"button"> & {
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
export declare function IconButton({ label, loading, children, text, variant, size, disclosure, ...props }: ComponentPropsWithRef<"button"> & {
|
|
3
3
|
label: string;
|
|
4
4
|
loading?: boolean;
|
|
5
|
+
/** Visible text or count inside the same hover, focus and click target as the icon. */
|
|
6
|
+
text?: ReactNode;
|
|
5
7
|
variant?: "primary" | "secondary" | "ghost" | "danger";
|
|
6
8
|
size?: "small" | "normal";
|
|
7
9
|
/** Add a spaced disclosure chevron, driven by aria-expanded. */
|
package/components/IconButton.js
CHANGED
|
@@ -8,12 +8,13 @@ function IconButton({
|
|
|
8
8
|
label,
|
|
9
9
|
loading,
|
|
10
10
|
children,
|
|
11
|
+
text,
|
|
11
12
|
variant = "ghost",
|
|
12
13
|
size = "normal",
|
|
13
14
|
disclosure = false,
|
|
14
15
|
...props
|
|
15
16
|
}) {
|
|
16
|
-
return /* @__PURE__ */ jsx(Tooltip, { content: label, children: /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(Tooltip, { content: label, children: /* @__PURE__ */ jsxs(
|
|
17
18
|
"button",
|
|
18
19
|
{
|
|
19
20
|
type: "button",
|
|
@@ -23,17 +24,21 @@ function IconButton({
|
|
|
23
24
|
"data-variant": variant,
|
|
24
25
|
"data-size": size,
|
|
25
26
|
"data-disclosure": disclosure || void 0,
|
|
27
|
+
"data-has-text": text !== void 0 && text !== null || void 0,
|
|
26
28
|
disabled: props.disabled || loading,
|
|
27
29
|
className: `${s.iconButton} ${props.className || ""}`,
|
|
28
|
-
children:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs("span", { className: s.icon, children: [
|
|
32
|
+
loading ? /* @__PURE__ */ jsx(Spinner, { decorative: true }) : children,
|
|
33
|
+
disclosure && /* @__PURE__ */ jsx(
|
|
34
|
+
DisclosureChevron,
|
|
35
|
+
{
|
|
36
|
+
expanded: props["aria-expanded"] === true || props["aria-expanded"] === "true"
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
] }),
|
|
40
|
+
text !== void 0 && text !== null && /* @__PURE__ */ jsx("span", { className: s.text, children: text })
|
|
41
|
+
]
|
|
37
42
|
}
|
|
38
43
|
) });
|
|
39
44
|
}
|
|
@@ -25,6 +25,27 @@
|
|
|
25
25
|
height: 30px;
|
|
26
26
|
min-width: 30px;
|
|
27
27
|
}
|
|
28
|
+
.iconButton[data-has-text] {
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: auto;
|
|
33
|
+
gap: 6px;
|
|
34
|
+
padding-inline: 9px;
|
|
35
|
+
font-size: 13px;
|
|
36
|
+
line-height: 1.4;
|
|
37
|
+
}
|
|
38
|
+
.iconButton[data-has-text] .icon {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
flex-shrink: 0;
|
|
43
|
+
gap: 3px;
|
|
44
|
+
}
|
|
45
|
+
.text {
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
font-variant-numeric: tabular-nums;
|
|
48
|
+
}
|
|
28
49
|
.iconButton[data-variant="primary"] {
|
|
29
50
|
background: var(--accent-fill, var(--accent));
|
|
30
51
|
color: var(--on-accent-fill, var(--on-accent));
|
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
|
+
}
|