yefeme 0.8.6 → 0.8.8
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 -97
- 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: ce7aecef49db3c9b1eb4e27cf6834cb84dd58bf97fd329254583afe478921788
|
|
4
|
+
data.tar.gz: ebae52ad026ca234f6702308a02674a6e2136b408907350f50421c814bf5d477
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 47f8597e98ed5afc30468477bc98be4c980a25dcccb2393519b96108399ee71423d41f24cec9e9334d6c4b3ae80a622827faa1e3eeb340e840419dd2fc736744
|
|
7
|
+
data.tar.gz: 4316454c2484d435fade0b412b795bbe200b38b5310b6b77d701f4676d4b0a98c42a38f411634eae4d7bdd6409714c279d18ff48d2e5e25dc070fd611ca72b0c
|
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;
|
|
@@ -121,7 +111,6 @@
|
|
|
121
111
|
this.previousButton.addEventListener("click", this.previous);
|
|
122
112
|
this.nextButton.addEventListener("click", this.next);
|
|
123
113
|
this.closeButton.addEventListener("click", this.close);
|
|
124
|
-
this.modal.addEventListener("click", this.close);
|
|
125
114
|
this.track.addEventListener("scroll", this.onScroll, { passive: true });
|
|
126
115
|
document.addEventListener("keydown", this.onKeydown);
|
|
127
116
|
window.addEventListener("resize", this.onResize, { passive: true });
|
|
@@ -150,7 +139,6 @@
|
|
|
150
139
|
this.modal.classList.add("hidden");
|
|
151
140
|
this.modal.setAttribute("aria-hidden", "true");
|
|
152
141
|
document.documentElement.classList.remove("lightbox-open");
|
|
153
|
-
this.resetGesture();
|
|
154
142
|
|
|
155
143
|
if (this.previouslyFocused) this.previouslyFocused.focus({ preventScroll: true });
|
|
156
144
|
};
|
|
@@ -216,89 +204,6 @@
|
|
|
216
204
|
if (this.modal.classList.contains("hidden")) return;
|
|
217
205
|
this.updateCurrentPhoto(this.currentPhoto, "auto");
|
|
218
206
|
};
|
|
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
207
|
}
|
|
303
208
|
|
|
304
209
|
window.customElements.define("shoot-lightbox", ShootLightbox);
|