yefeme 0.8.6 → 0.8.7
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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/_includes/light-box.html +2 -16
- data/assets/lightbox.js +2 -96
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c7317716ec9a0aebf898f16c054534d4d1600bdc9965e5c2876fdee545461ea
|
|
4
|
+
data.tar.gz: 43baa2e2347b94d9fe6cd6db04ce537faa7dfc2b8ac7074d99edf0cd6a4b4af2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 398591c9a678dd1269ff117014dc7cfab2616cb66c7a09db706ebe4978365dfdb129a45201eaffcf55703edc94c12842b54c5f72298d948170c057cef8569816
|
|
7
|
+
data.tar.gz: c3364c44ad14960d18d85c64d6c7ee7bbc2734b83701295d7edb2ee7af6acf28788b9f9cee2e7d1aabf1d328c76e4f92ca6432ceb81d4a37a40ca7fe66477e58
|
data/README.md
CHANGED
|
@@ -77,7 +77,7 @@ images:
|
|
|
77
77
|
---
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
The theme decodes each BlurHash in the browser and displays it as an immediate placeholder behind the full thumbnail. Selecting a thumbnail opens the shoot in a full-screen lightbox with button, keyboard,
|
|
80
|
+
The theme decodes each BlurHash in the browser and displays it as an immediate placeholder behind the full thumbnail. Selecting a thumbnail opens the shoot in a full-screen lightbox with button, keyboard, horizontal swipe, and native pinch-to-zoom navigation. Scalar image IDs remain supported for existing sites, but do not provide intrinsic sizing or placeholder information.
|
|
81
81
|
|
|
82
82
|
## Contributing
|
|
83
83
|
|
data/_includes/light-box.html
CHANGED
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
opacity: var(--resolution-opacity, 1);
|
|
107
107
|
position: absolute;
|
|
108
108
|
top: 50%;
|
|
109
|
-
touch-action:
|
|
109
|
+
touch-action: manipulation;
|
|
110
110
|
transform: translate(-50%, calc(-50% - 1.5rem));
|
|
111
111
|
transition: opacity 0.3s ease;
|
|
112
112
|
user-select: none;
|
|
@@ -122,16 +122,6 @@
|
|
|
122
122
|
--resolution-opacity: 1;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
.slide img.dragging {
|
|
126
|
-
opacity: calc(var(--resolution-opacity, 1) * var(--drag-opacity, 1));
|
|
127
|
-
transform: translate(-50%, calc(-50% - 1.5rem)) translateY(var(--drag-y, 0));
|
|
128
|
-
transition: none;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.slide img.dismissing {
|
|
132
|
-
transition: opacity 0.2s ease-out, transform 0.2s ease-out;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
125
|
.status {
|
|
136
126
|
clip: rect(0 0 0 0);
|
|
137
127
|
clip-path: inset(50%);
|
|
@@ -155,10 +145,6 @@
|
|
|
155
145
|
max-width: calc(98dvw - 6rem);
|
|
156
146
|
transform: translate(-50%, -50%);
|
|
157
147
|
}
|
|
158
|
-
|
|
159
|
-
.slide img.dragging {
|
|
160
|
-
transform: translate(-50%, -50%) translateY(var(--drag-y, 0));
|
|
161
|
-
}
|
|
162
148
|
}
|
|
163
149
|
|
|
164
150
|
@media (prefers-color-scheme: dark) {
|
|
@@ -178,7 +164,7 @@
|
|
|
178
164
|
|
|
179
165
|
@media (prefers-reduced-motion: reduce) {
|
|
180
166
|
.modal,
|
|
181
|
-
.slide img
|
|
167
|
+
.slide img {
|
|
182
168
|
transition: none;
|
|
183
169
|
}
|
|
184
170
|
}
|
data/assets/lightbox.js
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
if (!window.customElements || window.customElements.get("shoot-lightbox")) return;
|
|
5
5
|
|
|
6
|
-
var VERTICAL_DRAG_DISTANCE = 10;
|
|
7
|
-
|
|
8
6
|
function getImage(photo) {
|
|
9
7
|
return photo.querySelector("img");
|
|
10
8
|
}
|
|
@@ -51,7 +49,7 @@
|
|
|
51
49
|
image.loading = "eager";
|
|
52
50
|
image.decoding = "async";
|
|
53
51
|
image.draggable = false;
|
|
54
|
-
|
|
52
|
+
image.addEventListener("click", (event) => event.stopPropagation());
|
|
55
53
|
|
|
56
54
|
slide.appendChild(image);
|
|
57
55
|
this.track.appendChild(slide);
|
|
@@ -60,14 +58,6 @@
|
|
|
60
58
|
this.slides = Array.from(this.track.querySelectorAll(".slide"));
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
bindImageEvents(image) {
|
|
64
|
-
image.addEventListener("click", (event) => event.stopPropagation());
|
|
65
|
-
image.addEventListener("touchstart", this.startTouch, { passive: true });
|
|
66
|
-
image.addEventListener("touchmove", this.dragVertically, { passive: false });
|
|
67
|
-
image.addEventListener("touchend", this.endTouch);
|
|
68
|
-
image.addEventListener("touchcancel", this.resetGesture);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
61
|
loadHighResolutionImage(slide, photo) {
|
|
72
62
|
if (!slide || !photo.href || slide.dataset.highResolutionRequested) return;
|
|
73
63
|
|
|
@@ -90,7 +80,7 @@
|
|
|
90
80
|
image.loading = "eager";
|
|
91
81
|
image.decoding = "async";
|
|
92
82
|
image.draggable = false;
|
|
93
|
-
|
|
83
|
+
image.addEventListener("click", (event) => event.stopPropagation());
|
|
94
84
|
|
|
95
85
|
var reveal = () => {
|
|
96
86
|
if (revealed) return;
|
|
@@ -150,7 +140,6 @@
|
|
|
150
140
|
this.modal.classList.add("hidden");
|
|
151
141
|
this.modal.setAttribute("aria-hidden", "true");
|
|
152
142
|
document.documentElement.classList.remove("lightbox-open");
|
|
153
|
-
this.resetGesture();
|
|
154
143
|
|
|
155
144
|
if (this.previouslyFocused) this.previouslyFocused.focus({ preventScroll: true });
|
|
156
145
|
};
|
|
@@ -216,89 +205,6 @@
|
|
|
216
205
|
if (this.modal.classList.contains("hidden")) return;
|
|
217
206
|
this.updateCurrentPhoto(this.currentPhoto, "auto");
|
|
218
207
|
};
|
|
219
|
-
|
|
220
|
-
startTouch = (event) => {
|
|
221
|
-
if (event.touches.length !== 1) return;
|
|
222
|
-
|
|
223
|
-
this.touchStartX = event.touches[0].clientX;
|
|
224
|
-
this.touchStartY = event.touches[0].clientY;
|
|
225
|
-
this.gestureDirection = "undecided";
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
dragVertically = (event) => {
|
|
229
|
-
if (event.touches.length !== 1 || this.gestureDirection === "horizontal") return;
|
|
230
|
-
|
|
231
|
-
var deltaX = Math.abs(event.touches[0].clientX - this.touchStartX);
|
|
232
|
-
var deltaY = Math.abs(event.touches[0].clientY - this.touchStartY);
|
|
233
|
-
|
|
234
|
-
if (this.gestureDirection === "undecided") {
|
|
235
|
-
if (deltaX < VERTICAL_DRAG_DISTANCE && deltaY < VERTICAL_DRAG_DISTANCE) return;
|
|
236
|
-
this.gestureDirection = deltaX > deltaY ? "horizontal" : "vertical";
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
if (this.gestureDirection !== "vertical") return;
|
|
240
|
-
|
|
241
|
-
event.preventDefault();
|
|
242
|
-
this.track.style.scrollSnapType = "none";
|
|
243
|
-
this.track.style.overflowX = "hidden";
|
|
244
|
-
this.applyVerticalDrag(event.touches[0].clientY - this.touchStartY);
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
applyVerticalDrag(distance) {
|
|
248
|
-
var images = this.currentImages();
|
|
249
|
-
if (!images.length) return;
|
|
250
|
-
|
|
251
|
-
var maxDrag = window.innerHeight * 0.5;
|
|
252
|
-
var opacity = Math.max(0, Math.min(1, 1 - Math.abs(distance) / maxDrag));
|
|
253
|
-
|
|
254
|
-
images.forEach((image) => {
|
|
255
|
-
image.classList.add("dragging");
|
|
256
|
-
image.style.setProperty("--drag-y", distance + "px");
|
|
257
|
-
image.style.setProperty("--drag-opacity", opacity);
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
endTouch = (event) => {
|
|
262
|
-
if (this.gestureDirection !== "vertical") return;
|
|
263
|
-
|
|
264
|
-
var distance = event.changedTouches[0].clientY - this.touchStartY;
|
|
265
|
-
var dismissDistance = Math.min(window.innerHeight * 0.3, 150);
|
|
266
|
-
|
|
267
|
-
if (Math.abs(distance) < dismissDistance) {
|
|
268
|
-
this.resetGesture();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
var images = this.currentImages();
|
|
273
|
-
if (!images.length) return;
|
|
274
|
-
|
|
275
|
-
images.forEach((image) => {
|
|
276
|
-
image.classList.add("dismissing");
|
|
277
|
-
image.style.setProperty("--drag-y", (distance > 0 ? distance + 200 : distance - 200) + "px");
|
|
278
|
-
image.style.setProperty("--drag-opacity", "0");
|
|
279
|
-
});
|
|
280
|
-
window.setTimeout(() => this.close(), 200);
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
currentImages() {
|
|
284
|
-
var slide = this.slides && this.slides[this.currentPhoto];
|
|
285
|
-
return slide ? Array.from(slide.querySelectorAll("img")) : [];
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
resetGesture = () => {
|
|
289
|
-
this.currentImages().forEach((image) => {
|
|
290
|
-
image.classList.remove("dragging", "dismissing");
|
|
291
|
-
image.style.removeProperty("--drag-y");
|
|
292
|
-
image.style.removeProperty("--drag-opacity");
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
if (this.track) {
|
|
296
|
-
this.track.style.removeProperty("scroll-snap-type");
|
|
297
|
-
this.track.style.removeProperty("overflow-x");
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
this.gestureDirection = "undecided";
|
|
301
|
-
};
|
|
302
208
|
}
|
|
303
209
|
|
|
304
210
|
window.customElements.define("shoot-lightbox", ShootLightbox);
|