kuinetic 0.2.0 → 0.2.1
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/esm/{chunk-MQSNMYRP.mjs → chunk-BN2Y4UKB.mjs} +14 -8
- package/dist/esm/effects/index.mjs +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/kuinetic.all.js +15 -9
- package/dist/kuinetic.all.min.js +1 -1
- package/dist/kuinetic.css +1 -1
- package/dist/kuinetic.js +14 -8
- package/dist/kuinetic.min.css +1 -1
- package/dist/kuinetic.min.js +1 -1
- package/package.json +6 -1
|
@@ -8160,7 +8160,8 @@ var paramsSchema = {
|
|
|
8160
8160
|
duration: { type: "time", default: "280ms", cssProperty: "--kui-lightbox-duration" },
|
|
8161
8161
|
ease: { type: "easing", default: "cubic-bezier(0.22, 1, 0.36, 1)", cssProperty: "--kui-lightbox-ease" },
|
|
8162
8162
|
loop: { type: "keyword", default: "true", cssProperty: "--kui-lightbox-loop", keywords: ["true", "false"] },
|
|
8163
|
-
aspect: { type: "keyword", default: "", cssProperty: "--kui-lightbox-aspect", keywords: ["wide", "tall", "square"] }
|
|
8163
|
+
aspect: { type: "keyword", default: "", cssProperty: "--kui-lightbox-aspect", keywords: ["wide", "tall", "square"] },
|
|
8164
|
+
caption: { type: "keyword", default: "figcaption", cssProperty: "--kui-lightbox-caption", keywords: ["figcaption", "alt", "title", "none"] }
|
|
8164
8165
|
};
|
|
8165
8166
|
function defaultTargets(el, media) {
|
|
8166
8167
|
if (el.matches("a[href]") || media === "image" && el.matches("img")) return [el];
|
|
@@ -8178,25 +8179,30 @@ function imageTrigger(target) {
|
|
|
8178
8179
|
function imageIn(trigger) {
|
|
8179
8180
|
return trigger instanceof HTMLImageElement ? trigger : trigger.querySelector("img");
|
|
8180
8181
|
}
|
|
8181
|
-
function
|
|
8182
|
+
function captionFor(trigger, image, source) {
|
|
8183
|
+
if (source === "none") return "";
|
|
8184
|
+
if (source === "alt") return image.alt;
|
|
8185
|
+
if (source === "title") return (trigger.getAttribute("title") || image.title).trim();
|
|
8186
|
+
return trigger.closest("figure")?.querySelector("figcaption")?.textContent?.trim() || image.alt;
|
|
8187
|
+
}
|
|
8188
|
+
function imageItem(trigger, captionSource) {
|
|
8182
8189
|
const image = imageIn(trigger);
|
|
8183
8190
|
if (!image) return null;
|
|
8184
8191
|
const link = trigger instanceof HTMLAnchorElement ? trigger : null;
|
|
8185
|
-
const caption = trigger.closest("figure")?.querySelector("figcaption")?.textContent?.trim();
|
|
8186
8192
|
return {
|
|
8187
8193
|
trigger,
|
|
8188
8194
|
image,
|
|
8189
8195
|
src: link?.href ?? (image.currentSrc || image.src),
|
|
8190
|
-
caption:
|
|
8196
|
+
caption: captionFor(trigger, image, captionSource)
|
|
8191
8197
|
};
|
|
8192
8198
|
}
|
|
8193
|
-
function imageItems(targets2) {
|
|
8199
|
+
function imageItems(targets2, captionSource) {
|
|
8194
8200
|
const seen = /* @__PURE__ */ new Set();
|
|
8195
8201
|
const items = [];
|
|
8196
8202
|
for (const target of targets2) {
|
|
8197
8203
|
const trigger = imageTrigger(target);
|
|
8198
8204
|
if (seen.has(trigger)) continue;
|
|
8199
|
-
const item = imageItem(trigger);
|
|
8205
|
+
const item = imageItem(trigger, captionSource);
|
|
8200
8206
|
if (!item) continue;
|
|
8201
8207
|
seen.add(trigger);
|
|
8202
8208
|
items.push(item);
|
|
@@ -8300,7 +8306,7 @@ function videoContent(link, source, options, aspect) {
|
|
|
8300
8306
|
const frame = doc.createElement("div");
|
|
8301
8307
|
frame.className = `kui-lightbox-frame kui-lightbox-frame--${aspect}`;
|
|
8302
8308
|
const poster = link.querySelector("img");
|
|
8303
|
-
const title = link.title || poster?.getAttribute("alt") || link.textContent?.trim() || "Video";
|
|
8309
|
+
const title = link.title || poster?.getAttribute("alt") || link.getAttribute("aria-label")?.trim() || link.textContent?.trim() || "Video";
|
|
8304
8310
|
if (source.kind === "file") {
|
|
8305
8311
|
const video = doc.createElement("video");
|
|
8306
8312
|
video.src = source.embedUrl;
|
|
@@ -8376,7 +8382,7 @@ function prepareLightbox(el, params, ctx) {
|
|
|
8376
8382
|
if (media === "video") {
|
|
8377
8383
|
wireVideos(found, wiring, params.text("aspect"), ctx);
|
|
8378
8384
|
} else {
|
|
8379
|
-
const items = imageItems(found);
|
|
8385
|
+
const items = imageItems(found, params.text("caption", "figcaption"));
|
|
8380
8386
|
restore = wireImages(items, wiring, params.is("loop"));
|
|
8381
8387
|
}
|
|
8382
8388
|
return continuousSetup(() => {
|