@k2b/ui 0.55.0 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/actions/Toolbar.js +16 -7
- package/dist/browser/actions/Toolbar.js.map +1 -1
- package/dist/browser/chat/ChatComposer.js +28 -27
- package/dist/browser/chat/ChatComposer.js.map +1 -1
- package/dist/browser/content/Lightbox.js +917 -283
- package/dist/browser/content/Lightbox.js.map +1 -1
- package/dist/browser/content/PdfPages.js +8 -3
- package/dist/browser/content/PdfPages.js.map +1 -1
- package/dist/browser/content/PdfThumbnails.js +271 -0
- package/dist/browser/content/PdfThumbnails.js.map +1 -0
- package/dist/browser/content/PdfViewer.js +11 -3
- package/dist/browser/content/PdfViewer.js.map +1 -1
- package/dist/browser/content/Timeline.js +116 -117
- package/dist/browser/content/Timeline.js.map +1 -1
- package/dist/browser/content/code-highlight.js +24 -11
- package/dist/browser/content/code-highlight.js.map +1 -1
- package/dist/browser/content/index.js +5 -1
- package/dist/browser/content/index.js.map +1 -1
- package/dist/browser/content/lightbox-messages.js +64 -18
- package/dist/browser/content/lightbox-messages.js.map +1 -1
- package/dist/browser/content/lightbox-renderers.js +6 -0
- package/dist/browser/content/lightbox-renderers.js.map +1 -0
- package/dist/browser/content/map-view-worker.js +3 -3
- package/dist/browser/content/pdf-messages.js +16 -2
- package/dist/browser/content/pdf-messages.js.map +1 -1
- package/dist/browser/content/pdf-viewer-engine.js +15 -15
- package/dist/browser/content/pdf-viewer-worker.js +4 -5
- package/dist/browser/feedback/prompt-confirm.js +2 -0
- package/dist/browser/feedback/prompt-confirm.js.map +1 -1
- package/dist/browser/internal/truncated-title.js +9 -0
- package/dist/browser/internal/truncated-title.js.map +1 -0
- package/dist/browser/layout/DetailPanel.js +3 -5
- package/dist/browser/layout/DetailPanel.js.map +1 -1
- package/dist/browser/layout/PanelDialog.js +3 -1
- package/dist/browser/layout/PanelDialog.js.map +1 -1
- package/dist/ssr/actions/CommandMenu.js +2 -2
- package/dist/ssr/actions/CommandMenu.js.map +1 -1
- package/dist/ssr/actions/Toolbar.js +16 -7
- package/dist/ssr/actions/Toolbar.js.map +1 -1
- package/dist/ssr/chat/ChatComposer.js +31 -30
- package/dist/ssr/chat/ChatComposer.js.map +1 -1
- package/dist/ssr/content/Lightbox.js +659 -150
- package/dist/ssr/content/Lightbox.js.map +1 -1
- package/dist/ssr/content/PdfPages.js +8 -3
- package/dist/ssr/content/PdfPages.js.map +1 -1
- package/dist/ssr/content/PdfThumbnails.js +189 -0
- package/dist/ssr/content/PdfThumbnails.js.map +1 -0
- package/dist/ssr/content/PdfViewer.js +11 -3
- package/dist/ssr/content/PdfViewer.js.map +1 -1
- package/dist/ssr/content/Timeline.js +2 -5
- package/dist/ssr/content/Timeline.js.map +1 -1
- package/dist/ssr/content/code-highlight.js +24 -11
- package/dist/ssr/content/code-highlight.js.map +1 -1
- package/dist/ssr/content/index.js +5 -1
- package/dist/ssr/content/index.js.map +1 -1
- package/dist/ssr/content/lightbox-messages.js +64 -18
- package/dist/ssr/content/lightbox-messages.js.map +1 -1
- package/dist/ssr/content/lightbox-renderers.js +6 -0
- package/dist/ssr/content/lightbox-renderers.js.map +1 -0
- package/dist/ssr/content/pdf-messages.js +16 -2
- package/dist/ssr/content/pdf-messages.js.map +1 -1
- package/dist/ssr/feedback/prompt-confirm.js +1 -0
- package/dist/ssr/feedback/prompt-confirm.js.map +1 -1
- package/dist/ssr/inputs/ChoiceInputs.js +2 -2
- package/dist/ssr/inputs/ChoiceInputs.js.map +1 -1
- package/dist/ssr/inputs/SignatureInput.js +2 -2
- package/dist/ssr/inputs/SignatureInput.js.map +1 -1
- package/dist/ssr/inputs/markdown/SlashCommands.js +2 -2
- package/dist/ssr/inputs/markdown/SlashCommands.js.map +1 -1
- package/dist/ssr/internal/truncated-title.js +9 -0
- package/dist/ssr/internal/truncated-title.js.map +1 -0
- package/dist/ssr/layout/DetailPanel.js +1 -4
- package/dist/ssr/layout/DetailPanel.js.map +1 -1
- package/dist/ssr/layout/PanelDialog.js +1 -0
- package/dist/ssr/layout/PanelDialog.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/actions/Toolbar.d.ts +6 -0
- package/dist/types/chat/ChatComposer.d.ts +1 -0
- package/dist/types/content/Lightbox.d.ts +54 -14
- package/dist/types/content/PdfPages.d.ts +7 -1
- package/dist/types/content/PdfThumbnails.d.ts +26 -0
- package/dist/types/content/PdfViewer.d.ts +12 -3
- package/dist/types/content/index.d.ts +4 -2
- package/dist/types/content/lightbox-messages.d.ts +31 -8
- package/dist/types/content/lightbox-renderers.d.ts +3 -0
- package/dist/types/content/pdf-messages.d.ts +7 -0
- package/dist/types/internal/truncated-title.d.ts +7 -0
- package/package.json +20 -20
|
@@ -1,373 +1,1007 @@
|
|
|
1
1
|
import { template as _$template } from "solid-js/web";
|
|
2
2
|
import { delegateEvents as _$delegateEvents } from "solid-js/web";
|
|
3
3
|
import { className as _$className } from "solid-js/web";
|
|
4
|
-
import {
|
|
4
|
+
import { style as _$style } from "solid-js/web";
|
|
5
|
+
import { memo as _$memo } from "solid-js/web";
|
|
6
|
+
import { addEventListener as _$addEventListener } from "solid-js/web";
|
|
7
|
+
import { getNextMarker as _$getNextMarker } from "solid-js/web";
|
|
8
|
+
import { setStyleProperty as _$setStyleProperty } from "solid-js/web";
|
|
5
9
|
import { setAttribute as _$setAttribute } from "solid-js/web";
|
|
6
10
|
import { effect as _$effect } from "solid-js/web";
|
|
7
|
-
import { memo as _$memo } from "solid-js/web";
|
|
8
|
-
import { createComponent as _$createComponent } from "solid-js/web";
|
|
9
11
|
import { getNextElement as _$getNextElement } from "solid-js/web";
|
|
10
|
-
import {
|
|
12
|
+
import { runHydrationEvents as _$runHydrationEvents } from "solid-js/web";
|
|
11
13
|
import { insert as _$insert } from "solid-js/web";
|
|
14
|
+
import { createComponent as _$createComponent } from "solid-js/web";
|
|
12
15
|
import { use as _$use } from "solid-js/web";
|
|
13
|
-
var _tmpl$ = /*#__PURE__*/_$template(`<
|
|
14
|
-
_tmpl$2 = /*#__PURE__*/_$template(`<
|
|
15
|
-
_tmpl$3 = /*#__PURE__*/_$template(`<
|
|
16
|
-
_tmpl$4 = /*#__PURE__*/_$template(`<
|
|
17
|
-
_tmpl$5 = /*#__PURE__*/_$template(`<
|
|
18
|
-
_tmpl$6 = /*#__PURE__*/_$template(`<div class="k2b-
|
|
19
|
-
_tmpl$7 = /*#__PURE__*/_$template(`<
|
|
20
|
-
_tmpl$8 = /*#__PURE__*/_$template(`<
|
|
21
|
-
_tmpl$9 = /*#__PURE__*/_$template(`<
|
|
22
|
-
_tmpl$0 = /*#__PURE__*/_$template(`<
|
|
23
|
-
|
|
16
|
+
var _tmpl$ = /*#__PURE__*/_$template(`<button type=button class="k2b-lightbox__edge k2b-overlay-surface"data-direction=previous><i class="ti ti-chevron-left"aria-hidden=true>`),
|
|
17
|
+
_tmpl$2 = /*#__PURE__*/_$template(`<button type=button class="k2b-lightbox__edge k2b-overlay-surface"data-direction=next><i class="ti ti-chevron-right"aria-hidden=true>`),
|
|
18
|
+
_tmpl$3 = /*#__PURE__*/_$template(`<span>`),
|
|
19
|
+
_tmpl$4 = /*#__PURE__*/_$template(`<i class="ti ti-x"aria-hidden=true>`),
|
|
20
|
+
_tmpl$5 = /*#__PURE__*/_$template(`<span aria-live=polite>`),
|
|
21
|
+
_tmpl$6 = /*#__PURE__*/_$template(`<dialog class=k2b-lightbox><div class=k2b-lightbox__main><div class=k2b-lightbox__stage tabindex=-1></div><!$><!/></div><div class=k2b-lightbox__head><p class="k2b-lightbox__name k2b-overlay-surface"><b></b><!$><!/></p><div class="k2b-lightbox__actions k2b-overlay-surface"role=group><!$><!/><!$><!/><!$><!/><!$><!/><!$><!/><span class=k2b-lightbox__separator aria-hidden=true></span><!$><!/></div></div><div class=k2b-lightbox__bar></div><!$><!/>`),
|
|
22
|
+
_tmpl$7 = /*#__PURE__*/_$template(`<i class="ti ti-external-link"aria-hidden=true>`),
|
|
23
|
+
_tmpl$8 = /*#__PURE__*/_$template(`<i aria-hidden=true>`),
|
|
24
|
+
_tmpl$9 = /*#__PURE__*/_$template(`<span class=k2b-lightbox__action-label>`),
|
|
25
|
+
_tmpl$0 = /*#__PURE__*/_$template(`<i class="ti ti-download"aria-hidden=true>`),
|
|
26
|
+
_tmpl$1 = /*#__PURE__*/_$template(`<i class="ti ti-refresh"aria-hidden=true>`),
|
|
27
|
+
_tmpl$10 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__notice role=alert><i class="ti ti-file-alert k2b-lightbox__notice-icon"aria-hidden=true></i><b></b><span></span><div class=k2b-lightbox__notice-actions><!$><!/><!$><!/><!$><!/>`),
|
|
28
|
+
_tmpl$11 = /*#__PURE__*/_$template(`<span class=k2b-lightbox__converting>`),
|
|
29
|
+
_tmpl$12 = /*#__PURE__*/_$template(`<div class="k2b-lightbox__placeholder k2b-skeleton"role=status>`),
|
|
30
|
+
_tmpl$13 = /*#__PURE__*/_$template(`<article class=k2b-lightbox__text>`),
|
|
31
|
+
_tmpl$14 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__notice-actions>`),
|
|
32
|
+
_tmpl$15 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__notice><!$><!/><b></b><span></span><!$><!/>`),
|
|
33
|
+
_tmpl$16 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__content><!$><!/><!$><!/><!$><!/>`),
|
|
34
|
+
_tmpl$17 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__video>`),
|
|
35
|
+
_tmpl$18 = /*#__PURE__*/_$template(`<div class=k2b-lightbox__audio><!$><!/><audio controls preload=metadata>`),
|
|
36
|
+
_tmpl$19 = /*#__PURE__*/_$template(`<img class=k2b-lightbox__image>`);
|
|
37
|
+
import { createEffect, createSignal, For, lazy, Match, on, onCleanup, onMount, Show, Switch, untrack } from "solid-js";
|
|
38
|
+
import { Button, ButtonLink, IconButton, IconButtonLink } from "../actions/Button";
|
|
39
|
+
import { Toolbar } from "../actions/Toolbar";
|
|
24
40
|
import { returnFocus, ringOnReturn } from "../internal/focus-return";
|
|
25
|
-
import {
|
|
41
|
+
import { showTruncatedTitle } from "../internal/truncated-title";
|
|
42
|
+
import { createDelayedLoading } from "../surfaces/Skeleton";
|
|
43
|
+
import { FileTypeIcon } from "./FileTypeIcon";
|
|
44
|
+
import { getFileViewPreviewKind } from "./file-view-preview";
|
|
26
45
|
import { useLightboxMessages } from "./lightbox-messages";
|
|
27
46
|
import { ThumbnailStrip } from "./ThumbnailStrip";
|
|
28
47
|
|
|
29
|
-
|
|
48
|
+
/*
|
|
49
|
+
* The renderers load when a file needs them, so a page that offers the Lightbox carries only its frame: a gallery of
|
|
50
|
+
* pictures never loads the document, PDF and video code, and an app's first script stays within its budget.
|
|
51
|
+
*/
|
|
52
|
+
const renderers = () => import("./lightbox-renderers");
|
|
53
|
+
const FileView = lazy(() => renderers().then(module => ({
|
|
54
|
+
default: module.FileView
|
|
55
|
+
})));
|
|
56
|
+
const PdfViewer = lazy(() => renderers().then(module => ({
|
|
57
|
+
default: module.PdfViewer
|
|
58
|
+
})));
|
|
59
|
+
const VideoPlayer = lazy(() => renderers().then(module => ({
|
|
60
|
+
default: module.VideoPlayer
|
|
61
|
+
})));
|
|
62
|
+
|
|
63
|
+
/** One more command for the shown file, in the action pill before Download: a short label, its icon, and what it does. */
|
|
30
64
|
|
|
31
|
-
/** From this many images the gallery shows a thumbnail strip instead of dots. */
|
|
32
|
-
const STRIP_FROM = 4;
|
|
33
65
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
66
|
+
* One file the Lightbox can show. Give what the file has: `src` for an image, video, audio file or PDF the browser
|
|
67
|
+
* reads from an address; `load` for text, Markdown, code or PDF bytes; `preview` for a document that only exists as
|
|
68
|
+
* a preview PDF, such as an Office file. `file` names the type when the name alone does not.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
const ZOOM_STEPS = [0.5, 0.75, 1, 1.25, 1.5, 2, 3];
|
|
72
|
+
const SWIPE = 60;
|
|
73
|
+
const PULL_CLOSE = 110;
|
|
74
|
+
/** Seconds the arrows seek in a video or audio file, as `VideoPlayer`'s own keys do. */
|
|
75
|
+
const MEDIA_SEEK = 5;
|
|
76
|
+
const SPREADSHEET = /\.(xlsx?|ods|csv)$/i;
|
|
77
|
+
const kindOf = item => {
|
|
78
|
+
if (item.preview) return "office";
|
|
79
|
+
const kind = getFileViewPreviewKind(item.file ?? {
|
|
80
|
+
path: item.name
|
|
81
|
+
});
|
|
82
|
+
if (kind === "image" || kind === "video" || kind === "audio") return item.src ? kind : "none";
|
|
83
|
+
if (kind === "pdf") return item.src || item.load ? "pdf" : "none";
|
|
84
|
+
if (kind && item.load) return "text";
|
|
85
|
+
return "none";
|
|
86
|
+
};
|
|
87
|
+
const zoomable = kind => kind === "image" || kind === "pdf" || kind === "office" || kind === "text";
|
|
88
|
+
/** Keys inside these keep their own meaning. */
|
|
89
|
+
const interactive = target => target instanceof Element && Boolean(target.closest("button, a[href], input, textarea, select, video, audio, [contenteditable=''], [contenteditable=true]"));
|
|
90
|
+
/** A focused video or audio file keeps its keys: the arrows seek there instead of stepping to the next file. */
|
|
91
|
+
const media = target => target instanceof Element && Boolean(target.closest("video, audio"));
|
|
92
|
+
const bytes = content => content.encoding === "base64" ? new Blob([Uint8Array.from(atob(content.content), character => character.charCodeAt(0))], {
|
|
93
|
+
type: "application/pdf"
|
|
94
|
+
}) : new Blob([content.content], {
|
|
95
|
+
type: "application/pdf"
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The one large view of a file anywhere in Cloud: an image, PDF, video, audio file, text, Markdown, code, or a document
|
|
100
|
+
* shown through its preview PDF, and for anything else its icon, facts and Download. It loads the file itself and
|
|
101
|
+
* shows every state: a placeholder after a short wait, a failure with "Try again", and "Preview not possible".
|
|
102
|
+
*
|
|
103
|
+
* The name sits in a pill at the top left; Open (when the caller gives a target), the caller's commands, Download
|
|
104
|
+
* and Close in a pill at the top right. Large round buttons at the screen edges step between files, as do ← and →
|
|
105
|
+
* and the film strip from two files on; there is no "2 / 8" counter. The only pill at the bottom holds zoom and the
|
|
106
|
+
* page. Escape, Close, a press beside the file or a swipe down close it, and focus returns to the opener. On a phone
|
|
107
|
+
* it fills the screen and a swipe steps between files.
|
|
36
108
|
*/
|
|
37
109
|
export default function Lightbox(props) {
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const [
|
|
42
|
-
|
|
110
|
+
const t = useLightboxMessages();
|
|
111
|
+
const [zoom, setZoom] = createSignal(1);
|
|
112
|
+
const [pages, setPages] = createSignal(0);
|
|
113
|
+
const [page, setPage] = createSignal(0);
|
|
114
|
+
const [title, setTitle] = createSignal(null);
|
|
115
|
+
const [pull, setPull] = createSignal(0);
|
|
116
|
+
let dialog;
|
|
117
|
+
let stage;
|
|
43
118
|
let opener = null;
|
|
44
119
|
let openerRing = true;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
images: props.images,
|
|
60
|
-
initialIndex: props.initialIndex
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
// Touch gesture tracking
|
|
64
|
-
let touchStartX = 0;
|
|
65
|
-
let touchStartY = 0;
|
|
66
|
-
const SWIPE_THRESHOLD = 50;
|
|
67
|
-
const current = () => props.images[index()];
|
|
68
|
-
const isMultiple = () => props.images.length > 1;
|
|
69
|
-
const prev = () => {
|
|
70
|
-
if (!isMultiple()) return;
|
|
71
|
-
setIndex(i => (i - 1 + props.images.length) % props.images.length);
|
|
120
|
+
const index = () => Math.max(0, Math.min(props.index, props.items.length - 1));
|
|
121
|
+
const item = () => props.items[index()];
|
|
122
|
+
const kind = () => item() ? kindOf(item()) : "none";
|
|
123
|
+
/** The shown video or audio element, once the file plays on the stage. */
|
|
124
|
+
const playing = () => kind() === "video" || kind() === "audio" ? stage?.querySelector("video, audio") ?? null : null;
|
|
125
|
+
createEffect(on(item, () => {
|
|
126
|
+
setZoom(1);
|
|
127
|
+
setPages(0);
|
|
128
|
+
setPage(0);
|
|
129
|
+
setTitle(null);
|
|
130
|
+
}));
|
|
131
|
+
const step = direction => {
|
|
132
|
+
const next = index() + direction;
|
|
133
|
+
if (next >= 0 && next < props.items.length) props.onIndexChange(next);
|
|
72
134
|
};
|
|
73
|
-
const
|
|
74
|
-
if (!
|
|
75
|
-
|
|
135
|
+
const zoomBy = direction => {
|
|
136
|
+
if (!zoomable(kind())) return;
|
|
137
|
+
const value = zoom();
|
|
138
|
+
const next = direction > 0 ? ZOOM_STEPS.find(candidate => candidate > value + 0.001) : [...ZOOM_STEPS].reverse().find(candidate => candidate < value - 0.001);
|
|
139
|
+
if (next !== undefined) setZoom(next);
|
|
76
140
|
};
|
|
77
141
|
const close = () => {
|
|
78
|
-
|
|
142
|
+
if (dialog.open) dialog.close();
|
|
79
143
|
returnFocus(opener, openerRing);
|
|
80
144
|
props.onClose();
|
|
81
145
|
};
|
|
82
146
|
|
|
83
|
-
// A key belongs to the Lightbox while focus is inside it, or on the page with no other dialog open
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
147
|
+
// A key belongs to the Lightbox while focus is inside it, or on the page with no other dialog open above it.
|
|
148
|
+
const ownsKey = target => target instanceof Node && (dialog.contains(target) || target === document.body && Array.from(document.querySelectorAll("dialog[open]")).every(open => open === dialog));
|
|
149
|
+
const keys = event => {
|
|
150
|
+
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || !ownsKey(event.target)) return;
|
|
151
|
+
const handled = (() => {
|
|
152
|
+
switch (event.key) {
|
|
153
|
+
case "Escape":
|
|
154
|
+
close();
|
|
155
|
+
return true;
|
|
156
|
+
case " ":
|
|
157
|
+
{
|
|
158
|
+
if (interactive(event.target)) return false;
|
|
159
|
+
// Space plays and pauses a video or audio file; elsewhere it closes, as it opened the Lightbox in a list.
|
|
160
|
+
const shown = playing();
|
|
161
|
+
if (!shown) {
|
|
162
|
+
close();
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
if (shown.paused) void shown.play().catch(() => {});else shown.pause();
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
case "ArrowLeft":
|
|
169
|
+
case "ArrowRight":
|
|
170
|
+
{
|
|
171
|
+
if (media(event.target)) return false;
|
|
172
|
+
const direction = event.key === "ArrowRight" ? 1 : -1;
|
|
173
|
+
// A video or audio file keeps the arrows wherever the focus is, in every engine: they seek in it, as its own
|
|
174
|
+
// controls do. The edge buttons and the film strip still step to the next file.
|
|
175
|
+
const shown = playing();
|
|
176
|
+
if (shown) {
|
|
177
|
+
const end = Number.isFinite(shown.duration) ? shown.duration : shown.currentTime + MEDIA_SEEK;
|
|
178
|
+
shown.currentTime = Math.min(end, Math.max(0, shown.currentTime + direction * MEDIA_SEEK));
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
step(direction);
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
case "+":
|
|
185
|
+
case "=":
|
|
186
|
+
zoomBy(1);
|
|
187
|
+
return true;
|
|
188
|
+
case "-":
|
|
189
|
+
zoomBy(-1);
|
|
190
|
+
return true;
|
|
191
|
+
case "0":
|
|
192
|
+
setZoom(1);
|
|
193
|
+
return true;
|
|
194
|
+
default:
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
})();
|
|
198
|
+
if (handled) event.preventDefault();
|
|
104
199
|
};
|
|
105
200
|
|
|
106
|
-
// Touch
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
201
|
+
// Touch: a sideways swipe steps, a pull down closes. A zoomed picture keeps its own drag.
|
|
202
|
+
let touch = null;
|
|
203
|
+
const touchStart = event => {
|
|
204
|
+
const first = event.touches.length === 1 ? event.touches[0] : undefined;
|
|
205
|
+
touch = first && zoom() === 1 ? {
|
|
206
|
+
x: first.clientX,
|
|
207
|
+
y: first.clientY
|
|
208
|
+
} : null;
|
|
113
209
|
};
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
if (!touch) return;
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
// Only trigger swipe if horizontal movement is dominant
|
|
121
|
-
if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > SWIPE_THRESHOLD) {
|
|
122
|
-
if (deltaX > 0) {
|
|
123
|
-
prev();
|
|
124
|
-
} else {
|
|
125
|
-
next();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
210
|
+
const touchMove = event => {
|
|
211
|
+
const first = event.touches[0];
|
|
212
|
+
if (!touch || !first) return;
|
|
213
|
+
const dy = first.clientY - touch.y;
|
|
214
|
+
setPull(dy > 0 && dy > Math.abs(first.clientX - touch.x) && stage.scrollTop <= 0 ? dy : 0);
|
|
128
215
|
};
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
216
|
+
const touchEnd = event => {
|
|
217
|
+
const last = event.changedTouches[0];
|
|
218
|
+
const start = touch;
|
|
219
|
+
touch = null;
|
|
220
|
+
const pulled = pull();
|
|
221
|
+
setPull(0);
|
|
222
|
+
if (!start || !last) return;
|
|
223
|
+
if (pulled > PULL_CLOSE) return close();
|
|
224
|
+
const dx = last.clientX - start.x;
|
|
225
|
+
if (Math.abs(dx) > SWIPE && Math.abs(dx) > Math.abs(last.clientY - start.y)) step(dx < 0 ? 1 : -1);
|
|
135
226
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const handleCancel = e => {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
close();
|
|
227
|
+
// A press on the stage beside the file closes, like a press beside a dialog.
|
|
228
|
+
const stagePress = event => {
|
|
229
|
+
if (event.target === stage || event.target === dialog) close();
|
|
142
230
|
};
|
|
143
231
|
|
|
144
|
-
// Registration and teardown both live in onMount: onCleanup also runs when an
|
|
145
|
-
// SSR render is disposed, where `document` does not exist.
|
|
232
|
+
// Registration and teardown both live in onMount: onCleanup also runs when an SSR render is disposed.
|
|
146
233
|
onMount(() => {
|
|
147
234
|
opener = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
148
235
|
openerRing = ringOnReturn(opener);
|
|
149
|
-
// The native dialog would return focus with a ring of the browser's choosing.
|
|
150
236
|
opener?.blur();
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
237
|
+
dialog.showModal();
|
|
238
|
+
// The file has the focus, not the first command: the keys step and zoom at once, and no ring lands on Open.
|
|
239
|
+
stage.focus({
|
|
240
|
+
preventScroll: true
|
|
241
|
+
});
|
|
242
|
+
document.addEventListener("keydown", keys);
|
|
243
|
+
onCleanup(() => document.removeEventListener("keydown", keys));
|
|
244
|
+
});
|
|
245
|
+
const shownName = () => title() ?? item()?.name ?? "";
|
|
246
|
+
const meta = () => {
|
|
247
|
+
const current = item();
|
|
248
|
+
if (!current) return "";
|
|
249
|
+
const facts = title() ? [current.name, current.meta] : [current.meta];
|
|
250
|
+
if (kind() === "office") facts.push(t().viewOnly);
|
|
251
|
+
return facts.filter(Boolean).join(" · ");
|
|
252
|
+
};
|
|
253
|
+
const pageLabel = () => SPREADSHEET.test(item()?.name ?? "") ? t().sheet({
|
|
254
|
+
number: page() + 1,
|
|
255
|
+
total: pages()
|
|
256
|
+
}) : t().page({
|
|
257
|
+
number: page() + 1,
|
|
258
|
+
total: pages()
|
|
154
259
|
});
|
|
155
260
|
return (() => {
|
|
156
|
-
var _el$ = _$getNextElement(_tmpl$
|
|
261
|
+
var _el$ = _$getNextElement(_tmpl$6),
|
|
157
262
|
_el$2 = _el$.firstChild,
|
|
158
263
|
_el$3 = _el$2.firstChild,
|
|
159
|
-
_el$
|
|
160
|
-
[_el$
|
|
161
|
-
_el$
|
|
162
|
-
|
|
163
|
-
_el$
|
|
164
|
-
_el$
|
|
165
|
-
[_el$
|
|
264
|
+
_el$6 = _el$3.nextSibling,
|
|
265
|
+
[_el$7, _co$] = _$getNextMarker(_el$6.nextSibling),
|
|
266
|
+
_el$8 = _el$2.nextSibling,
|
|
267
|
+
_el$9 = _el$8.firstChild,
|
|
268
|
+
_el$0 = _el$9.firstChild,
|
|
269
|
+
_el$10 = _el$0.nextSibling,
|
|
270
|
+
[_el$11, _co$2] = _$getNextMarker(_el$10.nextSibling),
|
|
271
|
+
_el$12 = _el$9.nextSibling,
|
|
272
|
+
_el$15 = _el$12.firstChild,
|
|
273
|
+
[_el$16, _co$3] = _$getNextMarker(_el$15.nextSibling),
|
|
274
|
+
_el$17 = _el$16.nextSibling,
|
|
275
|
+
[_el$18, _co$4] = _$getNextMarker(_el$17.nextSibling),
|
|
276
|
+
_el$19 = _el$18.nextSibling,
|
|
277
|
+
[_el$20, _co$5] = _$getNextMarker(_el$19.nextSibling),
|
|
278
|
+
_el$21 = _el$20.nextSibling,
|
|
279
|
+
[_el$22, _co$6] = _$getNextMarker(_el$21.nextSibling),
|
|
166
280
|
_el$23 = _el$22.nextSibling,
|
|
167
|
-
[_el$24, _co$
|
|
168
|
-
_el$
|
|
169
|
-
_el$
|
|
170
|
-
_el$
|
|
171
|
-
_el$
|
|
172
|
-
_el$29 = _el$
|
|
173
|
-
[_el$30, _co$
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_el
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
var _ref$ =
|
|
183
|
-
typeof _ref$ === "function" ? _$use(_ref$, _el$) :
|
|
281
|
+
[_el$24, _co$7] = _$getNextMarker(_el$23.nextSibling),
|
|
282
|
+
_el$13 = _el$24.nextSibling,
|
|
283
|
+
_el$25 = _el$13.nextSibling,
|
|
284
|
+
[_el$26, _co$8] = _$getNextMarker(_el$25.nextSibling),
|
|
285
|
+
_el$27 = _el$8.nextSibling,
|
|
286
|
+
_el$29 = _el$27.nextSibling,
|
|
287
|
+
[_el$30, _co$9] = _$getNextMarker(_el$29.nextSibling);
|
|
288
|
+
_el$.$$touchend = touchEnd;
|
|
289
|
+
_el$.$$touchmove = touchMove;
|
|
290
|
+
_el$.$$touchstart = touchStart;
|
|
291
|
+
_el$.$$mousedown = stagePress;
|
|
292
|
+
_el$.addEventListener("cancel", event => {
|
|
293
|
+
event.preventDefault();
|
|
294
|
+
close();
|
|
295
|
+
});
|
|
296
|
+
var _ref$ = dialog;
|
|
297
|
+
typeof _ref$ === "function" ? _$use(_ref$, _el$) : dialog = _el$;
|
|
298
|
+
var _ref$2 = stage;
|
|
299
|
+
typeof _ref$2 === "function" ? _$use(_ref$2, _el$3) : stage = _el$3;
|
|
184
300
|
_$insert(_el$3, _$createComponent(Show, {
|
|
301
|
+
keyed: true,
|
|
185
302
|
get when() {
|
|
186
|
-
return
|
|
303
|
+
return item();
|
|
304
|
+
},
|
|
305
|
+
children: shown => _$createComponent(LightboxStage, {
|
|
306
|
+
item: shown,
|
|
307
|
+
get kind() {
|
|
308
|
+
return untrack(kind);
|
|
309
|
+
},
|
|
310
|
+
zoom: zoom,
|
|
311
|
+
onPages: setPages,
|
|
312
|
+
onPage: setPage,
|
|
313
|
+
onTitle: setTitle
|
|
314
|
+
})
|
|
315
|
+
}));
|
|
316
|
+
_$insert(_el$2, _$createComponent(Show, {
|
|
317
|
+
get when() {
|
|
318
|
+
return props.items.length > 1;
|
|
187
319
|
},
|
|
188
320
|
get children() {
|
|
189
|
-
|
|
190
|
-
_el$
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
321
|
+
return [(() => {
|
|
322
|
+
var _el$4 = _$getNextElement(_tmpl$);
|
|
323
|
+
_el$4.$$click = () => step(-1);
|
|
324
|
+
_$effect(_p$ => {
|
|
325
|
+
var _v$ = t().previous,
|
|
326
|
+
_v$2 = `${t().previous} (←)`,
|
|
327
|
+
_v$3 = index() > 0 ? "visible" : "hidden";
|
|
328
|
+
_v$ !== _p$.e && _$setAttribute(_el$4, "aria-label", _p$.e = _v$);
|
|
329
|
+
_v$2 !== _p$.t && _$setAttribute(_el$4, "title", _p$.t = _v$2);
|
|
330
|
+
_v$3 !== _p$.a && _$setStyleProperty(_el$4, "visibility", _p$.a = _v$3);
|
|
331
|
+
return _p$;
|
|
332
|
+
}, {
|
|
333
|
+
e: undefined,
|
|
334
|
+
t: undefined,
|
|
335
|
+
a: undefined
|
|
336
|
+
});
|
|
337
|
+
_$runHydrationEvents();
|
|
338
|
+
return _el$4;
|
|
339
|
+
})(), (() => {
|
|
340
|
+
var _el$5 = _$getNextElement(_tmpl$2);
|
|
341
|
+
_el$5.$$click = () => step(1);
|
|
342
|
+
_$effect(_p$ => {
|
|
343
|
+
var _v$4 = t().next,
|
|
344
|
+
_v$5 = `${t().next} (→)`,
|
|
345
|
+
_v$6 = index() < props.items.length - 1 ? "visible" : "hidden";
|
|
346
|
+
_v$4 !== _p$.e && _$setAttribute(_el$5, "aria-label", _p$.e = _v$4);
|
|
347
|
+
_v$5 !== _p$.t && _$setAttribute(_el$5, "title", _p$.t = _v$5);
|
|
348
|
+
_v$6 !== _p$.a && _$setStyleProperty(_el$5, "visibility", _p$.a = _v$6);
|
|
349
|
+
return _p$;
|
|
350
|
+
}, {
|
|
351
|
+
e: undefined,
|
|
352
|
+
t: undefined,
|
|
353
|
+
a: undefined
|
|
354
|
+
});
|
|
355
|
+
_$runHydrationEvents();
|
|
356
|
+
return _el$5;
|
|
357
|
+
})()];
|
|
198
358
|
}
|
|
199
|
-
}), _el$
|
|
200
|
-
_$
|
|
359
|
+
}), _el$7, _co$);
|
|
360
|
+
_$addEventListener(_el$0, "pointerenter", showTruncatedTitle);
|
|
361
|
+
_$insert(_el$0, shownName);
|
|
362
|
+
_$insert(_el$9, _$createComponent(Show, {
|
|
201
363
|
get when() {
|
|
202
|
-
return
|
|
364
|
+
return meta();
|
|
203
365
|
},
|
|
204
366
|
get children() {
|
|
205
|
-
var _el$
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return _el$0;
|
|
367
|
+
var _el$1 = _$getNextElement(_tmpl$3);
|
|
368
|
+
_$insert(_el$1, meta);
|
|
369
|
+
return _el$1;
|
|
209
370
|
}
|
|
210
|
-
}), _el$
|
|
211
|
-
_$insert(_el$
|
|
212
|
-
get
|
|
213
|
-
return
|
|
371
|
+
}), _el$11, _co$2);
|
|
372
|
+
_$insert(_el$12, _$createComponent(Show, {
|
|
373
|
+
get when() {
|
|
374
|
+
return item()?.open;
|
|
214
375
|
},
|
|
215
|
-
children:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
_v$6 !== _p$.t && _$className(_el$36, _p$.t = _v$6);
|
|
226
|
-
return _p$;
|
|
227
|
-
}, {
|
|
228
|
-
e: undefined,
|
|
229
|
-
t: undefined
|
|
230
|
-
});
|
|
231
|
-
_$runHydrationEvents();
|
|
232
|
-
return _el$35;
|
|
233
|
-
})()
|
|
234
|
-
}), _el$22, _co$5);
|
|
235
|
-
_$insert(_el$14, _$createComponent(Show, {
|
|
376
|
+
children: open => _$createComponent(Button, {
|
|
377
|
+
size: "sm",
|
|
378
|
+
"class": "k2b-lightbox__open",
|
|
379
|
+
onClick: () => open().onOpen(),
|
|
380
|
+
get children() {
|
|
381
|
+
return [_$getNextElement(_tmpl$7), _$memo(() => open().label ?? t().open)];
|
|
382
|
+
}
|
|
383
|
+
})
|
|
384
|
+
}), _el$16, _co$3);
|
|
385
|
+
_$insert(_el$12, _$createComponent(Show, {
|
|
236
386
|
get when() {
|
|
237
|
-
return
|
|
387
|
+
return item();
|
|
238
388
|
},
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
389
|
+
children: shown => props.actions?.(shown())
|
|
390
|
+
}), _el$18, _co$4);
|
|
391
|
+
_$insert(_el$12, _$createComponent(For, {
|
|
392
|
+
get each() {
|
|
393
|
+
return item()?.actions ?? [];
|
|
394
|
+
},
|
|
395
|
+
children: action => _$createComponent(Button, {
|
|
396
|
+
size: "sm",
|
|
397
|
+
variant: "ghost",
|
|
398
|
+
"class": "k2b-lightbox__action",
|
|
399
|
+
get ["aria-label"]() {
|
|
400
|
+
return action.label;
|
|
401
|
+
},
|
|
402
|
+
get onClick() {
|
|
403
|
+
return action.onClick;
|
|
404
|
+
},
|
|
405
|
+
get children() {
|
|
406
|
+
return [(() => {
|
|
407
|
+
var _el$32 = _$getNextElement(_tmpl$8);
|
|
408
|
+
_$effect(() => _$className(_el$32, action.icon));
|
|
409
|
+
return _el$32;
|
|
410
|
+
})(), (() => {
|
|
411
|
+
var _el$33 = _$getNextElement(_tmpl$9);
|
|
412
|
+
_$insert(_el$33, () => action.label);
|
|
413
|
+
return _el$33;
|
|
414
|
+
})()];
|
|
415
|
+
}
|
|
416
|
+
})
|
|
417
|
+
}), _el$20, _co$5);
|
|
418
|
+
_$insert(_el$12, _$createComponent(Show, {
|
|
260
419
|
get when() {
|
|
261
|
-
return
|
|
420
|
+
return item()?.downloadUrl;
|
|
262
421
|
},
|
|
263
|
-
children:
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
_$insert(_el$, _$createComponent(Show, {
|
|
422
|
+
children: href => _$createComponent(IconButtonLink, {
|
|
423
|
+
variant: "ghost",
|
|
424
|
+
get label() {
|
|
425
|
+
return t().download;
|
|
426
|
+
},
|
|
427
|
+
get href() {
|
|
428
|
+
return href();
|
|
429
|
+
},
|
|
430
|
+
download: "",
|
|
431
|
+
navigation: "document",
|
|
432
|
+
get children() {
|
|
433
|
+
return _$getNextElement(_tmpl$0);
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
}), _el$22, _co$6);
|
|
437
|
+
_$insert(_el$12, _$createComponent(Show, {
|
|
280
438
|
get when() {
|
|
281
|
-
return
|
|
439
|
+
return _$memo(() => !!!item()?.downloadUrl)() && item()?.onDownload;
|
|
440
|
+
},
|
|
441
|
+
children: download => _$createComponent(IconButton, {
|
|
442
|
+
variant: "ghost",
|
|
443
|
+
get label() {
|
|
444
|
+
return t().download;
|
|
445
|
+
},
|
|
446
|
+
onClick: () => download()(),
|
|
447
|
+
get children() {
|
|
448
|
+
return _$getNextElement(_tmpl$0);
|
|
449
|
+
}
|
|
450
|
+
})
|
|
451
|
+
}), _el$24, _co$7);
|
|
452
|
+
_$insert(_el$12, _$createComponent(IconButton, {
|
|
453
|
+
variant: "ghost",
|
|
454
|
+
get label() {
|
|
455
|
+
return t().close;
|
|
282
456
|
},
|
|
457
|
+
get tooltip() {
|
|
458
|
+
return t().closeHint;
|
|
459
|
+
},
|
|
460
|
+
onClick: close,
|
|
283
461
|
get children() {
|
|
284
|
-
return
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
462
|
+
return _$getNextElement(_tmpl$4);
|
|
463
|
+
}
|
|
464
|
+
}), _el$26, _co$8);
|
|
465
|
+
_$insert(_el$27, _$createComponent(Toolbar, {
|
|
466
|
+
get label() {
|
|
467
|
+
return t().view;
|
|
468
|
+
},
|
|
469
|
+
"class": "k2b-lightbox__tools k2b-overlay-surface",
|
|
470
|
+
get children() {
|
|
471
|
+
return [_$createComponent(Toolbar.Action, {
|
|
472
|
+
get label() {
|
|
473
|
+
return t().zoomOut;
|
|
474
|
+
},
|
|
475
|
+
icon: "ti ti-minus",
|
|
476
|
+
get disabled() {
|
|
477
|
+
return !zoomable(kind()) || zoom() <= ZOOM_STEPS[0];
|
|
478
|
+
},
|
|
479
|
+
onClick: () => zoomBy(-1)
|
|
480
|
+
}), _$createComponent(Toolbar.Label, {
|
|
481
|
+
"class": "k2b-lightbox__percent",
|
|
482
|
+
get children() {
|
|
483
|
+
var _el$28 = _$getNextElement(_tmpl$5);
|
|
484
|
+
_$insert(_el$28, (() => {
|
|
485
|
+
var _c$ = _$memo(() => !!zoomable(kind()));
|
|
486
|
+
return () => _c$() ? t().percent({
|
|
487
|
+
value: Math.round(zoom() * 100)
|
|
488
|
+
}) : "";
|
|
489
|
+
})());
|
|
490
|
+
return _el$28;
|
|
491
|
+
}
|
|
492
|
+
}), _$createComponent(Toolbar.Action, {
|
|
493
|
+
get label() {
|
|
494
|
+
return t().zoomIn;
|
|
495
|
+
},
|
|
496
|
+
icon: "ti ti-plus",
|
|
497
|
+
get disabled() {
|
|
498
|
+
return !zoomable(kind()) || zoom() >= ZOOM_STEPS[ZOOM_STEPS.length - 1];
|
|
499
|
+
},
|
|
500
|
+
onClick: () => zoomBy(1)
|
|
501
|
+
}), _$createComponent(Show, {
|
|
502
|
+
get when() {
|
|
503
|
+
return pages() > 1;
|
|
504
|
+
},
|
|
505
|
+
get children() {
|
|
506
|
+
return [_$createComponent(Toolbar.Separator, {}), _$createComponent(Toolbar.Label, {
|
|
507
|
+
"class": "k2b-lightbox__page",
|
|
508
|
+
get children() {
|
|
509
|
+
return pageLabel();
|
|
510
|
+
}
|
|
511
|
+
})];
|
|
512
|
+
}
|
|
513
|
+
})];
|
|
297
514
|
}
|
|
298
|
-
})
|
|
515
|
+
}));
|
|
299
516
|
_$insert(_el$, _$createComponent(Show, {
|
|
300
517
|
get when() {
|
|
301
|
-
return props.
|
|
518
|
+
return props.items.length > 1;
|
|
302
519
|
},
|
|
303
520
|
get children() {
|
|
304
521
|
return _$createComponent(ThumbnailStrip, {
|
|
305
|
-
"class": "k2b-
|
|
522
|
+
"class": "k2b-lightbox__strip",
|
|
306
523
|
get label() {
|
|
307
|
-
return
|
|
524
|
+
return t().files;
|
|
308
525
|
},
|
|
309
526
|
get items() {
|
|
310
|
-
return props.
|
|
311
|
-
id: String(
|
|
312
|
-
name:
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
527
|
+
return props.items.map((entry, position) => ({
|
|
528
|
+
id: String(position),
|
|
529
|
+
name: entry.name,
|
|
530
|
+
thumbnail: entry.thumbnail ?? (() => _$createComponent(FileTypeIcon, {
|
|
531
|
+
get name() {
|
|
532
|
+
return entry.file?.path ?? entry.name;
|
|
533
|
+
}
|
|
534
|
+
}))
|
|
316
535
|
}));
|
|
317
536
|
},
|
|
318
537
|
get currentItem() {
|
|
319
538
|
return String(index());
|
|
320
539
|
},
|
|
321
|
-
onSelectItem: id =>
|
|
540
|
+
onSelectItem: id => props.onIndexChange(Number(id))
|
|
322
541
|
});
|
|
323
542
|
}
|
|
324
|
-
}), _el$
|
|
325
|
-
_$
|
|
543
|
+
}), _el$30, _co$9);
|
|
544
|
+
_$effect(_p$ => {
|
|
545
|
+
var _v$7 = shownName(),
|
|
546
|
+
_v$8 = kind(),
|
|
547
|
+
_v$9 = pull() ? {
|
|
548
|
+
"--k2b-lightbox-pull": String(Math.min(1, pull() / (PULL_CLOSE * 2)))
|
|
549
|
+
} : undefined,
|
|
550
|
+
_v$0 = zoom() !== 1 ? "" : undefined,
|
|
551
|
+
_v$1 = t().actions,
|
|
552
|
+
_v$10 = zoomable(kind()) || pages() > 1 ? "visible" : "hidden";
|
|
553
|
+
_v$7 !== _p$.e && _$setAttribute(_el$, "aria-label", _p$.e = _v$7);
|
|
554
|
+
_v$8 !== _p$.t && _$setAttribute(_el$, "data-kind", _p$.t = _v$8);
|
|
555
|
+
_p$.a = _$style(_el$, _v$9, _p$.a);
|
|
556
|
+
_v$0 !== _p$.o && _$setAttribute(_el$3, "data-zoomed", _p$.o = _v$0);
|
|
557
|
+
_v$1 !== _p$.i && _$setAttribute(_el$12, "aria-label", _p$.i = _v$1);
|
|
558
|
+
_v$10 !== _p$.n && _$setStyleProperty(_el$27, "visibility", _p$.n = _v$10);
|
|
559
|
+
return _p$;
|
|
560
|
+
}, {
|
|
561
|
+
e: undefined,
|
|
562
|
+
t: undefined,
|
|
563
|
+
a: undefined,
|
|
564
|
+
o: undefined,
|
|
565
|
+
i: undefined,
|
|
566
|
+
n: undefined
|
|
567
|
+
});
|
|
568
|
+
_$runHydrationEvents();
|
|
569
|
+
return _el$;
|
|
570
|
+
})();
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/** One file on the stage: it loads, and shows a placeholder after a short wait, a failure with retry, or the file. */
|
|
574
|
+
function LightboxStage(props) {
|
|
575
|
+
const t = useLightboxMessages();
|
|
576
|
+
// Each attempt mounts the content anew; "Try again" starts the next one.
|
|
577
|
+
const [attempt, setAttempt] = createSignal(0);
|
|
578
|
+
const [state, setState] = createSignal(props.kind === "none" ? "ready" : "loading");
|
|
579
|
+
const placeholder = createDelayedLoading(() => state() === "loading");
|
|
580
|
+
const [document_, setDocument] = createSignal(null);
|
|
581
|
+
// The address the browser reads; a resolver runs once per attempt, so a retry asks for a fresh signed address.
|
|
582
|
+
const [source, setSource] = createSignal(null);
|
|
583
|
+
const failed = () => setState("failed");
|
|
584
|
+
const ready = () => setState("ready");
|
|
585
|
+
/*
|
|
586
|
+
* A video or audio file takes the focus once its player is there, which can be a moment after the frame when the
|
|
587
|
+
* player's code still loads; so its own keys and the screen reader start on it in every engine. The focus moves only
|
|
588
|
+
* while it still rests on the stage or the page, never away from a control the person chose meanwhile.
|
|
589
|
+
*/
|
|
590
|
+
const focusMediaWhenShown = host => {
|
|
591
|
+
const take = () => {
|
|
592
|
+
const shown = host.querySelector("video, audio");
|
|
593
|
+
if (!shown || !shown.isConnected) return false;
|
|
594
|
+
const active = document.activeElement;
|
|
595
|
+
const stage = host.closest(".k2b-lightbox__stage");
|
|
596
|
+
if (!active || active === document.body || active === stage || host.contains(active)) shown.focus({
|
|
597
|
+
preventScroll: true
|
|
598
|
+
});
|
|
599
|
+
return true;
|
|
600
|
+
};
|
|
601
|
+
// The host is not in the page yet while its ref runs; the first look waits for the mount.
|
|
602
|
+
const watch = new MutationObserver(() => {
|
|
603
|
+
if (take()) watch.disconnect();
|
|
604
|
+
});
|
|
605
|
+
watch.observe(host, {
|
|
606
|
+
childList: true,
|
|
607
|
+
subtree: true
|
|
608
|
+
});
|
|
609
|
+
onCleanup(() => watch.disconnect());
|
|
610
|
+
const look = () => {
|
|
611
|
+
if (take()) watch.disconnect();
|
|
612
|
+
};
|
|
613
|
+
queueMicrotask(look);
|
|
614
|
+
requestAnimationFrame(look);
|
|
615
|
+
};
|
|
616
|
+
const downloadable = () => Boolean(props.item.downloadUrl || props.item.onDownload);
|
|
617
|
+
const download = variant => _$createComponent(Show, {
|
|
618
|
+
get when() {
|
|
619
|
+
return props.item.downloadUrl;
|
|
620
|
+
},
|
|
621
|
+
get fallback() {
|
|
622
|
+
return _$createComponent(Show, {
|
|
623
|
+
get when() {
|
|
624
|
+
return props.item.onDownload;
|
|
625
|
+
},
|
|
626
|
+
children: run => _$createComponent(Button, {
|
|
627
|
+
size: "sm",
|
|
628
|
+
variant: variant,
|
|
629
|
+
onClick: () => run()(),
|
|
630
|
+
get children() {
|
|
631
|
+
return [_$getNextElement(_tmpl$0), _$memo(() => t().download)];
|
|
632
|
+
}
|
|
633
|
+
})
|
|
634
|
+
});
|
|
635
|
+
},
|
|
636
|
+
children: href => _$createComponent(ButtonLink, {
|
|
637
|
+
size: "sm",
|
|
638
|
+
variant: variant,
|
|
639
|
+
get href() {
|
|
640
|
+
return href();
|
|
641
|
+
},
|
|
642
|
+
download: "",
|
|
643
|
+
navigation: "document",
|
|
644
|
+
get children() {
|
|
645
|
+
return [_$getNextElement(_tmpl$0), _$memo(() => t().download)];
|
|
646
|
+
}
|
|
647
|
+
})
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// Each attempt owns a signal: moving on, closing, or trying again stops what the previous one still loads.
|
|
651
|
+
let loading;
|
|
652
|
+
onCleanup(() => loading?.abort());
|
|
653
|
+
const signal = () => loading?.signal ?? new AbortController().signal;
|
|
654
|
+
const settle = then => value => {
|
|
655
|
+
if (!signal().aborted) then(value);
|
|
656
|
+
};
|
|
657
|
+
const fail = () => {
|
|
658
|
+
if (!signal().aborted) failed();
|
|
659
|
+
};
|
|
660
|
+
const resolveSource = () => {
|
|
661
|
+
const src = props.item.src;
|
|
662
|
+
return typeof src === "function" ? src(signal()) : Promise.resolve(src ?? null);
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
// Addresses, PDFs from bytes and preview PDFs load here; the viewers then draw them.
|
|
666
|
+
createEffect(on(attempt, () => {
|
|
667
|
+
loading?.abort();
|
|
668
|
+
loading = new AbortController();
|
|
669
|
+
setState(props.kind === "none" ? "ready" : "loading");
|
|
670
|
+
setDocument(null);
|
|
671
|
+
setSource(null);
|
|
672
|
+
if (props.kind === "office" && props.item.preview) props.item.preview(signal()).then(settle(setDocument), fail);else if (props.kind === "pdf" && !props.item.src) props.item.load?.(signal()).then(settle(content => setDocument(bytes(content))), fail);else if (props.item.src) resolveSource().then(settle(value => {
|
|
673
|
+
if (!value) return failed();
|
|
674
|
+
setSource(value);
|
|
675
|
+
if (props.kind === "pdf") setDocument(value);
|
|
676
|
+
// The video player shows its own loading; the frame is ready as soon as it has an address.
|
|
677
|
+
if (props.kind === "video") ready();
|
|
678
|
+
}), fail);
|
|
679
|
+
}));
|
|
680
|
+
return (() => {
|
|
681
|
+
var _el$38 = _$getNextElement(_tmpl$16),
|
|
682
|
+
_el$62 = _el$38.firstChild,
|
|
683
|
+
[_el$63, _co$13] = _$getNextMarker(_el$62.nextSibling),
|
|
684
|
+
_el$64 = _el$63.nextSibling,
|
|
685
|
+
[_el$65, _co$14] = _$getNextMarker(_el$64.nextSibling),
|
|
686
|
+
_el$66 = _el$65.nextSibling,
|
|
687
|
+
[_el$67, _co$15] = _$getNextMarker(_el$66.nextSibling);
|
|
688
|
+
_$insert(_el$38, _$createComponent(Show, {
|
|
326
689
|
get when() {
|
|
327
|
-
return
|
|
690
|
+
return state() === "failed";
|
|
328
691
|
},
|
|
329
692
|
get children() {
|
|
330
|
-
var _el$
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
693
|
+
var _el$39 = _$getNextElement(_tmpl$10),
|
|
694
|
+
_el$40 = _el$39.firstChild,
|
|
695
|
+
_el$41 = _el$40.nextSibling,
|
|
696
|
+
_el$42 = _el$41.nextSibling,
|
|
697
|
+
_el$43 = _el$42.nextSibling,
|
|
698
|
+
_el$45 = _el$43.firstChild,
|
|
699
|
+
[_el$46, _co$0] = _$getNextMarker(_el$45.nextSibling),
|
|
700
|
+
_el$47 = _el$46.nextSibling,
|
|
701
|
+
[_el$48, _co$1] = _$getNextMarker(_el$47.nextSibling),
|
|
702
|
+
_el$49 = _el$48.nextSibling,
|
|
703
|
+
[_el$50, _co$10] = _$getNextMarker(_el$49.nextSibling);
|
|
704
|
+
_$insert(_el$41, (() => {
|
|
705
|
+
var _c$2 = _$memo(() => props.kind === "office");
|
|
706
|
+
return () => _c$2() ? t().notPossible : t().failed;
|
|
707
|
+
})());
|
|
708
|
+
_$insert(_el$42, (() => {
|
|
709
|
+
var _c$3 = _$memo(() => props.kind === "office");
|
|
710
|
+
return () => _c$3() ? t().notPossibleHint : t().failedHint;
|
|
711
|
+
})());
|
|
712
|
+
_$insert(_el$43, _$createComponent(Show, {
|
|
713
|
+
get when() {
|
|
714
|
+
return _$memo(() => props.kind === "office")() && props.item.open;
|
|
715
|
+
},
|
|
716
|
+
children: open => _$createComponent(Button, {
|
|
717
|
+
size: "sm",
|
|
718
|
+
onClick: () => open().onOpen(),
|
|
719
|
+
get children() {
|
|
720
|
+
return open().label ?? t().open;
|
|
721
|
+
}
|
|
722
|
+
})
|
|
723
|
+
}), _el$46, _co$0);
|
|
724
|
+
_$insert(_el$43, _$createComponent(Show, {
|
|
725
|
+
get when() {
|
|
726
|
+
return props.kind !== "office";
|
|
334
727
|
},
|
|
335
|
-
children
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
_v$9 !== _p$.e && _$setAttribute(_el$39, "aria-current", _p$.e = _v$9);
|
|
344
|
-
_v$0 !== _p$.t && _$setAttribute(_el$39, "aria-label", _p$.t = _v$0);
|
|
345
|
-
return _p$;
|
|
346
|
-
}, {
|
|
347
|
-
e: undefined,
|
|
348
|
-
t: undefined
|
|
728
|
+
get children() {
|
|
729
|
+
return _$createComponent(Button, {
|
|
730
|
+
size: "sm",
|
|
731
|
+
variant: "secondary",
|
|
732
|
+
onClick: () => setAttempt(value => value + 1),
|
|
733
|
+
get children() {
|
|
734
|
+
return [_$getNextElement(_tmpl$1), _$memo(() => t().retry)];
|
|
735
|
+
}
|
|
349
736
|
});
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
737
|
+
}
|
|
738
|
+
}), _el$48, _co$1);
|
|
739
|
+
_$insert(_el$43, () => download("secondary"), _el$50, _co$10);
|
|
740
|
+
return _el$39;
|
|
741
|
+
}
|
|
742
|
+
}), _el$63, _co$13);
|
|
743
|
+
_$insert(_el$38, _$createComponent(Show, {
|
|
744
|
+
get when() {
|
|
745
|
+
return placeholder();
|
|
746
|
+
},
|
|
747
|
+
get children() {
|
|
748
|
+
var _el$51 = _$getNextElement(_tmpl$12);
|
|
749
|
+
_$insert(_el$51, _$createComponent(Show, {
|
|
750
|
+
get when() {
|
|
751
|
+
return props.kind === "office";
|
|
752
|
+
},
|
|
753
|
+
get children() {
|
|
754
|
+
var _el$52 = _$getNextElement(_tmpl$11);
|
|
755
|
+
_$insert(_el$52, () => t().converting);
|
|
756
|
+
return _el$52;
|
|
757
|
+
}
|
|
353
758
|
}));
|
|
354
|
-
_$effect(
|
|
355
|
-
|
|
759
|
+
_$effect(_p$ => {
|
|
760
|
+
var _v$11 = props.kind,
|
|
761
|
+
_v$12 = t().loading;
|
|
762
|
+
_v$11 !== _p$.e && _$setAttribute(_el$51, "data-kind", _p$.e = _v$11);
|
|
763
|
+
_v$12 !== _p$.t && _$setAttribute(_el$51, "aria-label", _p$.t = _v$12);
|
|
764
|
+
return _p$;
|
|
765
|
+
}, {
|
|
766
|
+
e: undefined,
|
|
767
|
+
t: undefined
|
|
768
|
+
});
|
|
769
|
+
return _el$51;
|
|
356
770
|
}
|
|
357
|
-
}), _el$
|
|
771
|
+
}), _el$65, _co$14);
|
|
772
|
+
_$insert(_el$38, _$createComponent(Show, {
|
|
773
|
+
keyed: true,
|
|
774
|
+
get when() {
|
|
775
|
+
return _$memo(() => state() !== "failed")() && attempt() + 1;
|
|
776
|
+
},
|
|
777
|
+
get children() {
|
|
778
|
+
return _$createComponent(Switch, {
|
|
779
|
+
get children() {
|
|
780
|
+
return [_$createComponent(Match, {
|
|
781
|
+
get when() {
|
|
782
|
+
return _$memo(() => props.kind === "image")() && source();
|
|
783
|
+
},
|
|
784
|
+
children: src => _$createComponent(LightboxImage, {
|
|
785
|
+
get src() {
|
|
786
|
+
return src();
|
|
787
|
+
},
|
|
788
|
+
get name() {
|
|
789
|
+
return props.item.name;
|
|
790
|
+
},
|
|
791
|
+
get zoom() {
|
|
792
|
+
return props.zoom;
|
|
793
|
+
},
|
|
794
|
+
onReady: ready,
|
|
795
|
+
onError: failed
|
|
796
|
+
})
|
|
797
|
+
}), _$createComponent(Match, {
|
|
798
|
+
get when() {
|
|
799
|
+
return _$memo(() => !!(props.kind === "pdf" || props.kind === "office"))() && document_();
|
|
800
|
+
},
|
|
801
|
+
children: data => _$createComponent(PdfViewer, {
|
|
802
|
+
"class": "k2b-lightbox__pdf",
|
|
803
|
+
get data() {
|
|
804
|
+
return data();
|
|
805
|
+
},
|
|
806
|
+
get title() {
|
|
807
|
+
return props.item.name;
|
|
808
|
+
},
|
|
809
|
+
zoom: false,
|
|
810
|
+
fit: "page",
|
|
811
|
+
get scale() {
|
|
812
|
+
return props.zoom();
|
|
813
|
+
},
|
|
814
|
+
onReady: drawn => {
|
|
815
|
+
props.onPages(drawn.pages);
|
|
816
|
+
ready();
|
|
817
|
+
},
|
|
818
|
+
get onPage() {
|
|
819
|
+
return props.onPage;
|
|
820
|
+
},
|
|
821
|
+
onError: failed
|
|
822
|
+
})
|
|
823
|
+
}), _$createComponent(Match, {
|
|
824
|
+
get when() {
|
|
825
|
+
return _$memo(() => props.kind === "video")() && source();
|
|
826
|
+
},
|
|
827
|
+
children: src => // The shared player renews a short-lived address and goes on at the same time; it has the keys at once.
|
|
828
|
+
(() => {
|
|
829
|
+
var _el$68 = _$getNextElement(_tmpl$17);
|
|
830
|
+
_$use(focusMediaWhenShown, _el$68);
|
|
831
|
+
_$insert(_el$68, _$createComponent(VideoPlayer, {
|
|
832
|
+
get src() {
|
|
833
|
+
return src();
|
|
834
|
+
},
|
|
835
|
+
get label() {
|
|
836
|
+
return props.item.name;
|
|
837
|
+
},
|
|
838
|
+
get renew() {
|
|
839
|
+
return typeof props.item.src === "function" ? () => resolveSource().then(value => value ?? src()) : undefined;
|
|
840
|
+
},
|
|
841
|
+
get fallbackAction() {
|
|
842
|
+
return download("secondary");
|
|
843
|
+
}
|
|
844
|
+
}));
|
|
845
|
+
return _el$68;
|
|
846
|
+
})()
|
|
847
|
+
}), _$createComponent(Match, {
|
|
848
|
+
get when() {
|
|
849
|
+
return _$memo(() => props.kind === "audio")() && source();
|
|
850
|
+
},
|
|
851
|
+
children: src => (() => {
|
|
852
|
+
var _el$69 = _$getNextElement(_tmpl$18),
|
|
853
|
+
_el$71 = _el$69.firstChild,
|
|
854
|
+
[_el$72, _co$16] = _$getNextMarker(_el$71.nextSibling),
|
|
855
|
+
_el$70 = _el$72.nextSibling;
|
|
856
|
+
_$use(focusMediaWhenShown, _el$69);
|
|
857
|
+
_$insert(_el$69, _$createComponent(FileTypeIcon, {
|
|
858
|
+
get name() {
|
|
859
|
+
return props.item.file?.path ?? props.item.name;
|
|
860
|
+
},
|
|
861
|
+
size: "lg"
|
|
862
|
+
}), _el$72, _co$16);
|
|
863
|
+
_el$70.addEventListener("error", failed);
|
|
864
|
+
_el$70.addEventListener("loadedmetadata", ready);
|
|
865
|
+
_$effect(() => _$setAttribute(_el$70, "src", src()));
|
|
866
|
+
return _el$69;
|
|
867
|
+
})()
|
|
868
|
+
}), _$createComponent(Match, {
|
|
869
|
+
get when() {
|
|
870
|
+
return props.kind === "text";
|
|
871
|
+
},
|
|
872
|
+
get children() {
|
|
873
|
+
var _el$53 = _$getNextElement(_tmpl$13);
|
|
874
|
+
_$insert(_el$53, _$createComponent(FileView, {
|
|
875
|
+
variant: "plain",
|
|
876
|
+
get file() {
|
|
877
|
+
return props.item.file ?? {
|
|
878
|
+
path: props.item.name
|
|
879
|
+
};
|
|
880
|
+
},
|
|
881
|
+
load: () => props.item.load(signal()).then(content => {
|
|
882
|
+
ready();
|
|
883
|
+
return content;
|
|
884
|
+
}, error => {
|
|
885
|
+
failed();
|
|
886
|
+
throw error;
|
|
887
|
+
}),
|
|
888
|
+
get onDocumentTitle() {
|
|
889
|
+
return props.onTitle;
|
|
890
|
+
}
|
|
891
|
+
}));
|
|
892
|
+
_$effect(_$p => _$setStyleProperty(_el$53, "--k2b-lightbox-text-scale", String(props.zoom())));
|
|
893
|
+
return _el$53;
|
|
894
|
+
}
|
|
895
|
+
}), _$createComponent(Match, {
|
|
896
|
+
get when() {
|
|
897
|
+
return props.kind === "none";
|
|
898
|
+
},
|
|
899
|
+
get children() {
|
|
900
|
+
var _el$54 = _$getNextElement(_tmpl$15),
|
|
901
|
+
_el$58 = _el$54.firstChild,
|
|
902
|
+
[_el$59, _co$11] = _$getNextMarker(_el$58.nextSibling),
|
|
903
|
+
_el$55 = _el$59.nextSibling,
|
|
904
|
+
_el$56 = _el$55.nextSibling,
|
|
905
|
+
_el$60 = _el$56.nextSibling,
|
|
906
|
+
[_el$61, _co$12] = _$getNextMarker(_el$60.nextSibling);
|
|
907
|
+
_$insert(_el$54, _$createComponent(FileTypeIcon, {
|
|
908
|
+
get name() {
|
|
909
|
+
return props.item.file?.path ?? props.item.name;
|
|
910
|
+
},
|
|
911
|
+
size: "lg"
|
|
912
|
+
}), _el$59, _co$11);
|
|
913
|
+
_$insert(_el$55, () => t().noPreview);
|
|
914
|
+
_$insert(_el$56, (() => {
|
|
915
|
+
var _c$4 = _$memo(() => !!downloadable());
|
|
916
|
+
return () => _c$4() ? t().noPreviewHint : props.item.meta;
|
|
917
|
+
})());
|
|
918
|
+
_$insert(_el$54, _$createComponent(Show, {
|
|
919
|
+
get when() {
|
|
920
|
+
return downloadable();
|
|
921
|
+
},
|
|
922
|
+
get children() {
|
|
923
|
+
var _el$57 = _$getNextElement(_tmpl$14);
|
|
924
|
+
_$insert(_el$57, () => download("primary"));
|
|
925
|
+
return _el$57;
|
|
926
|
+
}
|
|
927
|
+
}), _el$61, _co$12);
|
|
928
|
+
return _el$54;
|
|
929
|
+
}
|
|
930
|
+
})];
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
}), _el$67, _co$15);
|
|
935
|
+
_$effect(() => _$setAttribute(_el$38, "data-state", state()));
|
|
936
|
+
return _el$38;
|
|
937
|
+
})();
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/** A picture fitted to the stage; zoomed in, it follows the pointer while dragged. */
|
|
941
|
+
function LightboxImage(props) {
|
|
942
|
+
const [pan, setPan] = createSignal({
|
|
943
|
+
x: 0,
|
|
944
|
+
y: 0
|
|
945
|
+
});
|
|
946
|
+
const [dragging, setDragging] = createSignal(false);
|
|
947
|
+
createEffect(on(props.zoom, value => {
|
|
948
|
+
if (value <= 1) setPan({
|
|
949
|
+
x: 0,
|
|
950
|
+
y: 0
|
|
951
|
+
});
|
|
952
|
+
}));
|
|
953
|
+
let start = null;
|
|
954
|
+
return (() => {
|
|
955
|
+
var _el$73 = _$getNextElement(_tmpl$19);
|
|
956
|
+
_el$73.addEventListener("pointercancel", () => {
|
|
957
|
+
start = null;
|
|
958
|
+
setDragging(false);
|
|
959
|
+
});
|
|
960
|
+
_el$73.$$pointerup = () => {
|
|
961
|
+
start = null;
|
|
962
|
+
setDragging(false);
|
|
963
|
+
};
|
|
964
|
+
_el$73.$$pointermove = event => {
|
|
965
|
+
if (!start) return;
|
|
966
|
+
setPan({
|
|
967
|
+
x: start.panX + event.clientX - start.x,
|
|
968
|
+
y: start.panY + event.clientY - start.y
|
|
969
|
+
});
|
|
970
|
+
};
|
|
971
|
+
_el$73.$$pointerdown = event => {
|
|
972
|
+
if (props.zoom() <= 1) return;
|
|
973
|
+
event.preventDefault();
|
|
974
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
975
|
+
start = {
|
|
976
|
+
x: event.clientX,
|
|
977
|
+
y: event.clientY,
|
|
978
|
+
panX: pan().x,
|
|
979
|
+
panY: pan().y
|
|
980
|
+
};
|
|
981
|
+
setDragging(true);
|
|
982
|
+
};
|
|
983
|
+
_$addEventListener(_el$73, "error", props.onError);
|
|
984
|
+
_$addEventListener(_el$73, "load", props.onReady);
|
|
985
|
+
_$setAttribute(_el$73, "draggable", false);
|
|
358
986
|
_$effect(_p$ => {
|
|
359
|
-
var _v$
|
|
360
|
-
_v$
|
|
361
|
-
|
|
362
|
-
|
|
987
|
+
var _v$13 = props.src,
|
|
988
|
+
_v$14 = props.name,
|
|
989
|
+
_v$15 = dragging() ? "" : undefined,
|
|
990
|
+
_v$16 = `translate(${pan().x}px, ${pan().y}px) scale(${props.zoom()})`;
|
|
991
|
+
_v$13 !== _p$.e && _$setAttribute(_el$73, "src", _p$.e = _v$13);
|
|
992
|
+
_v$14 !== _p$.t && _$setAttribute(_el$73, "alt", _p$.t = _v$14);
|
|
993
|
+
_v$15 !== _p$.a && _$setAttribute(_el$73, "data-dragging", _p$.a = _v$15);
|
|
994
|
+
_v$16 !== _p$.o && _$setStyleProperty(_el$73, "transform", _p$.o = _v$16);
|
|
363
995
|
return _p$;
|
|
364
996
|
}, {
|
|
365
997
|
e: undefined,
|
|
366
|
-
t: undefined
|
|
998
|
+
t: undefined,
|
|
999
|
+
a: undefined,
|
|
1000
|
+
o: undefined
|
|
367
1001
|
});
|
|
368
1002
|
_$runHydrationEvents();
|
|
369
|
-
return _el
|
|
1003
|
+
return _el$73;
|
|
370
1004
|
})();
|
|
371
1005
|
}
|
|
372
|
-
_$delegateEvents(["mousedown", "touchstart", "touchend", "click"]);
|
|
1006
|
+
_$delegateEvents(["mousedown", "touchstart", "touchmove", "touchend", "click", "pointerdown", "pointermove", "pointerup"]);
|
|
373
1007
|
//# sourceMappingURL=Lightbox.js.map
|