@xingwangzhe/stalux 1.21.9 → 1.21.10
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/package.json
CHANGED
|
@@ -143,12 +143,21 @@ const mdSourceUrl = exportMd
|
|
|
143
143
|
let lightbox = null;
|
|
144
144
|
|
|
145
145
|
async function initLightbox() {
|
|
146
|
-
const [{ default: PhotoSwipeLightbox }, { default: PhotoSwipe }] = await Promise.all([
|
|
146
|
+
const [{ default: PhotoSwipeLightbox }, { default: PhotoSwipe }, { default: photoSwipeCss }] = await Promise.all([
|
|
147
147
|
import("photoswipe/lightbox"),
|
|
148
148
|
import("photoswipe"),
|
|
149
|
-
import("photoswipe/dist/photoswipe.css"),
|
|
149
|
+
import("photoswipe/dist/photoswipe.css?raw"),
|
|
150
150
|
]);
|
|
151
151
|
|
|
152
|
+
// `?raw` keeps Astro from extracting a static stylesheet link.
|
|
153
|
+
// Inject it only after the first gallery interaction.
|
|
154
|
+
if (!document.querySelector("style[data-photoswipe]") && photoSwipeCss) {
|
|
155
|
+
const style = document.createElement("style");
|
|
156
|
+
style.dataset.photoswipe = "true";
|
|
157
|
+
style.textContent = photoSwipeCss;
|
|
158
|
+
document.head.appendChild(style);
|
|
159
|
+
}
|
|
160
|
+
|
|
152
161
|
// 销毁旧实例(View Transition 导航后,旧 DOM 已移除,需安全销毁)
|
|
153
162
|
if (lightbox) {
|
|
154
163
|
try {
|