@cntrl-site/sdk 1.23.1-11 → 1.23.1-13

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 CHANGED
@@ -5,7 +5,7 @@ const url = require("url");
5
5
  const zod = require("zod");
6
6
  const UAParser = require("ua-parser-js");
7
7
  const MP4Box = require("mp4box");
8
- const jsxRuntime = require("react/jsx-runtime");
8
+ const jsxDevRuntime = require("react/jsx-dev-runtime");
9
9
  const react = require("react");
10
10
  const reactSplide = require("@splidejs/react-splide");
11
11
  const cn = require("classnames");
@@ -1329,15 +1329,31 @@ const RichTextRenderer = ({ content }) => {
1329
1329
  const getChildren = (children) => {
1330
1330
  return children.map((child, i) => {
1331
1331
  if (child.type === "link") {
1332
- return /* @__PURE__ */ jsxRuntime.jsx("a", { className: styles$2.link, href: child.value, target: child.target, children: getChildren(child.children) }, i);
1332
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("a", { className: styles$2.link, href: child.value, target: child.target, children: getChildren(child.children) }, i, false, {
1333
+ fileName: "H:/mom/sdk/src/Components/helpers/RichTextRenderer/RichTextRenderer.tsx",
1334
+ lineNumber: 13,
1335
+ columnNumber: 16
1336
+ }, void 0);
1333
1337
  }
1334
- return /* @__PURE__ */ jsxRuntime.jsx("span", { style: getLeafCss(child), children: child.text }, i);
1338
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { style: getLeafCss(child), children: child.text }, i, false, {
1339
+ fileName: "H:/mom/sdk/src/Components/helpers/RichTextRenderer/RichTextRenderer.tsx",
1340
+ lineNumber: 15,
1341
+ columnNumber: 14
1342
+ }, void 0);
1335
1343
  });
1336
1344
  };
1337
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: content.map((block, i) => {
1345
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: content.map((block, i) => {
1338
1346
  const children = block.children;
1339
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: getChildren(children) }, i);
1340
- }) });
1347
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { children: getChildren(children) }, i, false, {
1348
+ fileName: "H:/mom/sdk/src/Components/helpers/RichTextRenderer/RichTextRenderer.tsx",
1349
+ lineNumber: 23,
1350
+ columnNumber: 11
1351
+ }, void 0);
1352
+ }) }, void 0, false, {
1353
+ fileName: "H:/mom/sdk/src/Components/helpers/RichTextRenderer/RichTextRenderer.tsx",
1354
+ lineNumber: 19,
1355
+ columnNumber: 5
1356
+ }, void 0);
1341
1357
  };
1342
1358
  function getLeafCss(leaf) {
1343
1359
  return {
@@ -1370,9 +1386,13 @@ const SvgImage = ({ url: url2, fill = "#000000", hoverFill = "#CCCCCC", classNam
1370
1386
  }
1371
1387
  }, []);
1372
1388
  if (!url2.endsWith(".svg") || !supportsMask) {
1373
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url2, alt: "", className: cn(styles$1.img, className) });
1389
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("img", { src: url2, alt: "", className: cn(styles$1.img, className) }, void 0, false, {
1390
+ fileName: "H:/mom/sdk/src/Components/helpers/SvgImage/SvgImage.tsx",
1391
+ lineNumber: 23,
1392
+ columnNumber: 12
1393
+ }, void 0);
1374
1394
  }
1375
- return /* @__PURE__ */ jsxRuntime.jsx(
1395
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1376
1396
  "span",
1377
1397
  {
1378
1398
  "data-supports-mask": supportsMask,
@@ -1382,7 +1402,15 @@ const SvgImage = ({ url: url2, fill = "#000000", hoverFill = "#CCCCCC", classNam
1382
1402
  "--fill": fill,
1383
1403
  "--hover-fill": hoverFill
1384
1404
  }
1385
- }
1405
+ },
1406
+ void 0,
1407
+ false,
1408
+ {
1409
+ fileName: "H:/mom/sdk/src/Components/helpers/SvgImage/SvgImage.tsx",
1410
+ lineNumber: 27,
1411
+ columnNumber: 5
1412
+ },
1413
+ void 0
1386
1414
  );
1387
1415
  };
