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/kuinetic.css CHANGED
@@ -2523,7 +2523,7 @@
2523
2523
  padding-block: var(--kui-mask-bleed, 0px);
2524
2524
  margin-block: calc(-1 * var(--kui-mask-bleed, 0px));
2525
2525
  }
2526
- [data-kui-state=finished] [data-kui-split-fx] .kui-split-line {
2526
+ [data-kui-state=finished] > [data-kui-split-fx] .kui-split-line {
2527
2527
  animation-name: none;
2528
2528
  opacity: 1;
2529
2529
  clip-path: none;
package/dist/kuinetic.js CHANGED
@@ -14663,7 +14663,8 @@ var kuinetic = (() => {
14663
14663
  duration: { type: "time", default: "280ms", cssProperty: "--kui-lightbox-duration" },
14664
14664
  ease: { type: "easing", default: "cubic-bezier(0.22, 1, 0.36, 1)", cssProperty: "--kui-lightbox-ease" },
14665
14665
  loop: { type: "keyword", default: "true", cssProperty: "--kui-lightbox-loop", keywords: ["true", "false"] },
14666
- aspect: { type: "keyword", default: "", cssProperty: "--kui-lightbox-aspect", keywords: ["wide", "tall", "square"] }
14666
+ aspect: { type: "keyword", default: "", cssProperty: "--kui-lightbox-aspect", keywords: ["wide", "tall", "square"] },
14667
+ caption: { type: "keyword", default: "figcaption", cssProperty: "--kui-lightbox-caption", keywords: ["figcaption", "alt", "title", "none"] }
14667
14668
  };
14668
14669
  function defaultTargets(el, media) {
14669
14670
  if (el.matches("a[href]") || media === "image" && el.matches("img")) return [el];
@@ -14681,25 +14682,30 @@ var kuinetic = (() => {
14681
14682
  function imageIn(trigger) {
14682
14683
  return trigger instanceof HTMLImageElement ? trigger : trigger.querySelector("img");
14683
14684
  }
14684
- function imageItem(trigger) {
14685
+ function captionFor(trigger, image, source) {
14686
+ if (source === "none") return "";
14687
+ if (source === "alt") return image.alt;
14688
+ if (source === "title") return (trigger.getAttribute("title") || image.title).trim();
14689
+ return trigger.closest("figure")?.querySelector("figcaption")?.textContent?.trim() || image.alt;
14690
+ }
14691
+ function imageItem(trigger, captionSource) {
14685
14692
  const image = imageIn(trigger);
14686
14693
  if (!image) return null;
14687
14694
  const link = trigger instanceof HTMLAnchorElement ? trigger : null;
14688
- const caption = trigger.closest("figure")?.querySelector("figcaption")?.textContent?.trim();
14689
14695
  return {
14690
14696
  trigger,
14691
14697
  image,
14692
14698
  src: link?.href ?? (image.currentSrc || image.src),
14693
- caption: caption || image.alt
14699
+ caption: captionFor(trigger, image, captionSource)
14694
14700
  };
14695
14701
  }
14696
- function imageItems(targets2) {
14702
+ function imageItems(targets2, captionSource) {
14697
14703
  const seen = /* @__PURE__ */ new Set();
14698
14704
  const items = [];
14699
14705
  for (const target of targets2) {
14700
14706
  const trigger = imageTrigger(target);
14701
14707
  if (seen.has(trigger)) continue;
14702
- const item = imageItem(trigger);
14708
+ const item = imageItem(trigger, captionSource);
14703
14709
  if (!item) continue;
14704
14710
  seen.add(trigger);
14705
14711
  items.push(item);
@@ -14803,7 +14809,7 @@ var kuinetic = (() => {
14803
14809
  const frame = doc.createElement("div");
14804
14810
  frame.className = `kui-lightbox-frame kui-lightbox-frame--${aspect}`;
14805
14811
  const poster = link.querySelector("img");
14806
- const title = link.title || poster?.getAttribute("alt") || link.textContent?.trim() || "Video";
14812
+ const title = link.title || poster?.getAttribute("alt") || link.getAttribute("aria-label")?.trim() || link.textContent?.trim() || "Video";
14807
14813
  if (source.kind === "file") {
14808
14814
  const video = doc.createElement("video");
14809
14815
  video.src = source.embedUrl;
@@ -14879,7 +14885,7 @@ var kuinetic = (() => {
14879
14885
  if (media === "video") {
14880
14886
  wireVideos(found, wiring, params.text("aspect"), ctx);
14881
14887
  } else {
14882
- const items = imageItems(found);
14888
+ const items = imageItems(found, params.text("caption", "figcaption"));
14883
14889
  restore = wireImages(items, wiring, params.is("loop"));
14884
14890
  }
14885
14891
  return continuousSetup(() => {