@cntrl-site/components 0.1.0-alpha.17 → 0.1.0-alpha.19
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/Components/ControlSlider/ControlSliderComponent.d.ts +38 -0
- package/dist/Components/Lightbox/Lightbox.d.ts +28 -2
- package/dist/Components/utils/getImageRect.d.ts +6 -0
- package/dist/Components/utils/getPositionStyles.d.ts +1 -1
- package/dist/components.css +1 -1
- package/dist/index.js +267 -163
- package/dist/index.mjs +267 -163
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -565,15 +565,28 @@ const ControlSliderComponent = {
|
|
|
565
565
|
},
|
|
566
566
|
offset: {
|
|
567
567
|
type: "object",
|
|
568
|
+
title: "Offset",
|
|
568
569
|
display: {
|
|
569
|
-
type: "
|
|
570
|
+
type: "group"
|
|
570
571
|
},
|
|
571
572
|
properties: {
|
|
572
573
|
x: {
|
|
573
|
-
type: "number"
|
|
574
|
+
type: "number",
|
|
575
|
+
label: "X",
|
|
576
|
+
scalingEnabled: true,
|
|
577
|
+
display: {
|
|
578
|
+
type: "numeric-input",
|
|
579
|
+
visible: true
|
|
580
|
+
}
|
|
574
581
|
},
|
|
575
582
|
y: {
|
|
576
|
-
type: "number"
|
|
583
|
+
type: "number",
|
|
584
|
+
label: "Y",
|
|
585
|
+
scalingEnabled: true,
|
|
586
|
+
display: {
|
|
587
|
+
type: "numeric-input",
|
|
588
|
+
visible: true
|
|
589
|
+
}
|
|
577
590
|
}
|
|
578
591
|
}
|
|
579
592
|
},
|
|
@@ -626,15 +639,28 @@ const ControlSliderComponent = {
|
|
|
626
639
|
},
|
|
627
640
|
offset: {
|
|
628
641
|
type: "object",
|
|
642
|
+
title: "Offset",
|
|
629
643
|
display: {
|
|
630
|
-
type: "
|
|
644
|
+
type: "group"
|
|
631
645
|
},
|
|
632
646
|
properties: {
|
|
633
647
|
x: {
|
|
634
|
-
type: "number"
|
|
648
|
+
type: "number",
|
|
649
|
+
label: "X",
|
|
650
|
+
scalingEnabled: true,
|
|
651
|
+
display: {
|
|
652
|
+
type: "numeric-input",
|
|
653
|
+
visible: true
|
|
654
|
+
}
|
|
635
655
|
},
|
|
636
656
|
y: {
|
|
637
|
-
type: "number"
|
|
657
|
+
type: "number",
|
|
658
|
+
label: "Y",
|
|
659
|
+
scalingEnabled: true,
|
|
660
|
+
display: {
|
|
661
|
+
type: "numeric-input",
|
|
662
|
+
visible: true
|
|
663
|
+
}
|
|
638
664
|
}
|
|
639
665
|
}
|
|
640
666
|
},
|
|
@@ -690,14 +716,26 @@ const ControlSliderComponent = {
|
|
|
690
716
|
offset: {
|
|
691
717
|
type: "object",
|
|
692
718
|
display: {
|
|
693
|
-
type: "
|
|
719
|
+
type: "group"
|
|
694
720
|
},
|
|
695
721
|
properties: {
|
|
696
722
|
x: {
|
|
697
|
-
type: "number"
|
|
723
|
+
type: "number",
|
|
724
|
+
label: "X",
|
|
725
|
+
scalingEnabled: true,
|
|
726
|
+
display: {
|
|
727
|
+
type: "numeric-input",
|
|
728
|
+
visible: true
|
|
729
|
+
}
|
|
698
730
|
},
|
|
699
731
|
y: {
|
|
700
|
-
type: "number"
|
|
732
|
+
type: "number",
|
|
733
|
+
label: "Y",
|
|
734
|
+
scalingEnabled: true,
|
|
735
|
+
display: {
|
|
736
|
+
type: "numeric-input",
|
|
737
|
+
visible: true
|
|
738
|
+
}
|
|
701
739
|
}
|
|
702
740
|
}
|
|
703
741
|
},
|
|
@@ -1465,7 +1503,6 @@ const thumbsAlignStart = "Lightbox-module__thumbsAlignStart___uiFIV";
|
|
|
1465
1503
|
const thumbsAlignCenter = "Lightbox-module__thumbsAlignCenter___sbUPA";
|
|
1466
1504
|
const thumbsAlignEnd = "Lightbox-module__thumbsAlignEnd___OA9N4";
|
|
1467
1505
|
const thumbItem = "Lightbox-module__thumbItem___zROyu";
|
|
1468
|
-
const thumbImage = "Lightbox-module__thumbImage___xGakV";
|
|
1469
1506
|
const closeButton = "Lightbox-module__closeButton___r3Dur";
|
|
1470
1507
|
const fadeIn = "Lightbox-module__fadeIn___sHwRK";
|
|
1471
1508
|
const slideInLeft = "Lightbox-module__slideInLeft___P-XRo";
|
|
@@ -1496,7 +1533,6 @@ const styles = {
|
|
|
1496
1533
|
thumbsAlignCenter,
|
|
1497
1534
|
thumbsAlignEnd,
|
|
1498
1535
|
thumbItem,
|
|
1499
|
-
thumbImage,
|
|
1500
1536
|
closeButton,
|
|
1501
1537
|
fadeIn,
|
|
1502
1538
|
slideInLeft,
|
|
@@ -1505,7 +1541,7 @@ const styles = {
|
|
|
1505
1541
|
slideInBottom,
|
|
1506
1542
|
scaleSlide
|
|
1507
1543
|
};
|
|
1508
|
-
const getPositionStyles = (position, offset) => {
|
|
1544
|
+
const getPositionStyles = (position, offset, isEditor) => {
|
|
1509
1545
|
const styles2 = {};
|
|
1510
1546
|
const [vertical, horizontal] = position.split("-");
|
|
1511
1547
|
if (vertical === "top") {
|
|
@@ -1529,16 +1565,41 @@ const getPositionStyles = (position, offset) => {
|
|
|
1529
1565
|
styles2.right = "0";
|
|
1530
1566
|
}
|
|
1531
1567
|
if (vertical === "middle" && horizontal === "center") {
|
|
1532
|
-
styles2.transform = `translate(calc(-50% + ${offset.x}
|
|
1568
|
+
styles2.transform = `translate(calc(-50% + ${scalingValue(offset.x, isEditor)}), calc(-50% + ${scalingValue(offset.y, isEditor)}))`;
|
|
1533
1569
|
} else if (vertical === "middle") {
|
|
1534
|
-
styles2.transform = `translate(${offset.x}
|
|
1570
|
+
styles2.transform = `translate(${scalingValue(offset.x, isEditor)}, calc(-50% + ${scalingValue(offset.y, isEditor)}))`;
|
|
1535
1571
|
} else if (horizontal === "center") {
|
|
1536
|
-
styles2.transform = `translate(calc(-50% + ${offset.x}
|
|
1572
|
+
styles2.transform = `translate(calc(-50% + ${scalingValue(offset.x, isEditor)}), ${scalingValue(offset.y, isEditor)})`;
|
|
1537
1573
|
} else {
|
|
1538
|
-
styles2.transform = `translate(${offset.x}
|
|
1574
|
+
styles2.transform = `translate(${scalingValue(offset.x, isEditor)}, ${scalingValue(offset.y, isEditor)})`;
|
|
1539
1575
|
}
|
|
1540
1576
|
return styles2;
|
|
1541
1577
|
};
|
|
1578
|
+
function getDisplayedImageRect(img2) {
|
|
1579
|
+
const container = img2.getBoundingClientRect();
|
|
1580
|
+
const containerW = container.width;
|
|
1581
|
+
const containerH = container.height;
|
|
1582
|
+
const imgW = img2.naturalWidth;
|
|
1583
|
+
const imgH = img2.naturalHeight;
|
|
1584
|
+
const containerRatio = containerW / containerH;
|
|
1585
|
+
const imgRatio = imgW / imgH;
|
|
1586
|
+
let renderedW, renderedH;
|
|
1587
|
+
if (imgRatio > containerRatio) {
|
|
1588
|
+
renderedW = containerW;
|
|
1589
|
+
renderedH = containerW / imgRatio;
|
|
1590
|
+
} else {
|
|
1591
|
+
renderedH = containerH;
|
|
1592
|
+
renderedW = containerH * imgRatio;
|
|
1593
|
+
}
|
|
1594
|
+
const offsetX = (containerW - renderedW) / 2 + container.left;
|
|
1595
|
+
const offsetY = (containerH - renderedH) / 2 + container.top;
|
|
1596
|
+
return {
|
|
1597
|
+
x: offsetX,
|
|
1598
|
+
y: offsetY,
|
|
1599
|
+
width: renderedW,
|
|
1600
|
+
height: renderedH
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1542
1603
|
function LightboxGallery({ settings, content, styles: styles2, portalId, activeEvent, isEditor }) {
|
|
1543
1604
|
const [open, setOpen] = React.useState(false);
|
|
1544
1605
|
const { url } = settings.thumbnailBlock.cover;
|
|
@@ -1560,13 +1621,16 @@ function LightboxGallery({ settings, content, styles: styles2, portalId, activeE
|
|
|
1560
1621
|
onClick: () => setOpen(true)
|
|
1561
1622
|
}
|
|
1562
1623
|
),
|
|
1563
|
-
/* @__PURE__ */ jsxRuntime.jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, portalId, isEditor })
|
|
1624
|
+
/* @__PURE__ */ jsxRuntime.jsx(Lightbox, { isOpen: open, onClose: () => setOpen(false), content, settings, styles: styles2, portalId, isEditor })
|
|
1564
1625
|
] });
|
|
1565
1626
|
}
|
|
1566
|
-
const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
|
|
1627
|
+
const Lightbox = ({ isOpen, onClose, content, styles: lightboxStyles, settings, closeOnBackdropClick = true, closeOnEsc = true, portalId, isEditor }) => {
|
|
1628
|
+
const { widthSettings, fontSettings, letterSpacing, textAlign, wordSpacing, fontSizeLineHeight, textAppearance, color } = lightboxStyles.caption;
|
|
1567
1629
|
const [currentIndex, setCurrentIndex] = React.useState(0);
|
|
1630
|
+
const [splideKey, setSplideKey] = React.useState(0);
|
|
1568
1631
|
const lightboxRef = React.useRef(null);
|
|
1569
|
-
const
|
|
1632
|
+
const prevSliderTypeRef = React.useRef(null);
|
|
1633
|
+
const imageRef = React.useRef(null);
|
|
1570
1634
|
const { appear, triggers, slider, thumbnail, controls, area, caption: caption2, layout } = settings.lightboxBlock;
|
|
1571
1635
|
const handleBackdropClick = (e) => {
|
|
1572
1636
|
if (!closeOnBackdropClick) return;
|
|
@@ -1596,6 +1660,13 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1596
1660
|
};
|
|
1597
1661
|
const onImageClick = (e) => {
|
|
1598
1662
|
var _a, _b;
|
|
1663
|
+
const rect = imageRef.current ? getDisplayedImageRect(imageRef.current) : null;
|
|
1664
|
+
if (!rect) return;
|
|
1665
|
+
const inside = e.clientX >= rect.x && e.clientX <= rect.x + rect.width && e.clientY >= rect.y && e.clientY <= rect.y + rect.height;
|
|
1666
|
+
if (!inside) {
|
|
1667
|
+
onClose();
|
|
1668
|
+
return;
|
|
1669
|
+
}
|
|
1599
1670
|
if (triggers.type === "click" && triggers.switch === "image") {
|
|
1600
1671
|
e.stopPropagation();
|
|
1601
1672
|
(_a = lightboxRef.current) == null ? void 0 : _a.go("+1");
|
|
@@ -1603,11 +1674,11 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1603
1674
|
if (triggers.type === "click" && triggers.switch === "50/50") {
|
|
1604
1675
|
e.stopPropagation();
|
|
1605
1676
|
const img2 = e.currentTarget;
|
|
1606
|
-
const
|
|
1607
|
-
const clickX = e.clientX -
|
|
1608
|
-
const clickY = e.clientY -
|
|
1609
|
-
const imgWidth =
|
|
1610
|
-
const imgHeight =
|
|
1677
|
+
const rect2 = img2.getBoundingClientRect();
|
|
1678
|
+
const clickX = e.clientX - rect2.left;
|
|
1679
|
+
const clickY = e.clientY - rect2.top;
|
|
1680
|
+
const imgWidth = rect2.width;
|
|
1681
|
+
const imgHeight = rect2.height;
|
|
1611
1682
|
let dir;
|
|
1612
1683
|
if (slider.direction === "horiz") {
|
|
1613
1684
|
dir = clickX < imgWidth / 2 ? "-1" : "+1";
|
|
@@ -1640,6 +1711,12 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1640
1711
|
React.useEffect(() => {
|
|
1641
1712
|
if (isOpen) setCurrentIndex(0);
|
|
1642
1713
|
}, [isOpen]);
|
|
1714
|
+
React.useEffect(() => {
|
|
1715
|
+
if (prevSliderTypeRef.current !== null && prevSliderTypeRef.current !== slider.type) {
|
|
1716
|
+
setSplideKey((prev) => prev + 1);
|
|
1717
|
+
}
|
|
1718
|
+
prevSliderTypeRef.current = slider.type;
|
|
1719
|
+
}, [slider.type]);
|
|
1643
1720
|
React.useEffect(() => {
|
|
1644
1721
|
if (!isOpen) return;
|
|
1645
1722
|
const originalOverflow = document.body.style.overflow;
|
|
@@ -1653,49 +1730,6 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1653
1730
|
document.body.style.backgroundColor = "";
|
|
1654
1731
|
};
|
|
1655
1732
|
}, [isOpen]);
|
|
1656
|
-
React.useEffect(() => {
|
|
1657
|
-
if (!isOpen) return;
|
|
1658
|
-
if (resizeObserverRef.current) {
|
|
1659
|
-
resizeObserverRef.current.disconnect();
|
|
1660
|
-
resizeObserverRef.current = null;
|
|
1661
|
-
}
|
|
1662
|
-
const timeoutId = setTimeout(() => {
|
|
1663
|
-
const activeSlide = document.querySelector(".splide__slide.is-active");
|
|
1664
|
-
if (!activeSlide) return;
|
|
1665
|
-
const img2 = activeSlide.querySelector("img");
|
|
1666
|
-
const container = activeSlide.querySelector(`.${styles.imgWrapper}`);
|
|
1667
|
-
if (!img2 || !container) return;
|
|
1668
|
-
const updateImageSize = () => {
|
|
1669
|
-
if (!img2.naturalWidth || !img2.naturalHeight) return;
|
|
1670
|
-
const imageAspectRatio = img2.naturalWidth / img2.naturalHeight;
|
|
1671
|
-
const containerWidth = container.clientWidth;
|
|
1672
|
-
const containerHeight = container.clientHeight;
|
|
1673
|
-
const containerAspectRatio = containerWidth / containerHeight;
|
|
1674
|
-
if (imageAspectRatio > containerAspectRatio) {
|
|
1675
|
-
img2.style.width = "100%";
|
|
1676
|
-
} else {
|
|
1677
|
-
img2.style.height = "100%";
|
|
1678
|
-
}
|
|
1679
|
-
};
|
|
1680
|
-
if (img2.complete) {
|
|
1681
|
-
updateImageSize();
|
|
1682
|
-
} else {
|
|
1683
|
-
img2.onload = updateImageSize;
|
|
1684
|
-
}
|
|
1685
|
-
resizeObserverRef.current = new ResizeObserver(() => {
|
|
1686
|
-
updateImageSize();
|
|
1687
|
-
});
|
|
1688
|
-
resizeObserverRef.current.observe(container);
|
|
1689
|
-
resizeObserverRef.current.observe(img2);
|
|
1690
|
-
}, 0);
|
|
1691
|
-
return () => {
|
|
1692
|
-
clearTimeout(timeoutId);
|
|
1693
|
-
if (resizeObserverRef.current) {
|
|
1694
|
-
resizeObserverRef.current.disconnect();
|
|
1695
|
-
resizeObserverRef.current = null;
|
|
1696
|
-
}
|
|
1697
|
-
};
|
|
1698
|
-
}, [isOpen, currentIndex, content]);
|
|
1699
1733
|
const handleArrowClick = (dir) => {
|
|
1700
1734
|
var _a;
|
|
1701
1735
|
(_a = lightboxRef.current) == null ? void 0 : _a.go(dir);
|
|
@@ -1762,6 +1796,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1762
1796
|
style: { ...isEditor && { backgroundColor: area.color, backdropFilter: `blur(${area.blur}px)` } },
|
|
1763
1797
|
onClick: handleBackdropClick,
|
|
1764
1798
|
onTouchEnd: handleBackdropClick,
|
|
1799
|
+
onTouchStart: handleBackdropClick,
|
|
1765
1800
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1766
1801
|
"div",
|
|
1767
1802
|
{
|
|
@@ -1771,8 +1806,8 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1771
1806
|
animationDuration: `${appearDurationMs}ms`,
|
|
1772
1807
|
animationTimingFunction: "ease",
|
|
1773
1808
|
animationFillMode: "both",
|
|
1774
|
-
...appear.type === "mix" && { animationDelay: `${backdropDurationMs}ms` },
|
|
1775
|
-
"--splide-speed":
|
|
1809
|
+
...appear.type === "mix" && { animationDelay: `${backdropDurationMs / 2}ms` },
|
|
1810
|
+
"--splide-speed": slider.duration || "500ms"
|
|
1776
1811
|
},
|
|
1777
1812
|
children: [
|
|
1778
1813
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1785,7 +1820,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1785
1820
|
className: styles.lightboxSplide,
|
|
1786
1821
|
options: {
|
|
1787
1822
|
arrows: false,
|
|
1788
|
-
speed:
|
|
1823
|
+
speed: slider.duration ? parseInt(slider.duration) : 500,
|
|
1789
1824
|
direction: slider.direction === "horiz" || slider.type === "fade" || slider.type === "scale" ? "ltr" : "ttb",
|
|
1790
1825
|
pagination: false,
|
|
1791
1826
|
drag: triggers.type === "drag",
|
|
@@ -1796,9 +1831,9 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1796
1831
|
padding: 0,
|
|
1797
1832
|
rewind: (slider.type === "scale" || slider.type === "fade") && appear.repeat !== "close"
|
|
1798
1833
|
},
|
|
1799
|
-
style: { "--splide-speed":
|
|
1834
|
+
style: { "--splide-speed": slider.duration || "500ms" },
|
|
1800
1835
|
children: content.map((item, index) => {
|
|
1801
|
-
const positionStyles = getPositionStyles(layout.position, layout.offset);
|
|
1836
|
+
const positionStyles = getPositionStyles(layout.position, layout.offset, isEditor);
|
|
1802
1837
|
const imageStyle2 = slider.type === "scale" ? (() => {
|
|
1803
1838
|
const { transform, ...restStyles } = positionStyles;
|
|
1804
1839
|
return {
|
|
@@ -1811,10 +1846,11 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1811
1846
|
{
|
|
1812
1847
|
className: styles.imgWrapper,
|
|
1813
1848
|
onClick: handleImageWrapperClick,
|
|
1814
|
-
style: { padding:
|
|
1849
|
+
style: { padding: scalingValue(layout.padding.top, isEditor) + " " + scalingValue(layout.padding.right, isEditor) + " " + scalingValue(layout.padding.bottom, isEditor) + " " + scalingValue(layout.padding.left, isEditor) },
|
|
1815
1850
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1816
1851
|
"img",
|
|
1817
1852
|
{
|
|
1853
|
+
ref: imageRef,
|
|
1818
1854
|
className: cn(styles.imageStyle, {
|
|
1819
1855
|
[styles.contain]: item.image.objectFit === "contain",
|
|
1820
1856
|
[styles.cover]: item.image.objectFit === "cover",
|
|
@@ -1829,9 +1865,10 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1829
1865
|
}
|
|
1830
1866
|
) }, index);
|
|
1831
1867
|
})
|
|
1832
|
-
}
|
|
1868
|
+
},
|
|
1869
|
+
splideKey
|
|
1833
1870
|
),
|
|
1834
|
-
controls.isActive && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1871
|
+
controls.isActive && controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1835
1872
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1836
1873
|
"div",
|
|
1837
1874
|
{
|
|
@@ -1842,7 +1879,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1842
1879
|
{
|
|
1843
1880
|
className: styles.arrowInner,
|
|
1844
1881
|
style: {
|
|
1845
|
-
transform: `translate(${scalingValue(controls.offset.x)}, ${scalingValue(controls.offset.y * (slider.direction === "horiz" ? 1 : -1))}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
|
|
1882
|
+
transform: `translate(${scalingValue(controls.offset.x, isEditor)}, ${scalingValue(controls.offset.y * (slider.direction === "horiz" ? 1 : -1), isEditor)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
|
|
1846
1883
|
},
|
|
1847
1884
|
onClick: (e) => {
|
|
1848
1885
|
handleArrowClick("-1");
|
|
@@ -1870,7 +1907,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1870
1907
|
{
|
|
1871
1908
|
className: styles.arrowInner,
|
|
1872
1909
|
style: {
|
|
1873
|
-
transform: `translate(${scalingValue(controls.offset.x * (slider.direction === "horiz" ? -1 : 1))}, ${scalingValue(controls.offset.y)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
|
|
1910
|
+
transform: `translate(${scalingValue(controls.offset.x * (slider.direction === "horiz" ? -1 : 1), isEditor)}, ${scalingValue(controls.offset.y, isEditor)}) scale(${controls.scale}) rotate(${slider.direction === "horiz" ? "0deg" : "90deg"})`
|
|
1874
1911
|
},
|
|
1875
1912
|
onClick: (e) => {
|
|
1876
1913
|
handleArrowClick("+1");
|
|
@@ -1891,7 +1928,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1891
1928
|
)
|
|
1892
1929
|
] }),
|
|
1893
1930
|
area.closeIconUrl && (() => {
|
|
1894
|
-
const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset);
|
|
1931
|
+
const positionStyles = getPositionStyles(area.closeIconAlign, area.closeIconOffset, isEditor);
|
|
1895
1932
|
const scaleTransform = `scale(${area.closeIconScale})`;
|
|
1896
1933
|
const combinedTransform = positionStyles.transform ? `${positionStyles.transform} ${scaleTransform}` : scaleTransform;
|
|
1897
1934
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1912,10 +1949,34 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1912
1949
|
{
|
|
1913
1950
|
className: styles.caption,
|
|
1914
1951
|
style: {
|
|
1915
|
-
...getPositionStyles(caption2.alignment, caption2.offset),
|
|
1916
|
-
|
|
1952
|
+
...getPositionStyles(caption2.alignment, caption2.offset, isEditor),
|
|
1953
|
+
fontFamily: fontSettings.fontFamily,
|
|
1954
|
+
fontWeight: fontSettings.fontWeight,
|
|
1955
|
+
fontStyle: fontSettings.fontStyle,
|
|
1956
|
+
width: widthSettings.sizing === "auto" ? "max-content" : scalingValue(widthSettings.width, isEditor),
|
|
1957
|
+
letterSpacing: scalingValue(letterSpacing, isEditor),
|
|
1958
|
+
wordSpacing: scalingValue(wordSpacing, isEditor),
|
|
1959
|
+
textAlign,
|
|
1960
|
+
fontSize: scalingValue(fontSizeLineHeight.fontSize, isEditor),
|
|
1961
|
+
lineHeight: scalingValue(fontSizeLineHeight.lineHeight, isEditor),
|
|
1962
|
+
textTransform: textAppearance.textTransform ?? "none",
|
|
1963
|
+
textDecoration: textAppearance.textDecoration ?? "none",
|
|
1964
|
+
fontVariant: textAppearance.fontVariant ?? "normal",
|
|
1965
|
+
color,
|
|
1966
|
+
transitionDuration: slider.duration ? `${Math.round(parseInt(slider.duration) / 2)}ms` : "500ms"
|
|
1917
1967
|
},
|
|
1918
|
-
|
|
1968
|
+
onClick: (e) => e.stopPropagation(),
|
|
1969
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1970
|
+
"div",
|
|
1971
|
+
{
|
|
1972
|
+
"data-styles": "caption",
|
|
1973
|
+
className: styles.captionTextInner,
|
|
1974
|
+
style: {
|
|
1975
|
+
position: "relative"
|
|
1976
|
+
},
|
|
1977
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(RichTextRenderer, { content: content[currentIndex].imageCaption })
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
1919
1980
|
}
|
|
1920
1981
|
),
|
|
1921
1982
|
thumbnail.isActive && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1932,9 +1993,7 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1932
1993
|
),
|
|
1933
1994
|
style: {
|
|
1934
1995
|
gap: `${thumbnail.grid.gap}px`,
|
|
1935
|
-
...
|
|
1936
|
-
...slider.direction === "vert" ? { width: `${thumbnail.grid.width}px` } : {},
|
|
1937
|
-
...getPositionStyles(thumbnail.position, thumbnail.offset)
|
|
1996
|
+
...getPositionStyles(thumbnail.position, thumbnail.offset, isEditor)
|
|
1938
1997
|
},
|
|
1939
1998
|
children: content.map((item, index) => {
|
|
1940
1999
|
const isActive = index === currentIndex;
|
|
@@ -1943,11 +2002,13 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1943
2002
|
{
|
|
1944
2003
|
className: styles.thumbItem,
|
|
1945
2004
|
style: {
|
|
1946
|
-
|
|
1947
|
-
...slider.direction === "
|
|
1948
|
-
...slider.direction === "
|
|
1949
|
-
|
|
1950
|
-
|
|
2005
|
+
...slider.direction === "horiz" ? { height: isActive ? `${thumbnail.grid.height * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.height}px` } : {},
|
|
2006
|
+
...slider.direction === "vert" ? { width: isActive ? `${thumbnail.grid.width * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.width}px` } : {},
|
|
2007
|
+
...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: isActive ? `${thumbnail.grid.width * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.width}px` } : {},
|
|
2008
|
+
...thumbnail.fit === "cover" && slider.direction === "vert" ? { height: isActive ? `${thumbnail.grid.height * (isActive ? thumbnail.activeState.scale : 1)}px` : `${thumbnail.grid.height}px` } : {},
|
|
2009
|
+
transition: isActive ? "all 0.2s ease" : "none",
|
|
2010
|
+
opacity: isActive ? thumbnail.activeState.opacity / 100 : thumbnail.opacity / 100,
|
|
2011
|
+
["--thumb-hover"]: thumbnail.activeState.opacity / 100
|
|
1951
2012
|
},
|
|
1952
2013
|
onClick: (e) => {
|
|
1953
2014
|
var _a;
|
|
@@ -1960,13 +2021,10 @@ const Lightbox = ({ isOpen, onClose, content, settings, closeOnBackdropClick = t
|
|
|
1960
2021
|
{
|
|
1961
2022
|
src: item.image.url,
|
|
1962
2023
|
alt: item.image.name ?? "",
|
|
1963
|
-
className: styles.thumbImage,
|
|
1964
2024
|
style: {
|
|
1965
2025
|
objectFit: thumbnail.fit === "cover" ? "cover" : "contain",
|
|
1966
|
-
...thumbnail.fit === "fit"
|
|
1967
|
-
...thumbnail.fit === "
|
|
1968
|
-
...slider.direction === "horiz" ? { height: "100%", width: "auto" } : {},
|
|
1969
|
-
...slider.direction === "vert" ? { width: "100%", height: "auto" } : {}
|
|
2026
|
+
...thumbnail.fit === "fit" ? { maxWidth: "100%", maxHeight: "100%", objectFit: "contain" } : {},
|
|
2027
|
+
...thumbnail.fit === "cover" && slider.direction === "horiz" ? { width: "100%", height: "100%" } : {}
|
|
1970
2028
|
}
|
|
1971
2029
|
}
|
|
1972
2030
|
)
|
|
@@ -1994,8 +2052,8 @@ const LightboxComponent = {
|
|
|
1994
2052
|
url: "https://cdn.cntrl.site/projects/01GJ2SPDSH73MC92WW7ZA2CWBY/articles-assets/01KA24CHYZXJBZ0Q714B05A7VD.mp4"
|
|
1995
2053
|
},
|
|
1996
2054
|
defaultSize: {
|
|
1997
|
-
width:
|
|
1998
|
-
height:
|
|
2055
|
+
width: 440,
|
|
2056
|
+
height: 550
|
|
1999
2057
|
},
|
|
2000
2058
|
schema: {
|
|
2001
2059
|
type: "object",
|
|
@@ -2020,6 +2078,7 @@ const LightboxComponent = {
|
|
|
2020
2078
|
url: {
|
|
2021
2079
|
type: "string",
|
|
2022
2080
|
display: {
|
|
2081
|
+
mode: "cover",
|
|
2023
2082
|
type: "settings-image-input"
|
|
2024
2083
|
}
|
|
2025
2084
|
}
|
|
@@ -2092,14 +2151,6 @@ const LightboxComponent = {
|
|
|
2092
2151
|
type: "ratio-group"
|
|
2093
2152
|
},
|
|
2094
2153
|
enum: ["image", "50/50"]
|
|
2095
|
-
},
|
|
2096
|
-
duration: {
|
|
2097
|
-
type: "string",
|
|
2098
|
-
label: "T",
|
|
2099
|
-
display: {
|
|
2100
|
-
type: "step-selector"
|
|
2101
|
-
},
|
|
2102
|
-
enum: ["100ms", "250ms", "500ms", "1000ms", "1500ms", "2000ms"]
|
|
2103
2154
|
}
|
|
2104
2155
|
}
|
|
2105
2156
|
},
|
|
@@ -2122,6 +2173,14 @@ const LightboxComponent = {
|
|
|
2122
2173
|
type: "ratio-group"
|
|
2123
2174
|
},
|
|
2124
2175
|
enum: ["horiz", "vert"]
|
|
2176
|
+
},
|
|
2177
|
+
duration: {
|
|
2178
|
+
type: "string",
|
|
2179
|
+
label: "T",
|
|
2180
|
+
display: {
|
|
2181
|
+
type: "step-selector"
|
|
2182
|
+
},
|
|
2183
|
+
enum: ["100ms", "250ms", "500ms", "1000ms", "1500ms", "2000ms"]
|
|
2125
2184
|
}
|
|
2126
2185
|
}
|
|
2127
2186
|
},
|
|
@@ -2203,15 +2262,28 @@ const LightboxComponent = {
|
|
|
2203
2262
|
},
|
|
2204
2263
|
offset: {
|
|
2205
2264
|
type: "object",
|
|
2265
|
+
title: "Offset",
|
|
2206
2266
|
display: {
|
|
2207
|
-
type: "
|
|
2267
|
+
type: "group"
|
|
2208
2268
|
},
|
|
2209
2269
|
properties: {
|
|
2210
2270
|
x: {
|
|
2211
|
-
type: "number"
|
|
2271
|
+
type: "number",
|
|
2272
|
+
label: "X",
|
|
2273
|
+
scalingEnabled: true,
|
|
2274
|
+
display: {
|
|
2275
|
+
type: "numeric-input",
|
|
2276
|
+
visible: true
|
|
2277
|
+
}
|
|
2212
2278
|
},
|
|
2213
2279
|
y: {
|
|
2214
|
-
type: "number"
|
|
2280
|
+
type: "number",
|
|
2281
|
+
label: "Y",
|
|
2282
|
+
scalingEnabled: true,
|
|
2283
|
+
display: {
|
|
2284
|
+
type: "numeric-input",
|
|
2285
|
+
visible: true
|
|
2286
|
+
}
|
|
2215
2287
|
}
|
|
2216
2288
|
}
|
|
2217
2289
|
},
|
|
@@ -2236,7 +2308,7 @@ const LightboxComponent = {
|
|
|
2236
2308
|
scale: {
|
|
2237
2309
|
type: "number",
|
|
2238
2310
|
title: "Scale",
|
|
2239
|
-
min:
|
|
2311
|
+
min: 1,
|
|
2240
2312
|
max: 5,
|
|
2241
2313
|
step: 0.1,
|
|
2242
2314
|
display: {
|
|
@@ -2273,15 +2345,28 @@ const LightboxComponent = {
|
|
|
2273
2345
|
},
|
|
2274
2346
|
offset: {
|
|
2275
2347
|
type: "object",
|
|
2348
|
+
title: "Offset",
|
|
2276
2349
|
display: {
|
|
2277
|
-
type: "
|
|
2350
|
+
type: "group"
|
|
2278
2351
|
},
|
|
2279
2352
|
properties: {
|
|
2280
2353
|
x: {
|
|
2281
|
-
type: "number"
|
|
2354
|
+
type: "number",
|
|
2355
|
+
label: "X",
|
|
2356
|
+
scalingEnabled: true,
|
|
2357
|
+
display: {
|
|
2358
|
+
type: "numeric-input",
|
|
2359
|
+
visible: true
|
|
2360
|
+
}
|
|
2282
2361
|
},
|
|
2283
2362
|
y: {
|
|
2284
|
-
type: "number"
|
|
2363
|
+
type: "number",
|
|
2364
|
+
label: "Y",
|
|
2365
|
+
scalingEnabled: true,
|
|
2366
|
+
display: {
|
|
2367
|
+
type: "numeric-input",
|
|
2368
|
+
visible: true
|
|
2369
|
+
}
|
|
2285
2370
|
}
|
|
2286
2371
|
}
|
|
2287
2372
|
},
|
|
@@ -2327,16 +2412,29 @@ const LightboxComponent = {
|
|
|
2327
2412
|
}
|
|
2328
2413
|
},
|
|
2329
2414
|
offset: {
|
|
2415
|
+
title: "Offset",
|
|
2330
2416
|
type: "object",
|
|
2331
2417
|
display: {
|
|
2332
|
-
type: "
|
|
2418
|
+
type: "group"
|
|
2333
2419
|
},
|
|
2334
2420
|
properties: {
|
|
2335
2421
|
x: {
|
|
2336
|
-
type: "number"
|
|
2422
|
+
type: "number",
|
|
2423
|
+
label: "X",
|
|
2424
|
+
scalingEnabled: true,
|
|
2425
|
+
display: {
|
|
2426
|
+
type: "numeric-input",
|
|
2427
|
+
visible: true
|
|
2428
|
+
}
|
|
2337
2429
|
},
|
|
2338
2430
|
y: {
|
|
2339
|
-
type: "number"
|
|
2431
|
+
type: "number",
|
|
2432
|
+
label: "Y",
|
|
2433
|
+
scalingEnabled: true,
|
|
2434
|
+
display: {
|
|
2435
|
+
type: "numeric-input",
|
|
2436
|
+
visible: true
|
|
2437
|
+
}
|
|
2340
2438
|
}
|
|
2341
2439
|
}
|
|
2342
2440
|
},
|
|
@@ -2415,15 +2513,28 @@ const LightboxComponent = {
|
|
|
2415
2513
|
},
|
|
2416
2514
|
closeIconOffset: {
|
|
2417
2515
|
type: "object",
|
|
2516
|
+
title: "Offset",
|
|
2418
2517
|
display: {
|
|
2419
|
-
type: "
|
|
2518
|
+
type: "group"
|
|
2420
2519
|
},
|
|
2421
2520
|
properties: {
|
|
2422
2521
|
x: {
|
|
2423
|
-
type: "number"
|
|
2522
|
+
type: "number",
|
|
2523
|
+
label: "X",
|
|
2524
|
+
scalingEnabled: true,
|
|
2525
|
+
display: {
|
|
2526
|
+
type: "numeric-input",
|
|
2527
|
+
visible: true
|
|
2528
|
+
}
|
|
2424
2529
|
},
|
|
2425
2530
|
y: {
|
|
2426
|
-
type: "number"
|
|
2531
|
+
type: "number",
|
|
2532
|
+
label: "Y",
|
|
2533
|
+
scalingEnabled: true,
|
|
2534
|
+
display: {
|
|
2535
|
+
type: "numeric-input",
|
|
2536
|
+
visible: true
|
|
2537
|
+
}
|
|
2427
2538
|
}
|
|
2428
2539
|
}
|
|
2429
2540
|
}
|
|
@@ -2449,16 +2560,29 @@ const LightboxComponent = {
|
|
|
2449
2560
|
enum: ["top-left", "top-center", "top-right", "middle-left", "middle-center", "middle-right", "bottom-left", "bottom-center", "bottom-right"]
|
|
2450
2561
|
},
|
|
2451
2562
|
offset: {
|
|
2563
|
+
title: "Offset",
|
|
2452
2564
|
type: "object",
|
|
2453
2565
|
display: {
|
|
2454
|
-
type: "
|
|
2566
|
+
type: "group"
|
|
2455
2567
|
},
|
|
2456
2568
|
properties: {
|
|
2457
2569
|
x: {
|
|
2458
|
-
type: "number"
|
|
2570
|
+
type: "number",
|
|
2571
|
+
label: "X",
|
|
2572
|
+
scalingEnabled: true,
|
|
2573
|
+
display: {
|
|
2574
|
+
type: "numeric-input",
|
|
2575
|
+
visible: true
|
|
2576
|
+
}
|
|
2459
2577
|
},
|
|
2460
2578
|
y: {
|
|
2461
|
-
type: "number"
|
|
2579
|
+
type: "number",
|
|
2580
|
+
label: "Y",
|
|
2581
|
+
scalingEnabled: true,
|
|
2582
|
+
display: {
|
|
2583
|
+
type: "numeric-input",
|
|
2584
|
+
visible: true
|
|
2585
|
+
}
|
|
2462
2586
|
}
|
|
2463
2587
|
}
|
|
2464
2588
|
},
|
|
@@ -2490,12 +2614,12 @@ const LightboxComponent = {
|
|
|
2490
2614
|
},
|
|
2491
2615
|
triggers: {
|
|
2492
2616
|
type: "click",
|
|
2493
|
-
switch: "image"
|
|
2494
|
-
duration: "2000ms"
|
|
2617
|
+
switch: "image"
|
|
2495
2618
|
},
|
|
2496
2619
|
slider: {
|
|
2497
2620
|
type: "fade",
|
|
2498
|
-
direction: "horiz"
|
|
2621
|
+
direction: "horiz",
|
|
2622
|
+
duration: "1000ms"
|
|
2499
2623
|
},
|
|
2500
2624
|
thumbnail: {
|
|
2501
2625
|
isActive: true,
|
|
@@ -2624,47 +2748,27 @@ const LightboxComponent = {
|
|
|
2624
2748
|
name: "properties.lightboxBlock.properties.appear.properties.direction.display.visible",
|
|
2625
2749
|
value: false
|
|
2626
2750
|
}
|
|
2627
|
-
},
|
|
2628
|
-
{
|
|
2629
|
-
if: {
|
|
2630
|
-
name: "lightboxBlock.triggers.type",
|
|
2631
|
-
value: "click"
|
|
2632
|
-
},
|
|
2633
|
-
then: {
|
|
2634
|
-
name: "properties.lightboxBlock.properties.triggers.properties.duration.display.visible",
|
|
2635
|
-
value: true
|
|
2636
|
-
}
|
|
2637
|
-
},
|
|
2638
|
-
{
|
|
2639
|
-
if: {
|
|
2640
|
-
name: "lightboxBlock.triggers.type",
|
|
2641
|
-
value: "click"
|
|
2642
|
-
},
|
|
2643
|
-
then: {
|
|
2644
|
-
name: "properties.lightboxBlock.properties.triggers.properties.switch.display.visible",
|
|
2645
|
-
value: true
|
|
2646
|
-
}
|
|
2647
|
-
},
|
|
2648
|
-
{
|
|
2649
|
-
if: {
|
|
2650
|
-
name: "lightboxBlock.triggers.type",
|
|
2651
|
-
value: "drag"
|
|
2652
|
-
},
|
|
2653
|
-
then: {
|
|
2654
|
-
name: "properties.lightboxBlock.properties.triggers.properties.duration.display.visible",
|
|
2655
|
-
value: false
|
|
2656
|
-
}
|
|
2657
|
-
},
|
|
2658
|
-
{
|
|
2659
|
-
if: {
|
|
2660
|
-
name: "lightboxBlock.triggers.type",
|
|
2661
|
-
value: "drag"
|
|
2662
|
-
},
|
|
2663
|
-
then: {
|
|
2664
|
-
name: "properties.lightboxBlock.properties.triggers.properties.switch.display.visible",
|
|
2665
|
-
value: false
|
|
2666
|
-
}
|
|
2667
2751
|
}
|
|
2752
|
+
// {
|
|
2753
|
+
// if: {
|
|
2754
|
+
// name: 'lightboxBlock.triggers.type',
|
|
2755
|
+
// value: 'click'
|
|
2756
|
+
// },
|
|
2757
|
+
// then: {
|
|
2758
|
+
// name: 'properties.lightboxBlock.properties.slider.properties.switch.display.visible',
|
|
2759
|
+
// value: true
|
|
2760
|
+
// }
|
|
2761
|
+
// },
|
|
2762
|
+
// {
|
|
2763
|
+
// if: {
|
|
2764
|
+
// name: 'lightboxBlock.triggers.type',
|
|
2765
|
+
// value: 'drag'
|
|
2766
|
+
// },
|
|
2767
|
+
// then: {
|
|
2768
|
+
// name: 'properties.lightboxBlock.properties.slider.properties.switch.display.visible',
|
|
2769
|
+
// value: false
|
|
2770
|
+
// }
|
|
2771
|
+
// }
|
|
2668
2772
|
]
|
|
2669
2773
|
},
|
|
2670
2774
|
content: {
|