1388
1416
  const alignmentClassName = {
@@ -1429,19 +1457,19 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1429
1457
  setKey((prev) => prev + 1);
1430
1458
  prevSliderTypeRef.current = transition.type;
1431
1459
  }, [transition.type]);
1432
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(styles$3.wrapper, { [styles$3.editor]: isEditor }), ref: setWrapperRef, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles$3.sliderInner, style: {
1460
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: cn(styles$3.wrapper, { [styles$3.editor]: isEditor }), ref: setWrapperRef, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: styles$3.sliderInner, style: {
1433
1461
  width: sliderDimensions ? sliderDimensions.width : "100%",
1434
1462
  height: sliderDimensions ? sliderDimensions.height : "100%"
1435
1463
  }, children: [
1436
- settings.caption.isActive && /* @__PURE__ */ jsxRuntime.jsx(
1464
+ settings.caption.isActive && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1437
1465
  "div",
1438
1466
  {
1439
1467
  className: cn(styles$3.captionBlock),
1440
- children: /* @__PURE__ */ jsxRuntime.jsx(
1468
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1441
1469
  "div",
1442
1470
  {
1443
1471
  className: styles$3.captionTextWrapper,
1444
- children: content.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1472
+ children: content.map((item, index) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1445
1473
  "div",
1446
1474
  {
1447
1475
  className: cn(styles$3.captionText, alignmentClassName[caption.alignment], {
@@ -1464,7 +1492,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1464
1492
  color,
1465
1493
  transitionDuration: transition.duration ? `${Math.round(parseInt(transition.duration) / 2)}ms` : "500ms"
1466
1494
  },
1467
- children: /* @__PURE__ */ jsxRuntime.jsx(
1495
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1468
1496
  "div",
1469
1497
  {
1470
1498
  "data-styles": "caption",
@@ -1475,17 +1503,52 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1475
1503
  top: scalingValue(caption.offset.y, isEditor),
1476
1504
  left: scalingValue(caption.offset.x, isEditor)
1477
1505
  },
1478
- children: /* @__PURE__ */ jsxRuntime.jsx(RichTextRenderer, { content: item.imageCaption })
1479
- }
1506
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(RichTextRenderer, { content: item.imageCaption }, void 0, false, {
1507
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1508
+ lineNumber: 111,
1509
+ columnNumber: 19
1510
+ }, this)
1511
+ },
1512
+ void 0,
1513
+ false,
1514
+ {
1515
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1516
+ lineNumber: 101,
1517
+ columnNumber: 17
1518
+ },
1519
+ this
1480
1520
  )
1481
1521
  },
1482
- index
1522
+ index,
1523
+ false,
1524
+ {
1525
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1526
+ lineNumber: 78,
1527
+ columnNumber: 15
1528
+ },
1529
+ this
1483
1530
  ))
1484
- }
1531
+ },
1532
+ void 0,
1533
+ false,
1534
+ {
1535
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1536
+ lineNumber: 74,
1537
+ columnNumber: 11
1538
+ },
1539
+ this
1485
1540
  )
1486
- }
1541
+ },
1542
+ void 0,
1543
+ false,
1544
+ {
1545
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1546
+ lineNumber: 71,
1547
+ columnNumber: 9
1548
+ },
1549
+ this
1487
1550
  ),
1488
- /* @__PURE__ */ jsxRuntime.jsx(
1551
+ /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1489
1552
  reactSplide.Splide,
1490
1553
  {
1491
1554
  onMove: (e) => {
@@ -1508,15 +1571,15 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1508
1571
  type: transition.type === "fade in" ? "fade" : "loop",
1509
1572
  rewind: true
1510
1573
  },
1511
- children: content.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(reactSplide.SplideSlide, { children: /* @__PURE__ */ jsxRuntime.jsx(
1574
+ children: content.map((item, index) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(reactSplide.SplideSlide, { children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1512
1575
  "div",
1513
1576
  {
1514
1577
  className: styles$3.sliderItem,
1515
- children: /* @__PURE__ */ jsxRuntime.jsx(
1578
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1516
1579
  "div",
1517
1580
  {
1518
1581
  className: styles$3.imgWrapper,
1519
- children: /* @__PURE__ */ jsxRuntime.jsx(
1582
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1520
1583
  "img",
1521
1584
  {
1522
1585
  className: cn(styles$3.sliderImage, {
@@ -1525,17 +1588,52 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1525
1588
  }),
1526
1589
  src: item.image.url,
1527
1590
  alt: item.image.name ?? ""
1528
- }
1591
+ },
1592
+ void 0,
1593
+ false,
1594
+ {
1595
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1596
+ lineNumber: 149,
1597
+ columnNumber: 17
1598
+ },
1599
+ this
1529
1600
  )
1530
- }
1601
+ },
1602
+ void 0,
1603
+ false,
1604
+ {
1605
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1606
+ lineNumber: 146,
1607
+ columnNumber: 15
1608
+ },
1609
+ this
1531
1610
  )
1532
- }
1533
- ) }, index))
1611
+ },
1612
+ void 0,
1613
+ false,
1614
+ {
1615
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1616
+ lineNumber: 143,
1617
+ columnNumber: 13
1618
+ },
1619
+ this
1620
+ ) }, index, false, {
1621
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1622
+ lineNumber: 142,
1623
+ columnNumber: 11
1624
+ }, this))
1534
1625
  },
