@cntrl-site/components 0.1.0-alpha.26 → 0.1.0-alpha.28
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/index.js +112 -16
- package/dist/index.mjs +112 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1645,9 +1645,15 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1645
1645
|
const isClosingRef = React.useRef(false);
|
|
1646
1646
|
const contentRef = React.useRef(null);
|
|
1647
1647
|
const animationEndHandlerRef = React.useRef(null);
|
|
1648
|
+
const appearAnimationEndHandlerRef = React.useRef(null);
|
|
1648
1649
|
const { appear, triggers, slider, thumbnail, controls, area, caption: caption2, layout } = settings.lightboxBlock;
|
|
1649
1650
|
const appearDurationMs = appear.duration ? parseInt(appear.duration) : 300;
|
|
1650
1651
|
const handleClose = React.useCallback(() => {
|
|
1652
|
+
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
1653
|
+
const colorAlpha = getColorAlpha(area.color);
|
|
1654
|
+
if (isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1655
|
+
document.body.style.backgroundColor = "";
|
|
1656
|
+
}
|
|
1651
1657
|
setIsClosing(true);
|
|
1652
1658
|
isClosingRef.current = true;
|
|
1653
1659
|
const handleAnimationEnd = (e) => {
|
|
@@ -1664,7 +1670,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1664
1670
|
animationEndHandlerRef.current = handleAnimationEnd;
|
|
1665
1671
|
contentRef.current.addEventListener("animationend", handleAnimationEnd);
|
|
1666
1672
|
}
|
|
1667
|
-
}, [onClose, appearDurationMs]);
|
|
1673
|
+
}, [onClose, appearDurationMs, area.color, isEditor]);
|
|
1668
1674
|
const handleBackdropClick = (e) => {
|
|
1669
1675
|
if (!closeOnBackdropClick) return;
|
|
1670
1676
|
if (e.target === e.currentTarget) {
|
|
@@ -1672,8 +1678,52 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1672
1678
|
}
|
|
1673
1679
|
};
|
|
1674
1680
|
const handleImageWrapperClick = (e) => {
|
|
1681
|
+
var _a, _b;
|
|
1675
1682
|
if (!closeOnBackdropClick) return;
|
|
1676
|
-
|
|
1683
|
+
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1684
|
+
if (!rect) {
|
|
1685
|
+
if (e.target === e.currentTarget) {
|
|
1686
|
+
handleClose();
|
|
1687
|
+
}
|
|
1688
|
+
return;
|
|
1689
|
+
}
|
|
1690
|
+
let clientX;
|
|
1691
|
+
let clientY;
|
|
1692
|
+
if ("changedTouches" in e && e.changedTouches.length > 0) {
|
|
1693
|
+
clientX = e.changedTouches[0].clientX;
|
|
1694
|
+
clientY = e.changedTouches[0].clientY;
|
|
1695
|
+
} else if ("clientX" in e) {
|
|
1696
|
+
clientX = e.clientX;
|
|
1697
|
+
clientY = e.clientY;
|
|
1698
|
+
} else {
|
|
1699
|
+
return;
|
|
1700
|
+
}
|
|
1701
|
+
const inside = clientX >= rect.x && clientX <= rect.x + rect.width && clientY >= rect.y && clientY <= rect.y + rect.height;
|
|
1702
|
+
if (inside) {
|
|
1703
|
+
if (triggers.type === "click" && triggers.switch === "image") {
|
|
1704
|
+
if (triggers.repeat === "close" && currentIndex === content.length - 1) {
|
|
1705
|
+
handleClose();
|
|
1706
|
+
} else {
|
|
1707
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
|
|
1708
|
+
}
|
|
1709
|
+
} else if (triggers.type === "click" && triggers.switch === "50/50") {
|
|
1710
|
+
const img2 = imageRef.current;
|
|
1711
|
+
if (img2) {
|
|
1712
|
+
const imgRect = img2.getBoundingClientRect();
|
|
1713
|
+
const clickX = clientX - imgRect.left;
|
|
1714
|
+
const clickY = clientY - imgRect.top;
|
|
1715
|
+
const imgWidth = imgRect.width;
|
|
1716
|
+
const imgHeight = imgRect.height;
|
|
1717
|
+
let dir;
|
|
1718
|
+
if (slider.direction === "horiz") {
|
|
1719
|
+
dir = clickX < imgWidth / 2 ? "-1" : "+1";
|
|
1720
|
+
} else {
|
|
1721
|
+
dir = clickY < imgHeight / 2 ? "-1" : "+1";
|
|
1722
|
+
}
|
|
1723
|
+
(_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
} else {
|
|
1677
1727
|
handleClose();
|
|
1678
1728
|
}
|
|
1679
1729
|
};
|
|
@@ -1764,19 +1814,33 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1764
1814
|
const originalOverflow = document.body.style.overflow;
|
|
1765
1815
|
document.body.style.overflow = "hidden";
|
|
1766
1816
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
1767
|
-
|
|
1768
|
-
|
|
1817
|
+
const colorAlpha = getColorAlpha(area.color);
|
|
1818
|
+
const handleAppearAnimationEnd = (e) => {
|
|
1819
|
+
if (e.target === contentRef.current && !isClosingRef.current && e.animationName) {
|
|
1820
|
+
if (isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1821
|
+
document.body.style.backgroundColor = area.color;
|
|
1822
|
+
}
|
|
1823
|
+
if (contentRef.current && appearAnimationEndHandlerRef.current) {
|
|
1824
|
+
contentRef.current.removeEventListener("animationend", appearAnimationEndHandlerRef.current);
|
|
1825
|
+
}
|
|
1826
|
+
appearAnimationEndHandlerRef.current = null;
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
if (contentRef.current && isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1830
|
+
appearAnimationEndHandlerRef.current = handleAppearAnimationEnd;
|
|
1831
|
+
contentRef.current.addEventListener("animationend", handleAppearAnimationEnd);
|
|
1769
1832
|
}
|
|
1770
1833
|
const preventScroll = (e) => e.preventDefault();
|
|
1771
1834
|
document.addEventListener("touchmove", preventScroll, { passive: false });
|
|
1772
1835
|
return () => {
|
|
1773
1836
|
document.body.style.overflow = originalOverflow;
|
|
1774
1837
|
document.removeEventListener("touchmove", preventScroll);
|
|
1775
|
-
if (
|
|
1776
|
-
|
|
1838
|
+
if (contentRef.current && appearAnimationEndHandlerRef.current) {
|
|
1839
|
+
contentRef.current.removeEventListener("animationend", appearAnimationEndHandlerRef.current);
|
|
1840
|
+
appearAnimationEndHandlerRef.current = null;
|
|
1777
1841
|
}
|
|
1778
1842
|
};
|
|
1779
|
-
}, [isOpen]);
|
|
1843
|
+
}, [isOpen, area.color, isEditor]);
|
|
1780
1844
|
const handleArrowClick = (dir) => {
|
|
1781
1845
|
var _a;
|
|
1782
1846
|
(_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
|
|
@@ -1863,6 +1927,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1863
1927
|
}
|
|
1864
1928
|
if (e.touches.length === 0 && e.changedTouches.length > 0) {
|
|
1865
1929
|
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1930
|
+
console.log("rect", rect);
|
|
1866
1931
|
if (!rect) return;
|
|
1867
1932
|
const touch = e.changedTouches[0];
|
|
1868
1933
|
const inside = touch.clientX >= rect.x && touch.clientX <= rect.x + rect.width && touch.clientY >= rect.y && touch.clientY <= rect.y + rect.height;
|
|
@@ -1926,8 +1991,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1926
1991
|
animationTimingFunction: "ease",
|
|
1927
1992
|
animationFillMode: "both",
|
|
1928
1993
|
...appear.type === "mix" && !isClosing && { animationDelay: `${backdropDurationMs / 2}ms` },
|
|
1929
|
-
...appear.type === "mix" && isClosing && { animationDelay: "0ms" }
|
|
1930
|
-
"--splide-speed": slider.duration || "500ms"
|
|
1994
|
+
...appear.type === "mix" && isClosing && { animationDelay: "0ms" }
|
|
1931
1995
|
},
|
|
1932
1996
|
children: [
|
|
1933
1997
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1970,7 +2034,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1970
2034
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1971
2035
|
"img",
|
|
1972
2036
|
{
|
|
1973
|
-
ref: imageRef,
|
|
2037
|
+
ref: index === currentIndex ? imageRef : null,
|
|
1974
2038
|
className: cn(styles.imageStyle, {
|
|
1975
2039
|
[styles.contain]: item.image.objectFit === "contain",
|
|
1976
2040
|
[styles.cover]: item.image.objectFit === "cover",
|
|
@@ -1978,8 +2042,13 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1978
2042
|
}),
|
|
1979
2043
|
src: item.image.url,
|
|
1980
2044
|
alt: item.image.name ?? "",
|
|
1981
|
-
onClick: onImageClick,
|
|
1982
|
-
style:
|
|
2045
|
+
onClick: item.image.objectFit !== "contain" ? onImageClick : void 0,
|
|
2046
|
+
style: {
|
|
2047
|
+
...imageStyle2,
|
|
2048
|
+
...item.image.objectFit === "contain" ? {
|
|
2049
|
+
pointerEvents: "none"
|
|
2050
|
+
} : {}
|
|
2051
|
+
}
|
|
1983
2052
|
}
|
|
1984
2053
|
)
|
|
1985
2054
|
}
|
|
@@ -2169,6 +2238,25 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
2169
2238
|
document.getElementById(portalId)
|
|
2170
2239
|
);
|
|
2171
2240
|
};
|
|
2241
|
+
const getColorAlpha = (color) => {
|
|
2242
|
+
const rgbaMatch = color.match(/rgba?\(([^)]+)\)/);
|
|
2243
|
+
if (rgbaMatch) {
|
|
2244
|
+
const values = rgbaMatch[1].split(",").map((v) => parseFloat(v.trim()));
|
|
2245
|
+
if (values.length === 4) {
|
|
2246
|
+
return values[3];
|
|
2247
|
+
}
|
|
2248
|
+
return 1;
|
|
2249
|
+
}
|
|
2250
|
+
const hexMatch = color.match(/^#([0-9a-fA-F]{8})$/);
|
|
2251
|
+
if (hexMatch) {
|
|
2252
|
+
const alphaHex = hexMatch[1].substring(6, 8);
|
|
2253
|
+
return parseInt(alphaHex, 16) / 255;
|
|
2254
|
+
}
|
|
2255
|
+
if (color.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/)) {
|
|
2256
|
+
return 1;
|
|
2257
|
+
}
|
|
2258
|
+
return 1;
|
|
2259
|
+
};
|
|
2172
2260
|
const LightboxComponent = {
|
|
2173
2261
|
element: LightboxGallery,
|
|
2174
2262
|
id: "lightbox",
|
|
@@ -2507,15 +2595,23 @@ const LightboxComponent = {
|
|
|
2507
2595
|
},
|
|
2508
2596
|
properties: {
|
|
2509
2597
|
top: {
|
|
2598
|
+
min: 0,
|
|
2599
|
+
step: 1,
|
|
2510
2600
|
type: "number"
|
|
2511
2601
|
},
|
|
2512
2602
|
left: {
|
|
2603
|
+
min: 0,
|
|
2604
|
+
step: 1,
|
|
2513
2605
|
type: "number"
|
|
2514
2606
|
},
|
|
2515
2607
|
right: {
|
|
2608
|
+
min: 0,
|
|
2609
|
+
step: 1,
|
|
2516
2610
|
type: "number"
|
|
2517
2611
|
},
|
|
2518
2612
|
bottom: {
|
|
2613
|
+
min: 0,
|
|
2614
|
+
step: 1,
|
|
2519
2615
|
type: "number"
|
|
2520
2616
|
}
|
|
2521
2617
|
}
|
|
@@ -2757,8 +2853,8 @@ const LightboxComponent = {
|
|
|
2757
2853
|
align: "center",
|
|
2758
2854
|
triggers: "clk",
|
|
2759
2855
|
grid: {
|
|
2760
|
-
height: 0.
|
|
2761
|
-
width: 0.
|
|
2856
|
+
height: 0.04,
|
|
2857
|
+
width: 0.04,
|
|
2762
2858
|
gap: 8e-3
|
|
2763
2859
|
},
|
|
2764
2860
|
offset: { x: 0, y: 0 },
|
|
@@ -2771,7 +2867,7 @@ const LightboxComponent = {
|
|
|
2771
2867
|
layout: {
|
|
2772
2868
|
position: "middle-center",
|
|
2773
2869
|
offset: { x: 0, y: 0 },
|
|
2774
|
-
padding: { top: 0, right: 0, bottom: 0, left: 0 }
|
|
2870
|
+
padding: { top: 0.04, right: 0, bottom: 0.04, left: 0 }
|
|
2775
2871
|
},
|
|
2776
2872
|
controls: {
|
|
2777
2873
|
isActive: true,
|
|
@@ -2782,7 +2878,7 @@ const LightboxComponent = {
|
|
|
2782
2878
|
hover: "#cccccc"
|
|
2783
2879
|
},
|
|
2784
2880
|
area: {
|
|
2785
|
-
color: "rgba(64,67,71,0.
|
|
2881
|
+
color: "rgba(64,67,71,0.9)",
|
|
2786
2882
|
blur: 0,
|
|
2787
2883
|
closeIconUrl: null,
|
|
2788
2884
|
closeIconAlign: "top-right",
|
package/dist/index.mjs
CHANGED
|
@@ -1643,9 +1643,15 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1643
1643
|
const isClosingRef = useRef(false);
|
|
1644
1644
|
const contentRef = useRef(null);
|
|
1645
1645
|
const animationEndHandlerRef = useRef(null);
|
|
1646
|
+
const appearAnimationEndHandlerRef = useRef(null);
|
|
1646
1647
|
const { appear, triggers, slider, thumbnail, controls, area, caption: caption2, layout } = settings.lightboxBlock;
|
|
1647
1648
|
const appearDurationMs = appear.duration ? parseInt(appear.duration) : 300;
|
|
1648
1649
|
const handleClose = useCallback(() => {
|
|
1650
|
+
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
1651
|
+
const colorAlpha = getColorAlpha(area.color);
|
|
1652
|
+
if (isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1653
|
+
document.body.style.backgroundColor = "";
|
|
1654
|
+
}
|
|
1649
1655
|
setIsClosing(true);
|
|
1650
1656
|
isClosingRef.current = true;
|
|
1651
1657
|
const handleAnimationEnd = (e) => {
|
|
@@ -1662,7 +1668,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1662
1668
|
animationEndHandlerRef.current = handleAnimationEnd;
|
|
1663
1669
|
contentRef.current.addEventListener("animationend", handleAnimationEnd);
|
|
1664
1670
|
}
|
|
1665
|
-
}, [onClose, appearDurationMs]);
|
|
1671
|
+
}, [onClose, appearDurationMs, area.color, isEditor]);
|
|
1666
1672
|
const handleBackdropClick = (e) => {
|
|
1667
1673
|
if (!closeOnBackdropClick) return;
|
|
1668
1674
|
if (e.target === e.currentTarget) {
|
|
@@ -1670,8 +1676,52 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1670
1676
|
}
|
|
1671
1677
|
};
|
|
1672
1678
|
const handleImageWrapperClick = (e) => {
|
|
1679
|
+
var _a, _b;
|
|
1673
1680
|
if (!closeOnBackdropClick) return;
|
|
1674
|
-
|
|
1681
|
+
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1682
|
+
if (!rect) {
|
|
1683
|
+
if (e.target === e.currentTarget) {
|
|
1684
|
+
handleClose();
|
|
1685
|
+
}
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
let clientX;
|
|
1689
|
+
let clientY;
|
|
1690
|
+
if ("changedTouches" in e && e.changedTouches.length > 0) {
|
|
1691
|
+
clientX = e.changedTouches[0].clientX;
|
|
1692
|
+
clientY = e.changedTouches[0].clientY;
|
|
1693
|
+
} else if ("clientX" in e) {
|
|
1694
|
+
clientX = e.clientX;
|
|
1695
|
+
clientY = e.clientY;
|
|
1696
|
+
} else {
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
const inside = clientX >= rect.x && clientX <= rect.x + rect.width && clientY >= rect.y && clientY <= rect.y + rect.height;
|
|
1700
|
+
if (inside) {
|
|
1701
|
+
if (triggers.type === "click" && triggers.switch === "image") {
|
|
1702
|
+
if (triggers.repeat === "close" && currentIndex === content.length - 1) {
|
|
1703
|
+
handleClose();
|
|
1704
|
+
} else {
|
|
1705
|
+
(_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
|
|
1706
|
+
}
|
|
1707
|
+
} else if (triggers.type === "click" && triggers.switch === "50/50") {
|
|
1708
|
+
const img2 = imageRef.current;
|
|
1709
|
+
if (img2) {
|
|
1710
|
+
const imgRect = img2.getBoundingClientRect();
|
|
1711
|
+
const clickX = clientX - imgRect.left;
|
|
1712
|
+
const clickY = clientY - imgRect.top;
|
|
1713
|
+
const imgWidth = imgRect.width;
|
|
1714
|
+
const imgHeight = imgRect.height;
|
|
1715
|
+
let dir;
|
|
1716
|
+
if (slider.direction === "horiz") {
|
|
1717
|
+
dir = clickX < imgWidth / 2 ? "-1" : "+1";
|
|
1718
|
+
} else {
|
|
1719
|
+
dir = clickY < imgHeight / 2 ? "-1" : "+1";
|
|
1720
|
+
}
|
|
1721
|
+
(_b = lightboxRef.current) == null ? void 0 : _b.go(dir);
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
} else {
|
|
1675
1725
|
handleClose();
|
|
1676
1726
|
}
|
|
1677
1727
|
};
|
|
@@ -1762,19 +1812,33 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1762
1812
|
const originalOverflow = document.body.style.overflow;
|
|
1763
1813
|
document.body.style.overflow = "hidden";
|
|
1764
1814
|
const isMobile = window.matchMedia("(max-width: 768px)").matches;
|
|
1765
|
-
|
|
1766
|
-
|
|
1815
|
+
const colorAlpha = getColorAlpha(area.color);
|
|
1816
|
+
const handleAppearAnimationEnd = (e) => {
|
|
1817
|
+
if (e.target === contentRef.current && !isClosingRef.current && e.animationName) {
|
|
1818
|
+
if (isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1819
|
+
document.body.style.backgroundColor = area.color;
|
|
1820
|
+
}
|
|
1821
|
+
if (contentRef.current && appearAnimationEndHandlerRef.current) {
|
|
1822
|
+
contentRef.current.removeEventListener("animationend", appearAnimationEndHandlerRef.current);
|
|
1823
|
+
}
|
|
1824
|
+
appearAnimationEndHandlerRef.current = null;
|
|
1825
|
+
}
|
|
1826
|
+
};
|
|
1827
|
+
if (contentRef.current && isMobile && !isEditor && colorAlpha > 0.9) {
|
|
1828
|
+
appearAnimationEndHandlerRef.current = handleAppearAnimationEnd;
|
|
1829
|
+
contentRef.current.addEventListener("animationend", handleAppearAnimationEnd);
|
|
1767
1830
|
}
|
|
1768
1831
|
const preventScroll = (e) => e.preventDefault();
|
|
1769
1832
|
document.addEventListener("touchmove", preventScroll, { passive: false });
|
|
1770
1833
|
return () => {
|
|
1771
1834
|
document.body.style.overflow = originalOverflow;
|
|
1772
1835
|
document.removeEventListener("touchmove", preventScroll);
|
|
1773
|
-
if (
|
|
1774
|
-
|
|
1836
|
+
if (contentRef.current && appearAnimationEndHandlerRef.current) {
|
|
1837
|
+
contentRef.current.removeEventListener("animationend", appearAnimationEndHandlerRef.current);
|
|
1838
|
+
appearAnimationEndHandlerRef.current = null;
|
|
1775
1839
|
}
|
|
1776
1840
|
};
|
|
1777
|
-
}, [isOpen]);
|
|
1841
|
+
}, [isOpen, area.color, isEditor]);
|
|
1778
1842
|
const handleArrowClick = (dir) => {
|
|
1779
1843
|
var _a;
|
|
1780
1844
|
(_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
|
|
@@ -1861,6 +1925,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1861
1925
|
}
|
|
1862
1926
|
if (e.touches.length === 0 && e.changedTouches.length > 0) {
|
|
1863
1927
|
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1928
|
+
console.log("rect", rect);
|
|
1864
1929
|
if (!rect) return;
|
|
1865
1930
|
const touch = e.changedTouches[0];
|
|
1866
1931
|
const inside = touch.clientX >= rect.x && touch.clientX <= rect.x + rect.width && touch.clientY >= rect.y && touch.clientY <= rect.y + rect.height;
|
|
@@ -1924,8 +1989,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1924
1989
|
animationTimingFunction: "ease",
|
|
1925
1990
|
animationFillMode: "both",
|
|
1926
1991
|
...appear.type === "mix" && !isClosing && { animationDelay: `${backdropDurationMs / 2}ms` },
|
|
1927
|
-
...appear.type === "mix" && isClosing && { animationDelay: "0ms" }
|
|
1928
|
-
"--splide-speed": slider.duration || "500ms"
|
|
1992
|
+
...appear.type === "mix" && isClosing && { animationDelay: "0ms" }
|
|
1929
1993
|
},
|
|
1930
1994
|
children: [
|
|
1931
1995
|
/* @__PURE__ */ jsx(
|
|
@@ -1968,7 +2032,7 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1968
2032
|
children: /* @__PURE__ */ jsx(
|
|
1969
2033
|
"img",
|
|
1970
2034
|
{
|
|
1971
|
-
ref: imageRef,
|
|
2035
|
+
ref: index === currentIndex ? imageRef : null,
|
|
1972
2036
|
className: cn(styles.imageStyle, {
|
|
1973
2037
|
[styles.contain]: item.image.objectFit === "contain",
|
|
1974
2038
|
[styles.cover]: item.image.objectFit === "cover",
|
|
@@ -1976,8 +2040,13 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
1976
2040
|
}),
|
|
1977
2041
|
src: item.image.url,
|
|
1978
2042
|
alt: item.image.name ?? "",
|
|
1979
|
-
onClick: onImageClick,
|
|
1980
|
-
style:
|
|
2043
|
+
onClick: item.image.objectFit !== "contain" ? onImageClick : void 0,
|
|
2044
|
+
style: {
|
|
2045
|
+
...imageStyle2,
|
|
2046
|
+
...item.image.objectFit === "contain" ? {
|
|
2047
|
+
pointerEvents: "none"
|
|
2048
|
+
} : {}
|
|
2049
|
+
}
|
|
1981
2050
|
}
|
|
1982
2051
|
)
|
|
1983
2052
|
}
|
|
@@ -2167,6 +2236,25 @@ const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings,
|
|
|
2167
2236
|
document.getElementById(portalId)
|
|
2168
2237
|
);
|
|
2169
2238
|
};
|
|
2239
|
+
const getColorAlpha = (color) => {
|
|
2240
|
+
const rgbaMatch = color.match(/rgba?\(([^)]+)\)/);
|
|
2241
|
+
if (rgbaMatch) {
|
|
2242
|
+
const values = rgbaMatch[1].split(",").map((v) => parseFloat(v.trim()));
|
|
2243
|
+
if (values.length === 4) {
|
|
2244
|
+
return values[3];
|
|
2245
|
+
}
|
|
2246
|
+
return 1;
|
|
2247
|
+
}
|
|
2248
|
+
const hexMatch = color.match(/^#([0-9a-fA-F]{8})$/);
|
|
2249
|
+
if (hexMatch) {
|
|
2250
|
+
const alphaHex = hexMatch[1].substring(6, 8);
|
|
2251
|
+
return parseInt(alphaHex, 16) / 255;
|
|
2252
|
+
}
|
|
2253
|
+
if (color.match(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/)) {
|
|
2254
|
+
return 1;
|
|
2255
|
+
}
|
|
2256
|
+
return 1;
|
|
2257
|
+
};
|
|
2170
2258
|
const LightboxComponent = {
|
|
2171
2259
|
element: LightboxGallery,
|
|
2172
2260
|
id: "lightbox",
|
|
@@ -2505,15 +2593,23 @@ const LightboxComponent = {
|
|
|
2505
2593
|
},
|
|
2506
2594
|
properties: {
|
|
2507
2595
|
top: {
|
|
2596
|
+
min: 0,
|
|
2597
|
+
step: 1,
|
|
2508
2598
|
type: "number"
|
|
2509
2599
|
},
|
|
2510
2600
|
left: {
|
|
2601
|
+
min: 0,
|
|
2602
|
+
step: 1,
|
|
2511
2603
|
type: "number"
|
|
2512
2604
|
},
|
|
2513
2605
|
right: {
|
|
2606
|
+
min: 0,
|
|
2607
|
+
step: 1,
|
|
2514
2608
|
type: "number"
|
|
2515
2609
|
},
|
|
2516
2610
|
bottom: {
|
|
2611
|
+
min: 0,
|
|
2612
|
+
step: 1,
|
|
2517
2613
|
type: "number"
|
|
2518
2614
|
}
|
|
2519
2615
|
}
|
|
@@ -2755,8 +2851,8 @@ const LightboxComponent = {
|
|
|
2755
2851
|
align: "center",
|
|
2756
2852
|
triggers: "clk",
|
|
2757
2853
|
grid: {
|
|
2758
|
-
height: 0.
|
|
2759
|
-
width: 0.
|
|
2854
|
+
height: 0.04,
|
|
2855
|
+
width: 0.04,
|
|
2760
2856
|
gap: 8e-3
|
|
2761
2857
|
},
|
|
2762
2858
|
offset: { x: 0, y: 0 },
|
|
@@ -2769,7 +2865,7 @@ const LightboxComponent = {
|
|
|
2769
2865
|
layout: {
|
|
2770
2866
|
position: "middle-center",
|
|
2771
2867
|
offset: { x: 0, y: 0 },
|
|
2772
|
-
padding: { top: 0, right: 0, bottom: 0, left: 0 }
|
|
2868
|
+
padding: { top: 0.04, right: 0, bottom: 0.04, left: 0 }
|
|
2773
2869
|
},
|
|
2774
2870
|
controls: {
|
|
2775
2871
|
isActive: true,
|
|
@@ -2780,7 +2876,7 @@ const LightboxComponent = {
|
|
|
2780
2876
|
hover: "#cccccc"
|
|
2781
2877
|
},
|
|
2782
2878
|
area: {
|
|
2783
|
-
color: "rgba(64,67,71,0.
|
|
2879
|
+
color: "rgba(64,67,71,0.9)",
|
|
2784
2880
|
blur: 0,
|
|
2785
2881
|
closeIconUrl: null,
|
|
2786
2882
|
closeIconAlign: "top-right",
|