@cntrl-site/sdk 1.24.0 → 1.24.2

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
@@ -1322,7 +1322,7 @@ const bottomRightAlignment = "ControlSlider-module__bottomRightAlignment___kEwrz
1322
1322
  const clickOverlay = "ControlSlider-module__clickOverlay___DZA28";
1323
1323
  const contain = "ControlSlider-module__contain___pLyq7";
1324
1324
  const cover = "ControlSlider-module__cover___KdDat";
1325
- const styles$2 = {
1325
+ const styles$3 = {
1326
1326
  wrapper,
1327
1327
  sliderItem,
1328
1328
  sliderImage,
@@ -1366,15 +1366,15 @@ const styles$2 = {
1366
1366
  contain,
1367
1367
  cover
1368
1368
  };
1369
- const link = "RichTextRenderer-module__link___BWeZ2";
1370
- const styles$1 = {
1371
- link
1369
+ const link$1 = "RichTextRenderer-module__link___BWeZ2";
1370
+ const styles$2 = {
1371
+ link: link$1
1372
1372
  };
1373
1373
  const RichTextRenderer = ({ content }) => {
1374
1374
  const getChildren = (children) => {
1375
1375
  return children.map((child, i) => {
1376
1376
  if (child.type === "link") {
1377
- return /* @__PURE__ */ jsxRuntime.jsx("a", { className: styles$1.link, href: child.value, target: child.target, children: getChildren(child.children) }, i);
1377
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { className: styles$2.link, href: child.value, target: child.target, children: getChildren(child.children) }, i);
1378
1378
  }
1379
1379
  return /* @__PURE__ */ jsxRuntime.jsx("span", { style: getLeafCss(child), children: child.text }, i);
1380
1380
  });
@@ -1402,7 +1402,7 @@ function scalingValue(value, isEditor = false) {
1402
1402
  }
1403
1403
  const svg = "SvgImage-module__svg___q3xE-";
1404
1404
  const img = "SvgImage-module__img___VsTm-";
1405
- const styles = {
1405
+ const styles$1 = {
1406
1406
  svg,
1407
1407
  img
1408
1408
  };
@@ -1415,13 +1415,13 @@ const SvgImage = ({ url: url2, fill = "#000000", hoverFill = "#CCCCCC", classNam
1415
1415
  }
1416
1416
  }, []);
1417
1417
  if (!url2.endsWith(".svg") || !supportsMask) {
1418
- return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url2, alt: "", className: cn(styles.img, className) });
1418
+ return /* @__PURE__ */ jsxRuntime.jsx("img", { src: url2, alt: "", className: cn(styles$1.img, className) });
1419
1419
  }
1420
1420
  return /* @__PURE__ */ jsxRuntime.jsx(
1421
1421
  "span",
1422
1422
  {
1423
1423
  "data-supports-mask": supportsMask,
1424
- className: cn(styles.svg, className),
1424
+ className: cn(styles$1.svg, className),
1425
1425
  style: {
1426
1426
  "--svg": `url(${url2})`,
1427
1427
  "--fill": fill,
@@ -1431,15 +1431,15 @@ const SvgImage = ({ url: url2, fill = "#000000", hoverFill = "#CCCCCC", classNam
1431
1431
  );
1432
1432
  };
1433
1433
  const alignmentClassName = {
1434
- "top-left": styles$2.topLeftAlignment,
1435
- "top-center": styles$2.topCenterAlignment,
1436
- "top-right": styles$2.topRightAlignment,
1437
- "middle-left": styles$2.middleLeftAlignment,
1438
- "middle-center": styles$2.middleCenterAlignment,
1439
- "middle-right": styles$2.middleRightAlignment,
1440
- "bottom-left": styles$2.bottomLeftAlignment,
1441
- "bottom-center": styles$2.bottomCenterAlignment,
1442
- "bottom-right": styles$2.bottomRightAlignment
1434
+ "top-left": styles$3.topLeftAlignment,
1435
+ "top-center": styles$3.topCenterAlignment,
1436
+ "top-right": styles$3.topRightAlignment,
1437
+ "middle-left": styles$3.middleLeftAlignment,
1438
+ "middle-center": styles$3.middleCenterAlignment,
1439
+ "middle-right": styles$3.middleRightAlignment,
1440
+ "bottom-left": styles$3.bottomLeftAlignment,
1441
+ "bottom-center": styles$3.bottomCenterAlignment,
1442
+ "bottom-right": styles$3.bottomRightAlignment
1443
1443
  };
1444
1444
  function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1445
1445
  const [sliderRef, setSliderRef] = react.useState(null);
@@ -1474,10 +1474,10 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1474
1474
  setKey((prev) => prev + 1);
1475
1475
  prevSliderTypeRef.current = transition.type;
1476
1476
  }, [transition.type]);
1477
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(styles$2.wrapper, { [styles$2.editor]: isEditor }), ref: setWrapperRef, children: /* @__PURE__ */ jsxRuntime.jsxs(
1477
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(styles$3.wrapper, { [styles$3.editor]: isEditor }), ref: setWrapperRef, children: /* @__PURE__ */ jsxRuntime.jsxs(
1478
1478
  "div",
1479
1479
  {
1480
- className: styles$2.sliderInner,
1480
+ className: styles$3.sliderInner,
1481
1481
  style: {
1482
1482
  width: sliderDimensions ? sliderDimensions.width : "100%",
1483
1483
  height: sliderDimensions ? sliderDimensions.height : "100%",
@@ -1487,17 +1487,17 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1487
1487
  settings.caption.isActive && /* @__PURE__ */ jsxRuntime.jsx(
1488
1488
  "div",
1489
1489
  {
1490
- className: cn(styles$2.captionBlock),
1490
+ className: cn(styles$3.captionBlock),
1491
1491
  children: /* @__PURE__ */ jsxRuntime.jsx(
1492
1492
  "div",
1493
1493
  {
1494
- className: styles$2.captionTextWrapper,
1494
+ className: styles$3.captionTextWrapper,
1495
1495
  children: content.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(
1496
1496
  "div",
1497
1497
  {
1498
- className: cn(styles$2.captionText, alignmentClassName[caption.alignment], {
1499
- [styles$2.withPointerEvents]: index === currentSlideIndex && isEditor,
1500
- [styles$2.active]: index === currentSlideIndex
1498
+ className: cn(styles$3.captionText, alignmentClassName[caption.alignment], {
1499
+ [styles$3.withPointerEvents]: index === currentSlideIndex && isEditor,
1500
+ [styles$3.active]: index === currentSlideIndex
1501
1501
  }),
1502
1502
  style: {
1503
1503
  fontFamily: fontSettings.fontFamily,
@@ -1519,7 +1519,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1519
1519
  "div",
1520
1520
  {
1521
1521
  "data-styles": "caption",
1522
- className: styles$2.captionTextInner,
1522
+ className: styles$3.captionTextInner,
1523
1523
  style: {
1524
1524
  "--link-hover-color": caption.hover,
1525
1525
  position: "relative",
@@ -1562,17 +1562,17 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1562
1562
  children: content.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx(reactSplide.SplideSlide, { children: /* @__PURE__ */ jsxRuntime.jsx(
1563
1563
  "div",
1564
1564
  {
1565
- className: styles$2.sliderItem,
1565
+ className: styles$3.sliderItem,
1566
1566
  children: /* @__PURE__ */ jsxRuntime.jsx(
1567
1567
  "div",
1568
1568
  {
1569
- className: styles$2.imgWrapper,
1569
+ className: styles$3.imgWrapper,
1570
1570
  children: /* @__PURE__ */ jsxRuntime.jsx(
1571
1571
  "img",
1572
1572
  {
1573
- className: cn(styles$2.sliderImage, {
1574
- [styles$2.contain]: item.image.objectFit === "contain",
1575
- [styles$2.cover]: item.image.objectFit === "cover"
1573
+ className: cn(styles$3.sliderImage, {
1574
+ [styles$3.contain]: item.image.objectFit === "contain",
1575
+ [styles$3.cover]: item.image.objectFit === "cover"
1576
1576
  }),
1577
1577
  src: item.image.url,
1578
1578
  alt: item.image.name ?? ""
@@ -1589,8 +1589,8 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1589
1589
  /* @__PURE__ */ jsxRuntime.jsx(
1590
1590
  "div",
1591
1591
  {
1592
- className: cn(styles$2.arrow, {
1593
- [styles$2.arrowVertical]: direction === "vert"
1592
+ className: cn(styles$3.arrow, {
1593
+ [styles$3.arrowVertical]: direction === "vert"
1594
1594
  }),
1595
1595
  style: {
1596
1596
  color: controls.color,
@@ -1602,7 +1602,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1602
1602
  onClick: () => {
1603
1603
  handleArrowClick("-1");
1604
1604
  },
1605
- className: styles$2.arrowInner,
1605
+ className: styles$3.arrowInner,
1606
1606
  style: {
1607
1607
  transform: `translate(${scalingValue(controlsOffsetX, isEditor)}, ${scalingValue(controlsOffsetY * (direction === "horiz" ? 1 : -1), isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
1608
1608
  },
@@ -1613,10 +1613,10 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1613
1613
  url: controls.arrowsImgUrl,
1614
1614
  fill: controls.color,
1615
1615
  hoverFill: controls.hover,
1616
- className: cn(styles$2.arrowImg, styles$2.mirror)
1616
+ className: cn(styles$3.arrowImg, styles$3.mirror)
1617
1617
  }
1618
1618
  ),
1619
- !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$2.arrowIcon, styles$2.arrowImg, styles$2.mirror) })
1619
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg, styles$3.mirror) })
1620
1620
  ]
1621
1621
  }
1622
1622
  )
@@ -1625,8 +1625,8 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1625
1625
  /* @__PURE__ */ jsxRuntime.jsx(
1626
1626
  "div",
1627
1627
  {
1628
- className: cn(styles$2.arrow, styles$2.nextArrow, {
1629
- [styles$2.arrowVertical]: direction === "vert"
1628
+ className: cn(styles$3.arrow, styles$3.nextArrow, {
1629
+ [styles$3.arrowVertical]: direction === "vert"
1630
1630
  }),
1631
1631
  style: {
1632
1632
  color: controls.color,
@@ -1635,7 +1635,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1635
1635
  children: /* @__PURE__ */ jsxRuntime.jsxs(
1636
1636
  "button",
1637
1637
  {
1638
- className: styles$2.arrowInner,
1638
+ className: styles$3.arrowInner,
1639
1639
  onClick: () => handleArrowClick("+1"),
1640
1640
  style: {
1641
1641
  transform: `translate(${scalingValue(controlsOffsetX * (direction === "horiz" ? -1 : 1), isEditor)}, ${scalingValue(controlsOffsetY, isEditor)}) scale(${settings.controls.scale / 100}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
@@ -1647,10 +1647,10 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1647
1647
  url: controls.arrowsImgUrl,
1648
1648
  fill: controls.color,
1649
1649
  hoverFill: controls.hover,
1650
- className: styles$2.arrowImg
1650
+ className: styles$3.arrowImg
1651
1651
  }
1652
1652
  ),
1653
- !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$2.arrowIcon, styles$2.arrowImg) })
1653
+ !controls.arrowsImgUrl && /* @__PURE__ */ jsxRuntime.jsx(ArrowIcon, { color: controls.color, className: cn(styles$3.arrowIcon, styles$3.arrowImg) })
1654
1654
  ]
1655
1655
  }
1656
1656
  )
@@ -1660,7 +1660,7 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1660
1660
  triggers.triggersList.click && /* @__PURE__ */ jsxRuntime.jsx(
1661
1661
  "div",
1662
1662
  {
1663
- className: styles$2.clickOverlay,
1663
+ className: styles$3.clickOverlay,
1664
1664
  onClick: () => {
1665
1665
  if (sliderRef) {
1666
1666
  sliderRef.go("+1");
@@ -1671,21 +1671,21 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1671
1671
  pagination2.isActive && /* @__PURE__ */ jsxRuntime.jsx(
1672
1672
  "div",
1673
1673
  {
1674
- className: cn(styles$2.pagination, {
1675
- [styles$2.paginationInsideBottom]: pagination2.position === "inside-1" && direction === "horiz",
1676
- [styles$2.paginationInsideTop]: pagination2.position === "inside-2" && direction === "horiz",
1677
- [styles$2.paginationOutsideBottom]: pagination2.position === "outside-1" && direction === "horiz",
1678
- [styles$2.paginationOutsideTop]: pagination2.position === "outside-2" && direction === "horiz",
1679
- [styles$2.paginationInsideLeft]: pagination2.position === "inside-1" && direction === "vert",
1680
- [styles$2.paginationInsideRight]: pagination2.position === "inside-2" && direction === "vert",
1681
- [styles$2.paginationOutsideLeft]: pagination2.position === "outside-1" && direction === "vert",
1682
- [styles$2.paginationOutsideRight]: pagination2.position === "outside-2" && direction === "vert",
1683
- [styles$2.paginationVertical]: direction === "vert"
1674
+ className: cn(styles$3.pagination, {
1675
+ [styles$3.paginationInsideBottom]: pagination2.position === "inside-1" && direction === "horiz",
1676
+ [styles$3.paginationInsideTop]: pagination2.position === "inside-2" && direction === "horiz",
1677
+ [styles$3.paginationOutsideBottom]: pagination2.position === "outside-1" && direction === "horiz",
1678
+ [styles$3.paginationOutsideTop]: pagination2.position === "outside-2" && direction === "horiz",
1679
+ [styles$3.paginationInsideLeft]: pagination2.position === "inside-1" && direction === "vert",
1680
+ [styles$3.paginationInsideRight]: pagination2.position === "inside-2" && direction === "vert",
1681
+ [styles$3.paginationOutsideLeft]: pagination2.position === "outside-1" && direction === "vert",
1682
+ [styles$3.paginationOutsideRight]: pagination2.position === "outside-2" && direction === "vert",
1683
+ [styles$3.paginationVertical]: direction === "vert"
1684
1684
  }),
1685
1685
  children: /* @__PURE__ */ jsxRuntime.jsx(
1686
1686
  "div",
1687
1687
  {
1688
- className: styles$2.paginationInner,
1688
+ className: styles$3.paginationInner,
1689
1689
  style: {
1690
1690
  backgroundColor: pagination2.colors[2],
1691
1691
  transform: `scale(${pagination2.scale / 100}) translate(${scalingValue(pagination2.offset.x, isEditor)}, ${scalingValue(pagination2.offset.y, isEditor)}) rotate(${direction === "horiz" ? "0deg" : "90deg"})`
@@ -1698,12 +1698,12 @@ function ControlSlider({ settings, content, styles: sliderStyles, isEditor }) {
1698
1698
  sliderRef.go(index);
1699
1699
  }
1700
1700
  },
1701
- className: cn(styles$2.paginationItem),
1701
+ className: cn(styles$3.paginationItem),
1702
1702
  children: /* @__PURE__ */ jsxRuntime.jsx(
1703
1703
  "div",
1704
1704
  {
1705
- className: cn(styles$2.dot, {
1706
- [styles$2.activeDot]: index === currentSlideIndex
1705
+ className: cn(styles$3.dot, {
1706
+ [styles$3.activeDot]: index === currentSlideIndex
1707
1707
  }),
1708
1708
  style: {
1709
1709
  backgroundColor: index === currentSlideIndex ? pagination2.colors[0] : pagination2.colors[1],
@@ -2274,8 +2274,470 @@ const ControlSliderComponent = {
2274
2274
  required: ["settings", "content", "styles"]
2275
2275
  }
2276
2276
  };
2277
+ const imageRevealSlider = "ImageRevealSlider-module__imageRevealSlider___UE5Ob";
2278
+ const image = "ImageRevealSlider-module__image___Qjt-e";
2279
+ const link = "ImageRevealSlider-module__link___N-iLG";
2280
+ const styles = {
2281
+ imageRevealSlider,
2282
+ image,
2283
+ link
2284
+ };
2285
+ function isMouseOverImage(mouseX, mouseY, placedImages) {
2286
+ for (const img2 of placedImages) {
2287
+ const imgEl = new Image();
2288
+ imgEl.src = img2.url;
2289
+ const imgWidth = img2.width ? Number.parseFloat(img2.width) : imgEl.naturalWidth;
2290
+ const imgHeight = imgEl.naturalHeight / imgEl.naturalWidth * imgWidth;
2291
+ const halfW = imgWidth / 2;
2292
+ const halfH = imgHeight / 2;
2293
+ if (mouseX >= img2.x - halfW && mouseX <= img2.x + halfW && mouseY >= img2.y - halfH && mouseY <= img2.y + halfH) {
2294
+ return true;
2295
+ }
2296
+ }
2297
+ return false;
2298
+ }
2299
+ function getImageSize(url2) {
2300
+ return new Promise((resolve) => {
2301
+ const img2 = new Image();
2302
+ img2.src = url2;
2303
+ img2.onload = () => {
2304
+ resolve({ width: img2.naturalWidth, height: img2.naturalHeight });
2305
+ };
2306
+ });
2307
+ }
2308
+ async function calculateImageWidthHeight(imgUrl, sizeType, customWidth, randomRange) {
2309
+ let width;
2310
+ let height;
2311
+ if (sizeType === "custom") {
2312
+ width = customWidth;
2313
+ const size = await getImageSize(imgUrl);
2314
+ height = size.height / size.width * width;
2315
+ } else if (sizeType === "random") {
2316
+ width = Math.random() * (randomRange.max - randomRange.min) + randomRange.min;
2317
+ const size = await getImageSize(imgUrl);
2318
+ height = size.height / size.width * width;
2319
+ } else {
2320
+ const size = await getImageSize(imgUrl);
2321
+ width = size.width;
2322
+ height = size.height;
2323
+ }
2324
+ return { width, height, finalWidth: `${width}px` };
2325
+ }
2326
+ function ImageRevealSlider({ settings, content, isEditor }) {
2327
+ const divRef = react.useRef(null);
2328
+ const [placedImages, setPlacedImages] = react.useState([]);
2329
+ const [counter, setCounter] = react.useState(0);
2330
+ const imageIdCounter = react.useRef(0);
2331
+ const defaultImageCount = 1;
2332
+ const { sizeType, imageWidth: customWidth, randomRangeImageWidth: randomRange } = settings.imageSize;
2333
+ const { revealPosition, visible, target } = settings.position;
2334
+ const { cursorType, defaultCursor, hoverCursor } = settings.cursor;
2335
+ const createNewImage = async (imgData, containerWidth, containerHeight, position = {}) => {
2336
+ const { width, height, finalWidth } = await calculateImageWidthHeight(
2337
+ imgData.image.url,
2338
+ sizeType,
2339
+ customWidth,
2340
+ randomRange
2341
+ );
2342
+ let x = position.x ?? Math.random() * containerWidth;
2343
+ let y = position.y ?? Math.random() * containerHeight;
2344
+ const adjustedX = Math.min(Math.max(x, width / 2), containerWidth - width / 2);
2345
+ const adjustedY = Math.min(Math.max(y, height / 2), containerHeight - height / 2);
2346
+ return {
2347
+ id: imageIdCounter.current++,
2348
+ url: imgData.image.url,
2349
+ link: imgData.link,
2350
+ name: imgData.image.name,
2351
+ x: adjustedX,
2352
+ y: adjustedY,
2353
+ width: finalWidth
2354
+ };
2355
+ };
2356
+ const defaultContentUrls = react.useMemo(() => {
2357
+ const defaultContentLength = Math.min(content.length, defaultImageCount);
2358
+ return content.filter((_, i) => i < defaultContentLength).map((c) => c.image.url).join("-");
2359
+ }, [content]);
2360
+ react.useEffect(() => {
2361
+ if (!divRef.current || content.length === 0) return;
2362
+ const rect = divRef.current.getBoundingClientRect();
2363
+ const containerWidth = rect.width;
2364
+ const containerHeight = rect.height;
2365
+ const defaultPlaced = [];
2366
+ const placeImages = async () => {
2367
+ for (let i = 0; i < defaultImageCount && i < content.length; i++) {
2368
+ const imgData = content[i];
2369
+ const newImg = await createNewImage(imgData, containerWidth, containerHeight);
2370
+ defaultPlaced.push(newImg);
2371
+ }
2372
+ setPlacedImages(defaultPlaced);
2373
+ setCounter(defaultImageCount % content.length);
2374
+ };
2375
+ placeImages();
2376
+ }, [defaultContentUrls, sizeType, customWidth, randomRange]);
2377
+ react.useEffect(() => {
2378
+ if (visible === "lastOne") {
2379
+ setPlacedImages((prev) => prev.length > 0 ? [prev[prev.length - 1]] : []);
2380
+ }
2381
+ }, [visible]);
2382
+ const handleClick = async (e) => {
2383
+ if (!divRef.current) return;
2384
+ const rect = divRef.current.getBoundingClientRect();
2385
+ const clickX = e.clientX - rect.left;
2386
+ const clickY = e.clientY - rect.top;
2387
+ if (target === "image" && !isMouseOverImage(clickX, clickY, placedImages)) return;
2388
+ let x = 0, y = 0;
2389
+ if (revealPosition === "onClick") {
2390
+ x = clickX;
2391
+ y = clickY;
2392
+ } else if (revealPosition === "same") {
2393
+ x = rect.width / 2;
2394
+ y = rect.height / 2;
2395
+ } else {
2396
+ x = Math.random() * rect.width;
2397
+ y = Math.random() * rect.height;
2398
+ }
2399
+ const imgData = content[counter];
2400
+ const newImage = await createNewImage(imgData, rect.width, rect.height, { x, y });
2401
+ setPlacedImages((prev) => visible === "all" ? [...prev, newImage] : [newImage]);
2402
+ setCounter((prev) => prev >= content.length - 1 ? 0 : prev + 1);
2403
+ };
2404
+ const handleMouseMove = (e) => {
2405
+ if (!divRef.current) return;
2406
+ if (cursorType === "system") {
2407
+ divRef.current.style.cursor = "";
2408
+ return;
2409
+ }
2410
+ const rect = divRef.current.getBoundingClientRect();
2411
+ const mouseX = e.clientX - rect.left;
2412
+ const mouseY = e.clientY - rect.top;
2413
+ const isHover = target === "area" || isMouseOverImage(mouseX, mouseY, placedImages);
2414
+ divRef.current.style.cursor = isHover ? `url(${hoverCursor}), auto` : `url(${defaultCursor}), auto`;
2415
+ };
2416
+ return /* @__PURE__ */ jsxRuntime.jsx(
2417
+ "div",
2418
+ {
2419
+ ref: divRef,
2420
+ onClick: handleClick,
2421
+ onMouseEnter: handleMouseMove,
2422
+ onMouseMove: handleMouseMove,
2423
+ className: styles.imageRevealSlider,
2424
+ children: placedImages.map((img2) => /* @__PURE__ */ jsxRuntime.jsx(
2425
+ "div",
2426
+ {
2427
+ className: styles.wrapper,
2428
+ style: {
2429
+ top: `${img2.y}px`,
2430
+ left: `${img2.x}px`,
2431
+ position: "absolute",
2432
+ transform: "translate(-50%, -50%)",
2433
+ width: img2.width ?? "auto",
2434
+ height: "auto"
2435
+ },
2436
+ children: target === "area" && img2.link ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: img2.link, target: "_blank", className: styles.link, children: /* @__PURE__ */ jsxRuntime.jsx(
2437
+ "img",
2438
+ {
2439
+ src: img2.url,
2440
+ alt: img2.name,
2441
+ className: styles.image
2442
+ },
2443
+ img2.id
2444
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(
2445
+ "img",
2446
+ {
2447
+ src: img2.url,
2448
+ alt: img2.name,
2449
+ className: styles.image
2450
+ },
2451
+ img2.id
2452
+ )
2453
+ }
2454
+ ))
2455
+ }
2456
+ );
2457
+ }
2458
+ const ControlImageRevealSliderComponent = {
2459
+ element: ImageRevealSlider,
2460
+ id: "control-image-reveal",
2461
+ name: "Image reveal",
2462
+ preview: {
2463
+ type: "video",
2464
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K723EY5AH8SKQFK4R31D8FPV.mp4"
2465
+ },
2466
+ defaultSize: {
2467
+ width: 700,
2468
+ height: 400
2469
+ },
2470
+ schema: {
2471
+ type: "object",
2472
+ properties: {
2473
+ settings: {
2474
+ layoutBased: true,
2475
+ type: "object",
2476
+ properties: {
2477
+ imageSize: {
2478
+ name: "IMG SIZE",
2479
+ icon: "size",
2480
+ tooltip: "IMG SIZE",
2481
+ type: "object",
2482
+ properties: {
2483
+ sizeType: {
2484
+ name: "sizeType",
2485
+ type: "string",
2486
+ display: {
2487
+ type: "ratio-group"
2488
+ },
2489
+ enum: ["as Is", "custom", "random"]
2490
+ },
2491
+ imageWidth: {
2492
+ type: "number",
2493
+ label: "W",
2494
+ display: {
2495
+ type: "numeric-input",
2496
+ visible: false
2497
+ }
2498
+ },
2499
+ randomRangeImageWidth: {
2500
+ type: "object",
2501
+ display: {
2502
+ type: "random-range-controls",
2503
+ visible: false
2504
+ },
2505
+ properties: {
2506
+ min: {
2507
+ type: "number"
2508
+ },
2509
+ max: {
2510
+ type: "number"
2511
+ }
2512
+ }
2513
+ }
2514
+ }
2515
+ },
2516
+ cursor: {
2517
+ name: "cursor",
2518
+ icon: "cursor",
2519
+ tooltip: "cursor",
2520
+ type: "object",
2521
+ properties: {
2522
+ cursorType: {
2523
+ name: "cursorType",
2524
+ type: "string",
2525
+ display: {
2526
+ type: "ratio-group"
2527
+ },
2528
+ enum: ["system", "custom"]
2529
+ },
2530
+ defaultCursor: {
2531
+ type: ["string", "null"],
2532
+ display: {
2533
+ type: "settings-image-input",
2534
+ title: "Default",
2535
+ visible: false
2536
+ }
2537
+ },
2538
+ hoverCursor: {
2539
+ type: ["string", "null"],
2540
+ display: {
2541
+ type: "settings-image-input",
2542
+ title: "Hover",
2543
+ visible: false
2544
+ }
2545
+ }
2546
+ }
2547
+ },
2548
+ position: {
2549
+ name: "position",
2550
+ icon: "transition",
2551
+ tooltip: "Position",
2552
+ type: "object",
2553
+ properties: {
2554
+ revealPosition: {
2555
+ type: "string",
2556
+ display: {
2557
+ type: "ratio-group"
2558
+ },
2559
+ enum: ["random", "same", "onClick"]
2560
+ },
2561
+ visible: {
2562
+ type: "string",
2563
+ display: {
2564
+ type: "ratio-group"
2565
+ },
2566
+ enum: ["all", "lastOne"]
2567
+ },
2568
+ target: {
2569
+ type: "string",
2570
+ display: {
2571
+ type: "ratio-group"
2572
+ },
2573
+ enum: ["area", "image"]
2574
+ }
2575
+ }
2576
+ }
2577
+ },
2578
+ default: {
2579
+ imageSize: {
2580
+ sizeType: "custom",
2581
+ imageWidth: 500,
2582
+ randomRangeImageWidth: {
2583
+ min: 100,
2584
+ max: 1e3
2585
+ }
2586
+ },
2587
+ cursor: {
2588
+ cursorType: "system",
2589
+ defaultCursor: null,
2590
+ hoverCursor: null
2591
+ },
2592
+ position: {
2593
+ revealPosition: "random",
2594
+ visible: "all",
2595
+ target: "area"
2596
+ }
2597
+ },
2598
+ displayRules: [
2599
+ {
2600
+ if: {
2601
+ name: "imageSize.sizeType",
2602
+ value: "custom"
2603
+ },
2604
+ then: {
2605
+ name: "properties.imageSize.properties.imageWidth.display.visible",
2606
+ value: true
2607
+ }
2608
+ },
2609
+ {
2610
+ if: {
2611
+ name: "imageSize.sizeType",
2612
+ value: "random"
2613
+ },
2614
+ then: {
2615
+ name: "properties.imageSize.properties.randomRangeImageWidth.display.visible",
2616
+ value: true
2617
+ }
2618
+ },
2619
+ {
2620
+ if: [
2621
+ { name: "position.target", value: "image" },
2622
+ { name: "cursor.cursorType", value: "custom" }
2623
+ ],
2624
+ then: {
2625
+ name: "properties.cursor.properties.defaultCursor.display.visible",
2626
+ value: true
2627
+ }
2628
+ },
2629
+ {
2630
+ if: {
2631
+ name: "cursor.cursorType",
2632
+ value: "custom"
2633
+ },
2634
+ then: {
2635
+ name: "properties.cursor.properties.hoverCursor.display.visible",
2636
+ value: true
2637
+ }
2638
+ }
2639
+ ]
2640
+ },
2641
+ content: {
2642
+ layoutBased: false,
2643
+ type: "array",
2644
+ items: {
2645
+ type: "object",
2646
+ properties: {
2647
+ image: {
2648
+ type: "object",
2649
+ display: {
2650
+ type: "media-input"
2651
+ },
2652
+ properties: {
2653
+ url: {
2654
+ type: "string"
2655
+ },
2656
+ name: {
2657
+ type: "string"
2658
+ },
2659
+ objectFit: {
2660
+ type: "string",
2661
+ enum: ["cover", "contain"]
2662
+ }
2663
+ },
2664
+ required: ["url", "name"]
2665
+ },
2666
+ link: {
2667
+ type: "string",
2668
+ display: {
2669
+ type: "text-input",
2670
+ placeholder: "Enter link..."
2671
+ }
2672
+ }
2673
+ },
2674
+ required: ["image"]
2675
+ },
2676
+ default: [
2677
+ {
2678
+ image: {
2679
+ objectFit: "cover",
2680
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740QZCY7R9HD9KTMB6XGPJ4.jpeg",
2681
+ name: "Slider-1.jpeg"
2682
+ },
2683
+ link: ""
2684
+ },
2685
+ {
2686
+ image: {
2687
+ objectFit: "cover",
2688
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740S36970GH347RCZ8GW6QF.jpeg",
2689
+ name: "Slider-2.jpeg"
2690
+ },
2691
+ link: ""
2692
+ },
2693
+ {
2694
+ image: {
2695
+ objectFit: "cover",
2696
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RZ7VG1PWA7CRMR6TW0QS.jpeg",
2697
+ name: "Slider-3.jpeg"
2698
+ },
2699
+ link: ""
2700
+ },
2701
+ {
2702
+ image: {
2703
+ objectFit: "cover",
2704
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RV2XQMBWM2RZABY6AP9N.jpeg",
2705
+ name: "Slider-4.jpeg"
2706
+ },
2707
+ link: ""
2708
+ },
2709
+ {
2710
+ image: {
2711
+ objectFit: "cover",
2712
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RQ4E62FG7Y92J4AP8T0A.jpeg",
2713
+ name: "Slider-5.jpeg"
2714
+ },
2715
+ link: ""
2716
+ },
2717
+ {
2718
+ image: {
2719
+ objectFit: "cover",
2720
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740RE073FS2HZX8AVP3MCR7.jpeg",
2721
+ name: "Slider-6.jpeg"
2722
+ },
2723
+ link: ""
2724
+ },
2725
+ {
2726
+ image: {
2727
+ objectFit: "cover",
2728
+ url: "https://cdn.cntrl.site/projects/01JJKT02AWY2FGN2QJ7A173RNZ/articles-assets/01K740R841W216BPQR07XZN8G4.jpeg",
2729
+ name: "Slider-7.jpeg"
2730
+ },
2731
+ link: ""
2732
+ }
2733
+ ]
2734
+ }
2735
+ }
2736
+ }
2737
+ };
2277
2738
  const components = [
2278
- ControlSliderComponent
2739
+ ControlSliderComponent,
2740
+ ControlImageRevealSliderComponent
2279
2741
  ];
2280
2742
  exports.AnchorSide = AnchorSide;
2281
2743
  exports.AreaAnchor = AreaAnchor;