1535
- key
1626
+ key,
1627
+ false,
1628
+ {
1629
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1630
+ lineNumber: 118,
1631
+ columnNumber: 7
1632
+ },
1633
+ this
1536
1634
  ),
1537
- controls.isActive && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1538
- /* @__PURE__ */ jsxRuntime.jsx(
1635
+ controls.isActive && /* @__PURE__ */ jsxDevRuntime.jsxDEV(jsxDevRuntime.Fragment, { children: [
1636
+ /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1539
1637
  "div",
1540
1638
  {
1541
1639
  className: cn(styles$3.arrow, {
@@ -1545,7 +1643,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1545
1643
  color: controls.color,
1546
1644
  ["--arrow-hover-color"]: controls.hover
1547
1645
  },
1548
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1646
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1549
1647
  "button",
1550
1648
  {
1551
1649
  onClick: () => {
@@ -1556,22 +1654,50 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1556
1654
  transform: `translate(${scalingValue(controlsOffsetX, isEditor)}, ${scalingValue(controlsOffsetY * (direction === "horiz" ? 1 : -1), isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1557
1655
  },
1558
1656
  children: [
1559
- controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(
1657
+ controls.arrowsImgUrl && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1560
1658
  SvgImage,
1561
1659
  {
1562
1660
  url: controls.arrowsImgUrl,
1563
1661
  fill: controls.color,
1564
1662
  hoverFill: controls.hover,
1565
1663
  className: cn(styles$3.arrowImg, styles$3.mirror)
1566
- }
1664
+ },
1665
+ void 0,
1666
+ false,
1667
+ {
1668
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1669
+ lineNumber: 182,
1670
+ columnNumber: 17
1671
+ },
1672
+ this
1567
1673
  ),
1568
- !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
1674
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsxDevRuntime.jsxDEV(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) }, void 0, false, {
1675
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1676
+ lineNumber: 190,
1677
+ columnNumber: 17
1678
+ }, this)
1569
1679
  ]
1570
- }
1680
+ },
1681
+ void 0,
1682
+ true,
1683
+ {
1684
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1685
+ lineNumber: 172,
1686
+ columnNumber: 13
1687
+ },
1688
+ this
1571
1689
  )
1572
- }
1690
+ },
1691
+ void 0,
1692
+ false,
1693
+ {
1694
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1695
+ lineNumber: 163,
1696
+ columnNumber: 11
1697
+ },
1698
+ this
1573
1699
  ),
1574
- /* @__PURE__ */ jsxRuntime.jsx(
1700
+ /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1575
1701
  "div",
1576
1702
  {
1577
1703
  className: cn(styles$3.arrow, styles$3.nextArrow, {
@@ -1581,7 +1707,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1581
1707
  color: controls.color,
1582
1708
  ["--arrow-hover-color"]: controls.hover
1583
1709
  },
1584
- children: /* @__PURE__ */ jsxRuntime.jsxs(
1710
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1585
1711
  "button",
1586
1712
  {
1587
1713
  className: styles$3.arrowInner,
@@ -1590,23 +1716,55 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1590
1716
  transform: `translate(${scalingValue(controlsOffsetX * (direction === "horiz" ? -1 : 1), isEditor)}, ${scalingValue(controlsOffsetY, isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1591
1717
  },
1592
1718
  children: [
1593
- controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(
1719
+ controls.arrowsImgUrl && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1594
1720
  SvgImage,
1595
1721
  {
1596
1722
  url: controls.arrowsImgUrl,
1597
1723
  fill: controls.color,
1598
1724
  hoverFill: controls.hover,
1599
1725
  className: styles$3.arrowImg
1600
- }
1726
+ },
1727
+ void 0,
1728
+ false,
1729
+ {
1730
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1731
+ lineNumber: 211,
1732
+ columnNumber: 17
1733
+ },
1734
+ this
1601
1735
  ),
1602
- !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
1736
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsxDevRuntime.jsxDEV(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) }, void 0, false, {
1737
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1738
+ lineNumber: 219,
1739
+ columnNumber: 17
1740
+ }, this)
1603
1741
  ]
1604
- }
1742
+ },
1743
+ void 0,
1744
+ true,
1745
+ {
1746
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1747
+ lineNumber: 203,
1748
+ columnNumber: 13
1749
+ },
1750
+ this
1605
1751
  )
1606
- }
1752
+ },
1753
+ void 0,
1754
+ false,
1755
+ {
1756
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1757
+ lineNumber: 194,
1758
+ columnNumber: 11
1759
+ },
1760
+ this
1607
1761
  )
1608
- ] }),
1609
- triggers.triggersList.click && /* @__PURE__ */ jsxRuntime.jsx(
1762
+ ] }, void 0, true, {
1763
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1764
+ lineNumber: 162,
1765
+ columnNumber: 9
1766
+ }, this),
1767
+ triggers.triggersList.click && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1610
1768
  "div",
1611
1769
  {
1612
1770
  className: styles$3.clickOverlay,
@@ -1615,9 +1773,17 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1615
1773
  sliderRef.go("+1");
1616
1774
  }
1617
1775
  }
1618
- }
1776
+ },
1777
+ void 0,
1778
+ false,
1779
+ {
1780
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1781
+ lineNumber: 226,
1782
+ columnNumber: 9
1783
+ },
1784
+ this
1619
1785
  ),
1620
- pagination2.isActive && /* @__PURE__ */ jsxRuntime.jsx(
1786
+ pagination2.isActive && /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1621
1787
  "div",
1622
1788
  {
1623
1789
  className: cn(styles$3.pagination, {
@@ -1631,7 +1797,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1631
1797
  [styles$3.paginationOutsideRight]: pagination2.position === "outside-2" && direction === "vert",
1632
1798
  [styles$3.paginationVertical]: direction === "vert"
1633
1799
  }),
1634
- children: /* @__PURE__ */ jsxRuntime.jsx(
1800
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1635
1801
  "div",
1636
1802
  {
1637
1803
  className: styles$3.paginationInner,
@@ -1639,7 +1805,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1639
1805
  backgroundColor: pagination2.colors[2],
1640
1806
  transform: `scale(${pagination2.scale / 100}) translate(${scalingValue(pagination2.offset.x, isEditor)}, ${scalingValue(pagination2.offset.y, isEditor)}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1641
1807
  },
1642
- children: content.map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(
1808
+ children: content.map((_, index) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1643
1809
  "button",
1644
1810
  {
1645
1811
  onClick: () => {
@@ -1648,7 +1814,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1648
1814
  }
1649
1815
  },
1650
1816
  className: cn(styles$3.paginationItem),
1651
- children: /* @__PURE__ */ jsxRuntime.jsx(
1817
+ children: /* @__PURE__ */ jsxDevRuntime.jsxDEV(
1652
1818
  "div",
1653
1819
  {
1654
1820
  className: cn(styles$3.dot, {
@@ -1658,19 +1824,70 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1658
1824
  backgroundColor: index === currentSlideIndex ? pagination2.colors[0] : pagination2.colors[1],
1659
1825
  ["--pagination-hover-color"]: pagination2.hover
1660
1826
  }
1661
- }
1827
+ },
1828
+ void 0,
1829
+ false,
1830
+ {
1831
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1832
+ lineNumber: 266,
1833
+ columnNumber: 17
1834
+ },
1835
+ this
1662
1836
  )
1663
1837
  },
1664
- index
1838
+ index,
1839
+ false,
1840
+ {
1841
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1842
+ lineNumber: 257,
1843
+ columnNumber: 15
1844
+ },
1845
+ this
1665
1846
  ))
1666
- }
1847
+ },
1848
+ void 0,
1849
+ false,
1850
+ {
1851
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1852
+ lineNumber: 249,
1853
+ columnNumber: 11
1854
+ },
1855
+ this
1667
1856
  )
1668
- }
1857
+ },
1858
+ void 0,
1859
+ false,
1860
+ {
1861
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1862
+ lineNumber: 236,
1863
+ columnNumber: 9
1864
+ },
1865
+ this
1669
1866
  )
1670
- ] }) });
1867
+ ] }, void 0, true, {
1868
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1869
+ lineNumber: 66,
1870
+ columnNumber: 7
1871
+ }, this) }, void 0, false, {
1872
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1873
+ lineNumber: 65,
1874
+ columnNumber: 5
1875
+ }, this);
1671
1876
  }
1672
1877
  function ArrowIcon({ color, className }) {
1673
- return /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsxRuntime.jsx("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z", id: "Shape-Copy", fill: color, transform: "translate(5, 9) rotate(-90) translate(-5, -9)" }) }) });
1878
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV("svg", { viewBox: "0 0 10 18", className, children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("g", { id: "Symbols", stroke: "none", strokeWidth: "1", fillRule: "evenodd", children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("path", { d: "M-3.70710678,4.29289322 C-3.34662282,3.93240926 -2.77939176,3.90467972 -2.38710056,4.20970461 L-2.29289322,4.29289322 L5,11.585 L12.2928932,4.29289322 C12.6533772,3.93240926 13.2206082,3.90467972 13.6128994,4.20970461 L13.7071068,4.29289322 C14.0675907,4.65337718 14.0953203,5.22060824 13.7902954,5.61289944 L13.7071068,5.70710678 L5.70710678,13.7071068 C5.34662282,14.0675907 4.77939176,14.0953203 4.38710056,13.7902954 L4.29289322,13.7071068 L-3.70710678,5.70710678 C-4.09763107,5.31658249 -4.09763107,4.68341751 -3.70710678,4.29289322 Z", id: "Shape-Copy", fill: color, transform: "translate(5, 9) rotate(-90) translate(-5, -9)" }, void 0, false, {
1879
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1880
+ lineNumber: 289,
1881
+ columnNumber: 11
1882
+ }, this) }, void 0, false, {
1883
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1884
+ lineNumber: 288,
1885
+ columnNumber: 7
1886
+ }, this) }, void 0, false, {
1887
+ fileName: "H:/mom/sdk/src/Components/ControlSlider/ControlSlider.tsx",
1888
+ lineNumber: 287,
1889
+ columnNumber: 5
1890
+ }, this);
1674
1891
  }
1675
1892
  const ControlSliderComponent = {
1676
1893
  element: ControlSlider,
@@ -2221,112 +2438,119 @@ function isMouseOverImage(mouseX, mouseY, placedImages) {
2221
2438
  }
2222
2439
  return false;
2223
2440
  }
2441
+ function getImageSize(url2) {
2442
+ return new Promise((resolve) => {
2443
+ const img2 = new Image();
2444
+ img2.src = url2;
2445
+ img2.onload = () => {
2446
+ resolve({ width: img2.naturalWidth, height: img2.naturalHeight });
2447
+ };
2448
+ });
2449
+ }
2450
+ async function calculateImageWidthHeight(imgUrl, sizeType, customWidth, randomRange) {
2451
+ let width;
2452
+ let height;
2453
+ if (sizeType === "custom") {
2454
+ width = customWidth;
2455
+ const size = await getImageSize(imgUrl);
2456
+ height = size.height / size.width * width;
2457
+ } else if (sizeType === "random") {
2458
+ width = Math.random() * (randomRange.max - randomRange.min) + randomRange.min;
2459
+ const size = await getImageSize(imgUrl);
2460
+ height = size.height / size.width * width;
2461
+ } else {
2462
+ const size = await getImageSize(imgUrl);
2463
+ width = size.width;
2464
+ height = size.height;
2465
+ }
2466
+ return { width, height, finalWidth: `${width}px` };
2467
+ }
2224
2468
  function ImageRevealSlider({ settings, content, isEditor }) {
2225
- const revealPosition = settings.position.revealPosition;
2226
- const visibleType = settings.position.visible;
2227
- const sizeType = settings.imageSize.sizeType;
2228
- const customWidth = settings.imageSize.imageWidth;
2229
- const randomRange = settings.imageSize.randomRangeImageWidth;
2230
- const clickTarget = settings.position.target;
2231
- const defaultCursorUrl = settings.cursor.defaultCursor;
2232
- const hoverCursorUrl = settings.cursor.hoverCursor;
2233
- const cursorType = settings.cursor.cursorType;
2234
- const [counter, setCounter] = react.useState(0);
2235
2469
  const divRef = react.useRef(null);
2236
2470
  const [placedImages, setPlacedImages] = react.useState([]);
2471
+ const [counter, setCounter] = react.useState(0);
2237
2472
  const imageIdCounter = react.useRef(0);
2473
+ const defaultImageCount = 1;
2474
+ const { sizeType, imageWidth: customWidth, randomRangeImageWidth: randomRange } = settings.imageSize;
2475
+ const { revealPosition, visible, target } = settings.position;
2476
+ const { cursorType, defaultCursor, hoverCursor } = settings.cursor;
2477
+ const createNewImage = async (imgData, containerWidth, containerHeight, position = {}) => {
2478
+ const { width, height, finalWidth } = await calculateImageWidthHeight(
2479
+ imgData.url,
2480
+ sizeType,
2481
+ customWidth,
2482
+ randomRange
2483
+ );
2484
+ let x = position.x ?? Math.random() * containerWidth;
2485
+ let y = position.y ?? Math.random() * containerHeight;
2486
+ const adjustedX = Math.min(Math.max(x, width / 2), containerWidth - width / 2);
2487
+ const adjustedY = Math.min(Math.max(y, height / 2), containerHeight - height / 2);
2488
+ return {
2489
+ id: imageIdCounter.current++,
2490
+ url: imgData.url,
2491
+ name: imgData.name,
2492
+ x: adjustedX,
2493
+ y: adjustedY,
2494
+ width: finalWidth
2495
+ };
2496
+ };
2238
2497
  react.useEffect(() => {
2239
- if (visibleType === "lastOne") {
2240
- setPlacedImages(
2241
- (prev) => prev.length > 0 ? [prev[prev.length - 1]] : []
2242
- );
2243
- }
2244
- }, [visibleType]);
2245
- const handleMouseMove = (e) => {
2246
- if (!divRef.current) return;
2247
- if (cursorType === "system") {
2248
- divRef.current.style.cursor = "";
2249
- return;
2250
- }
2498
+ if (!divRef.current || content.length === 0) return;
2251
2499
  const rect = divRef.current.getBoundingClientRect();
2252
- const mouseX = e.clientX - rect.left;
2253
- const mouseY = e.clientY - rect.top;
2254
- let isHover = false;
2255
- if (clickTarget === "area") {
2256
- isHover = true;
2257
- } else if (clickTarget === "image") {
2258
- isHover = isMouseOverImage(mouseX, mouseY, placedImages);
2259
- }
2260
- if (divRef.current) {
2261
- divRef.current.style.cursor = isHover ? `url(${hoverCursorUrl}), auto` : `url(${defaultCursorUrl}), auto`;
2500
+ const containerWidth = rect.width;
2501
+ const containerHeight = rect.height;
2502
+ const defaultPlaced = [];
2503
+ const placeImages = async () => {
2504
+ for (let i = 0; i < defaultImageCount && i < content.length; i++) {
2505
+ const imgData = content[i].image;
2506
+ const newImg = await createNewImage(imgData, containerWidth, containerHeight);
2507
+ defaultPlaced.push(newImg);
2508
+ }
2509
+ setPlacedImages(defaultPlaced);
2510
+ setCounter(defaultImageCount % content.length);
2511
+ };
2512
+ placeImages();
2513
+ }, [content, sizeType, customWidth, randomRange]);
2514
+ react.useEffect(() => {
2515
+ if (visible === "lastOne") {
2516
+ setPlacedImages((prev) => prev.length > 0 ? [prev[prev.length - 1]] : []);
2262
2517
  }
2263
- };
2264
- const handleClick = (e) => {
2518
+ }, [visible]);
2519
+ const handleClick = async (e) => {
2265
2520
  if (!divRef.current) return;
2266
2521
  const rect = divRef.current.getBoundingClientRect();
2267
2522
  const clickX = e.clientX - rect.left;
2268
2523
  const clickY = e.clientY - rect.top;
2269
- const containerWidth = rect.width;
2270
- const containerHeight = rect.height;
2271
- if (clickTarget === "image") {
2272
- const hit = isMouseOverImage(clickX, clickY, placedImages);
2273
- if (!hit) return;
2274
- }
2275
- let x;
2276
- let y;
2524
+ if (target === "image" && !isMouseOverImage(clickX, clickY, placedImages)) return;
2525
+ let x = 0, y = 0;
2277
2526
  if (revealPosition === "onClick") {
2278
2527
  x = clickX;
2279
2528
  y = clickY;
2280
2529
  } else if (revealPosition === "same") {
2281
- x = containerWidth / 2;
2282
- y = containerHeight / 2;
2530
+ x = rect.width / 2;
2531
+ y = rect.height / 2;
2283
2532
  } else {
2284
- x = Math.random() * containerWidth;
2285
- y = Math.random() * containerHeight;
2533
+ x = Math.random() * rect.width;
2534
+ y = Math.random() * rect.height;
2286
2535
  }
2287
- let finalWidth;
2288
- let imgWidthValue;
2289
- if (sizeType === "custom") {
2290
- finalWidth = `${customWidth}px`;
2291
- imgWidthValue = customWidth;
2292
- } else if (sizeType === "random") {
2293
- const rnd = Math.random() * (randomRange.max - randomRange.min) + randomRange.min;
2294
- finalWidth = `${rnd}px`;
2295
- imgWidthValue = rnd;
2536
+ const imgData = content[counter].image;
2537
+ const newImage = await createNewImage(imgData, rect.width, rect.height, { x, y });
2538
+ setPlacedImages((prev) => visible === "all" ? [...prev, newImage] : [newImage]);
2539
+ setCounter((prev) => prev >= content.length - 1 ? 0 : prev + 1);
2540
+ };
2541
+ const handleMouseMove = (e) => {
2542
+ if (!divRef.current) return;
2543
+ if (cursorType === "system") {
2544
+ divRef.current.style.cursor = "";
2545
+ return;
2296
2546
  }
2297
- const tempImg = new Image();
2298
- tempImg.src = content[counter].image.url;
2299
- tempImg.onload = () => {
2300
- const imgWidth = imgWidthValue ?? tempImg.naturalWidth;
2301
- const imgHeight = imgWidthValue ? tempImg.naturalHeight / tempImg.naturalWidth * imgWidthValue : tempImg.naturalHeight;
2302
- const halfW = imgWidth / 2;
2303
- const halfH = imgHeight / 2;
2304
- const adjustedX = Math.min(Math.max(x, halfW), containerWidth - halfW);
2305
- let adjustedY;
2306
- if (imgHeight > containerHeight) {
2307
- adjustedY = containerHeight / 2;
2308
- } else {
2309
- adjustedY = Math.min(Math.max(y, halfH), containerHeight - halfH);
2310
- }
2311
- const newImage = {
2312
- id: imageIdCounter.current++,
2313
- url: content[counter].image.url,
2314
- name: content[counter].image.name,
2315
- x: adjustedX,
2316
- y: adjustedY,
2317
- width: finalWidth
2318
- };
2319
- setPlacedImages((prev) => {
2320
- if (visibleType === "all") {
2321
- return [...prev, newImage];
2322
- } else {
2323
- return [newImage];
2324
- }
2325
- });
2326
- setCounter((prev) => prev >= content.length - 1 ? 0 : prev + 1);
2327
- };
2547
+ const rect = divRef.current.getBoundingClientRect();
2548
+ const mouseX = e.clientX - rect.left;
2549
+ const mouseY = e.clientY - rect.top;
2550
+ const isHover = target === "area" || isMouseOverImage(mouseX, mouseY, placedImages);
2551
+ divRef.current.style.cursor = isHover ? `url(${hoverCursor}), auto` : `url(${defaultCursor}), auto`;
2328
2552
  };
2329
- return /* @__PURE__ */ jsxRuntime.jsx(
2553
+ return /* @__PURE__ */ jsxDevRuntime.jsxDEV(
2330
2554
  "div",
2331
2555
  {
2332
2556
  ref: divRef,
@@ -2334,7 +2558,7 @@ function ImageRevealSlider({ settings, content, isEditor }) {
2334
2558
  onMouseEnter: handleMouseMove,
2335
2559
  onMouseMove: handleMouseMove,
2336
2560
  className: styles.imageRevealSlider,
2337
- children: placedImages.map((img2) => /* @__PURE__ */ jsxRuntime.jsx(
2561
+ children: placedImages.map((img2) => /* @__PURE__ */ jsxDevRuntime.jsxDEV(
2338
2562
  "img",
2339
2563
  {
2340
2564
  src: img2.url,
@@ -2349,9 +2573,24 @@ function ImageRevealSlider({ settings, content, isEditor }) {
2349
2573
  height: "auto"
2350
2574
  }
2351
2575
  },
2352
- img2.id
2576
+ img2.id,
2577
+ false,
2578
+ {
2579
+ fileName: "H:/mom/sdk/src/Components/ImageRevealSlider/ImageRevealSlider.tsx",
2580
+ lineNumber: 237,
2581
+ columnNumber: 9
2582
+ },
2583
+ this
2353
2584
  ))
2354
- }
2585
+ },
2586
+ void 0,
2587
+ false,
2588
+ {
2589
+ fileName: "H:/mom/sdk/src/Components/ImageRevealSlider/ImageRevealSlider.tsx",
2590
+ lineNumber: 229,
2591
+ columnNumber: 5
2592
+ },
2593
+ this
2355
2594
  );
2356
2595
  }
2357
2596
  const ControlImageRevealSliderComponent = {
@@ -2476,7 +2715,7 @@ const ControlImageRevealSliderComponent = {
2476
2715
  },
2477
2716
  default: {
2478
2717
  imageSize: {
2479
- sizeType: "as Is",
2718
+ sizeType: "custom",
2480
2719
  imageWidth: 500,
2481
2720
  randomRangeImageWidth: {
2482
2721
  min: 100,
@@ -2569,23 +2808,51 @@ const ControlImageRevealSliderComponent = {
2569
2808
  {
2570
2809
  image: {
2571
2810
  objectFit: "cover",
2572
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ15T247392621FNTTRCW9D.jpeg",
2811
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740QZCY7R9HD9KTMB6XGPJ4.jpeg",
2573
2812
  name: "Slider-1.jpeg"
2574
2813
  }
2575
2814
  },
2576
2815
  {
2577
2816
  image: {
2578
2817
  objectFit: "cover",
2579
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ17S8TS9T62P7NKTNNEB64.jpeg",
2818
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740S36970GH347RCZ8GW6QF.jpeg",
2580
2819
  name: "Slider-2.jpeg"
2581
2820
  }
2582
2821
  },
2583
2822
  {
2584
2823
  image: {
2585
2824
  objectFit: "cover",
2586
- url: "https://cdn.cntrl.site/projects/01GJ2SMPPCQ7JSNGVXZ2DHWXWF/articles-assets/01JRZ197S89RNT6RA7ZJSX3Z38.jpeg",
2825
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RZ7VG1PWA7CRMR6TW0QS.jpeg",
2587
2826
  name: "Slider-3.jpeg"
2588
2827
  }
2828
+ },
2829
+ {
2830
+ image: {
2831
+ objectFit: "cover",
2832
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RV2XQMBWM2RZABY6AP9N.jpeg",
2833
+ name: "Slider-4.jpeg"
2834
+ }
2835
+ },
2836
+ {
2837
+ image: {
2838
+ objectFit: "cover",
2839
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RQ4E62FG7Y92J4AP8T0A.jpeg",
2840
+ name: "Slider-5.jpeg"
2841
+ }
2842
+ },
2843
+ {
2844
+ image: {
2845
+ objectFit: "cover",
2846
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RE073FS2HZX8AVP3MCR7.jpeg",
2847
+ name: "Slider-6.jpeg"
2848
+ }
2849
+ },
2850
+ {
2851
+ image: {
2852
+ objectFit: "cover",
2853
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740R841W216BPQR07XZN8G4.jpeg",
2854
+ name: "Slider-7.jpeg"
2855
+ }
2589
2856
  }
2590
2857
  ]
2591
2858
  }