@weaverse/react 1.0.4 → 1.0.6
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 +570 -459
- package/dist/index.mjs +558 -447
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -87,6 +87,7 @@ import React4, { forwardRef as forwardRef3, useContext as useContext2, useEffect
|
|
|
87
87
|
// src/constant/index.ts
|
|
88
88
|
var TIMES = ["days", "hours", "minutes", "seconds"];
|
|
89
89
|
var COUNTDOWN_KEY = "wv-cd-evergreen-start";
|
|
90
|
+
var INSTAGRAM_API = "https://graph.instagram.com";
|
|
90
91
|
|
|
91
92
|
// src/utils/index.ts
|
|
92
93
|
function getTime(_seconds) {
|
|
@@ -591,15 +592,20 @@ Video.defaultProps = {
|
|
|
591
592
|
};
|
|
592
593
|
var video_default = Video;
|
|
593
594
|
|
|
594
|
-
// src/elements/
|
|
595
|
-
import {
|
|
596
|
-
import clsx5 from "clsx";
|
|
597
|
-
import React20, { forwardRef as forwardRef8 } from "react";
|
|
595
|
+
// src/elements/instagram.tsx
|
|
596
|
+
import React26, { forwardRef as forwardRef10, useEffect as useEffect3, useState as useState2 } from "react";
|
|
598
597
|
|
|
599
|
-
// src/components/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
598
|
+
// src/components/modal/index.tsx
|
|
599
|
+
var modal_exports = {};
|
|
600
|
+
__export(modal_exports, {
|
|
601
|
+
Modal: () => Modal,
|
|
602
|
+
ModalClose: () => ModalClose,
|
|
603
|
+
ModalContent: () => ModalContent,
|
|
604
|
+
ModalHeader: () => ModalHeader,
|
|
605
|
+
ModalTrigger: () => ModalTrigger
|
|
606
|
+
});
|
|
607
|
+
import { Close, Portal, Root, Trigger } from "@radix-ui/react-dialog";
|
|
608
|
+
import React17, { forwardRef as forwardRef8 } from "react";
|
|
603
609
|
|
|
604
610
|
// src/components/icons/index.tsx
|
|
605
611
|
import React16 from "react";
|
|
@@ -1259,7 +1265,191 @@ function Icon({ name, className, ...props }) {
|
|
|
1259
1265
|
return /* @__PURE__ */ React16.createElement(WeaverseIcon, { className: cls, ...props });
|
|
1260
1266
|
}
|
|
1261
1267
|
|
|
1268
|
+
// src/components/modal/styled.ts
|
|
1269
|
+
import { Content, Overlay as Overlay2, Title } from "@radix-ui/react-dialog";
|
|
1270
|
+
import { keyframes, styled } from "@stitches/react";
|
|
1271
|
+
var overlayShow = keyframes({
|
|
1272
|
+
"0%": { opacity: 0 },
|
|
1273
|
+
"100%": { opacity: 1 }
|
|
1274
|
+
});
|
|
1275
|
+
var contentShow = keyframes({
|
|
1276
|
+
"0%": { opacity: 0, transform: "translate(-50%, -48%) scale(.96)" },
|
|
1277
|
+
"100%": { opacity: 1, transform: "translate(-50%, -50%) scale(1)" }
|
|
1278
|
+
});
|
|
1279
|
+
var StyledOverlay = styled(Overlay2, {
|
|
1280
|
+
display: "block !important",
|
|
1281
|
+
backgroundColor: "rgba(0, 0, 0, .3)",
|
|
1282
|
+
position: "fixed",
|
|
1283
|
+
zIndex: 99999,
|
|
1284
|
+
inset: 0,
|
|
1285
|
+
animation: `${overlayShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
1286
|
+
});
|
|
1287
|
+
var StyledTitle = styled(Title, {
|
|
1288
|
+
margin: "0 0 24px",
|
|
1289
|
+
fontWeight: 500,
|
|
1290
|
+
fontSize: 24,
|
|
1291
|
+
"@media (max-width: 768px)": {
|
|
1292
|
+
margin: "0 0 16px",
|
|
1293
|
+
fontSize: 20
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
var StyledContent = styled(Content, {
|
|
1297
|
+
backgroundColor: "white",
|
|
1298
|
+
borderRadius: 6,
|
|
1299
|
+
boxShadow: "hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
|
|
1300
|
+
position: "fixed",
|
|
1301
|
+
top: "50%",
|
|
1302
|
+
left: "50%",
|
|
1303
|
+
transform: "translate(-50%, -50%)",
|
|
1304
|
+
padding: 24,
|
|
1305
|
+
animation: `${contentShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`,
|
|
1306
|
+
zIndex: 99999,
|
|
1307
|
+
maxWidth: "90vw",
|
|
1308
|
+
width: "auto",
|
|
1309
|
+
"*": {
|
|
1310
|
+
maxWidth: "100%"
|
|
1311
|
+
},
|
|
1312
|
+
"&:focus": { outline: "none" },
|
|
1313
|
+
'&[data-size="fullscreen"]': {
|
|
1314
|
+
width: "100vw",
|
|
1315
|
+
height: "100vh",
|
|
1316
|
+
maxWidth: "100vw",
|
|
1317
|
+
borderRadius: 0
|
|
1318
|
+
},
|
|
1319
|
+
"@media (max-width: 768px)": {
|
|
1320
|
+
width: "90vw",
|
|
1321
|
+
padding: 12,
|
|
1322
|
+
'&[data-size="fullscreen"]': {
|
|
1323
|
+
width: "100vw"
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
});
|
|
1327
|
+
var StyledCloseIcon = styled("button", {
|
|
1328
|
+
all: "unset",
|
|
1329
|
+
cursor: "pointer",
|
|
1330
|
+
fontFamily: "inherit",
|
|
1331
|
+
borderRadius: "100%",
|
|
1332
|
+
height: 32,
|
|
1333
|
+
width: 32,
|
|
1334
|
+
padding: 4,
|
|
1335
|
+
display: "inline-flex",
|
|
1336
|
+
alignItems: "center",
|
|
1337
|
+
justifyContent: "center",
|
|
1338
|
+
color: "rgb(55, 65, 81)",
|
|
1339
|
+
position: "absolute",
|
|
1340
|
+
top: 8,
|
|
1341
|
+
right: 8,
|
|
1342
|
+
"&:hover": {
|
|
1343
|
+
backgroundColor: "rgba(112, 112, 112, .1)"
|
|
1344
|
+
},
|
|
1345
|
+
svg: {
|
|
1346
|
+
width: 24,
|
|
1347
|
+
height: 24
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
// src/components/modal/use-open-change-effect.ts
|
|
1352
|
+
import { useContext as useContext4, useEffect as useEffect2 } from "react";
|
|
1353
|
+
function useOpenChangeEffect(props) {
|
|
1354
|
+
let { open, defaultOpen, onOpenChange } = props;
|
|
1355
|
+
let rootCtx = useContext4(WeaverseContext);
|
|
1356
|
+
let toggleRootzIndex = (open2) => {
|
|
1357
|
+
let { contentRootElement } = rootCtx;
|
|
1358
|
+
if (contentRootElement) {
|
|
1359
|
+
if (open2) {
|
|
1360
|
+
contentRootElement.classList.add("modal-open");
|
|
1361
|
+
} else {
|
|
1362
|
+
contentRootElement.classList.remove("modal-open");
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
};
|
|
1366
|
+
useEffect2(() => {
|
|
1367
|
+
let isOpen = open || defaultOpen;
|
|
1368
|
+
toggleRootzIndex(isOpen);
|
|
1369
|
+
}, [open, defaultOpen]);
|
|
1370
|
+
let handleOpenChange = (open2) => {
|
|
1371
|
+
toggleRootzIndex(open2);
|
|
1372
|
+
onOpenChange?.(open2);
|
|
1373
|
+
};
|
|
1374
|
+
return handleOpenChange;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
// src/components/modal/index.tsx
|
|
1378
|
+
var Modal = (props) => {
|
|
1379
|
+
let { children, open, defaultOpen, onOpenChange, ...rest } = props;
|
|
1380
|
+
let handleOpenChange = useOpenChangeEffect(props);
|
|
1381
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1382
|
+
Root,
|
|
1383
|
+
{
|
|
1384
|
+
open,
|
|
1385
|
+
defaultOpen,
|
|
1386
|
+
onOpenChange: handleOpenChange,
|
|
1387
|
+
...rest
|
|
1388
|
+
},
|
|
1389
|
+
children
|
|
1390
|
+
);
|
|
1391
|
+
};
|
|
1392
|
+
var ModalTrigger = Trigger;
|
|
1393
|
+
var ModalHeader = forwardRef8(
|
|
1394
|
+
(props, ref) => {
|
|
1395
|
+
let { children, ...rest } = props;
|
|
1396
|
+
return /* @__PURE__ */ React17.createElement(StyledTitle, { ref, ...rest, "data-wv-modal-header": true }, children);
|
|
1397
|
+
}
|
|
1398
|
+
);
|
|
1399
|
+
var ModalContent = forwardRef8(
|
|
1400
|
+
(props, ref) => {
|
|
1401
|
+
let { children, size, portal, ...rest } = props;
|
|
1402
|
+
let modalContent = /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(StyledOverlay, null), /* @__PURE__ */ React17.createElement(
|
|
1403
|
+
StyledContent,
|
|
1404
|
+
{
|
|
1405
|
+
...rest,
|
|
1406
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1407
|
+
"data-wv-modal": true,
|
|
1408
|
+
"data-size": size,
|
|
1409
|
+
ref
|
|
1410
|
+
},
|
|
1411
|
+
/* @__PURE__ */ React17.createElement(ModalClose, null),
|
|
1412
|
+
/* @__PURE__ */ React17.createElement("div", { className: "wv-modal-content" }, children)
|
|
1413
|
+
));
|
|
1414
|
+
if (portal) {
|
|
1415
|
+
return /* @__PURE__ */ React17.createElement(Portal, null, modalContent);
|
|
1416
|
+
}
|
|
1417
|
+
return modalContent;
|
|
1418
|
+
}
|
|
1419
|
+
);
|
|
1420
|
+
ModalContent.defaultProps = {
|
|
1421
|
+
size: "auto",
|
|
1422
|
+
portal: false
|
|
1423
|
+
};
|
|
1424
|
+
var ModalClose = forwardRef8(
|
|
1425
|
+
(props, ref) => {
|
|
1426
|
+
let { asChild, children, ...rest } = props;
|
|
1427
|
+
let closeIcon = /* @__PURE__ */ React17.createElement(StyledCloseIcon, null, /* @__PURE__ */ React17.createElement(Icon, { name: "X" }));
|
|
1428
|
+
return /* @__PURE__ */ React17.createElement(Close, { asChild: true, ...rest, ref }, asChild ? children : closeIcon);
|
|
1429
|
+
}
|
|
1430
|
+
);
|
|
1431
|
+
|
|
1432
|
+
// src/components/spinner.tsx
|
|
1433
|
+
import React18 from "react";
|
|
1434
|
+
function Spinner() {
|
|
1435
|
+
return /* @__PURE__ */ React18.createElement("span", { className: "wv-spinner-wrapper" }, /* @__PURE__ */ React18.createElement(Icon, { name: "CircleNotch", className: "wv-spinner" }));
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
// src/components/tooltip.tsx
|
|
1439
|
+
import React19 from "react";
|
|
1440
|
+
function Tooltip({ children }) {
|
|
1441
|
+
return /* @__PURE__ */ React19.createElement("span", { className: "wv-tooltip" }, children);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
// src/components/slider/index.tsx
|
|
1445
|
+
import clsx3 from "clsx";
|
|
1446
|
+
import { useKeenSlider } from "keen-slider/react";
|
|
1447
|
+
import React21, { useState } from "react";
|
|
1448
|
+
|
|
1262
1449
|
// src/components/slider/arrows.tsx
|
|
1450
|
+
import { styled as styled2 } from "@stitches/react";
|
|
1451
|
+
import clsx2 from "clsx";
|
|
1452
|
+
import React20 from "react";
|
|
1263
1453
|
function Arrows(props) {
|
|
1264
1454
|
let { currentSlide, instanceRef, className, icon, offset } = props;
|
|
1265
1455
|
let isFirst = currentSlide === 0;
|
|
@@ -1270,7 +1460,7 @@ function Arrows(props) {
|
|
|
1270
1460
|
let style = {
|
|
1271
1461
|
"--offset": `${offset}px`
|
|
1272
1462
|
};
|
|
1273
|
-
return /* @__PURE__ */
|
|
1463
|
+
return /* @__PURE__ */ React20.createElement(StyledArrows, { className, style }, /* @__PURE__ */ React20.createElement(
|
|
1274
1464
|
"button",
|
|
1275
1465
|
{
|
|
1276
1466
|
type: "button",
|
|
@@ -1280,8 +1470,8 @@ function Arrows(props) {
|
|
|
1280
1470
|
instanceRef?.current?.prev();
|
|
1281
1471
|
}
|
|
1282
1472
|
},
|
|
1283
|
-
/* @__PURE__ */
|
|
1284
|
-
), /* @__PURE__ */
|
|
1473
|
+
/* @__PURE__ */ React20.createElement(Icon, { name: icon === "caret" ? "CaretLeft" : "ArrowLeft" })
|
|
1474
|
+
), /* @__PURE__ */ React20.createElement(
|
|
1285
1475
|
"button",
|
|
1286
1476
|
{
|
|
1287
1477
|
type: "button",
|
|
@@ -1291,10 +1481,10 @@ function Arrows(props) {
|
|
|
1291
1481
|
instanceRef?.current?.next();
|
|
1292
1482
|
}
|
|
1293
1483
|
},
|
|
1294
|
-
/* @__PURE__ */
|
|
1484
|
+
/* @__PURE__ */ React20.createElement(Icon, { name: icon === "caret" ? "CaretRight" : "ArrowRight" })
|
|
1295
1485
|
));
|
|
1296
1486
|
}
|
|
1297
|
-
var StyledArrows =
|
|
1487
|
+
var StyledArrows = styled2("div", {
|
|
1298
1488
|
".arrow": {
|
|
1299
1489
|
position: "absolute",
|
|
1300
1490
|
top: "50%",
|
|
@@ -1335,47 +1525,169 @@ var StyledArrows = styled("div", {
|
|
|
1335
1525
|
}
|
|
1336
1526
|
});
|
|
1337
1527
|
|
|
1338
|
-
// src/components/slider/
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1528
|
+
// src/components/slider/resize-plugin.ts
|
|
1529
|
+
var ResizePlugin = (slider) => {
|
|
1530
|
+
let observer = new ResizeObserver(() => slider.update());
|
|
1531
|
+
slider.on("created", () => {
|
|
1532
|
+
observer.observe(slider.container);
|
|
1533
|
+
});
|
|
1534
|
+
slider.on("destroyed", () => {
|
|
1535
|
+
observer.unobserve(slider.container);
|
|
1536
|
+
});
|
|
1537
|
+
};
|
|
1538
|
+
|
|
1539
|
+
// src/components/slider/index.tsx
|
|
1540
|
+
function Slider(props) {
|
|
1541
|
+
let { children, className, gap, slidesPerView, arrowOffset } = props;
|
|
1542
|
+
let [currentSlide, setCurrentSlide] = useState(0);
|
|
1543
|
+
let [created, setCreated] = useState(false);
|
|
1544
|
+
let [ref, instanceRef] = useKeenSlider(
|
|
1545
|
+
{
|
|
1546
|
+
slides: { perView: slidesPerView, spacing: gap },
|
|
1547
|
+
breakpoints: {
|
|
1548
|
+
"(max-width: 1024px)": {
|
|
1549
|
+
slides: { perView: 3, spacing: gap }
|
|
1550
|
+
},
|
|
1551
|
+
"(max-width: 768px)": {
|
|
1552
|
+
slides: {
|
|
1553
|
+
perView: 1,
|
|
1554
|
+
spacing: 32
|
|
1555
|
+
}
|
|
1360
1556
|
}
|
|
1361
|
-
|
|
1557
|
+
},
|
|
1558
|
+
created: () => {
|
|
1559
|
+
setCreated(true);
|
|
1560
|
+
},
|
|
1561
|
+
slideChanged: (slider) => {
|
|
1562
|
+
setCurrentSlide(slider.track.details.rel);
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
[ResizePlugin]
|
|
1566
|
+
);
|
|
1567
|
+
let _className = clsx3("keen-slider", className);
|
|
1568
|
+
let arrowsClass = clsx3(className && `${className}-arrows`);
|
|
1569
|
+
return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement("div", { ref, className: _className }, /* @__PURE__ */ React21.createElement(
|
|
1570
|
+
"link",
|
|
1571
|
+
{
|
|
1572
|
+
rel: "stylesheet",
|
|
1573
|
+
href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
|
|
1574
|
+
}
|
|
1575
|
+
), children), created && instanceRef?.current && /* @__PURE__ */ React21.createElement(
|
|
1576
|
+
Arrows,
|
|
1577
|
+
{
|
|
1578
|
+
currentSlide,
|
|
1579
|
+
instanceRef,
|
|
1580
|
+
className: arrowsClass,
|
|
1581
|
+
offset: arrowOffset,
|
|
1582
|
+
icon: "arrow"
|
|
1362
1583
|
}
|
|
1363
1584
|
));
|
|
1364
1585
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1586
|
+
|
|
1587
|
+
// src/components/background.tsx
|
|
1588
|
+
import { styled as styled3 } from "@stitches/react";
|
|
1589
|
+
import React22 from "react";
|
|
1590
|
+
function Background2(props) {
|
|
1591
|
+
let {
|
|
1592
|
+
backgroundColor,
|
|
1593
|
+
backgroundImage,
|
|
1594
|
+
backgroundFit,
|
|
1595
|
+
backgroundPosition,
|
|
1596
|
+
className
|
|
1597
|
+
} = props;
|
|
1598
|
+
let style = {
|
|
1599
|
+
["--bg-color"]: backgroundColor,
|
|
1600
|
+
["--bg-fit"]: backgroundFit,
|
|
1601
|
+
["--bg-position"]: backgroundPosition
|
|
1602
|
+
};
|
|
1603
|
+
if (backgroundImage || backgroundColor) {
|
|
1604
|
+
return /* @__PURE__ */ React22.createElement(StyledBackground, { style, className }, backgroundImage && /* @__PURE__ */ React22.createElement(
|
|
1605
|
+
"img",
|
|
1606
|
+
{
|
|
1607
|
+
width: "100%",
|
|
1608
|
+
height: "100%",
|
|
1609
|
+
"data-blink-src": backgroundImage,
|
|
1610
|
+
alt: "Background"
|
|
1611
|
+
}
|
|
1612
|
+
));
|
|
1613
|
+
}
|
|
1614
|
+
return null;
|
|
1615
|
+
}
|
|
1616
|
+
var StyledBackground = styled3("div", {
|
|
1617
|
+
display: "block !important",
|
|
1618
|
+
position: "absolute",
|
|
1619
|
+
inset: 0,
|
|
1620
|
+
backgroundColor: "var(--bg-color)",
|
|
1621
|
+
img: {
|
|
1622
|
+
objectFit: "var(--bg-fit, cover)",
|
|
1623
|
+
objectPosition: "var(--bg-position, 50% 50%)"
|
|
1624
|
+
}
|
|
1625
|
+
});
|
|
1626
|
+
|
|
1627
|
+
// src/components/overlay.tsx
|
|
1628
|
+
import { styled as styled4 } from "@stitches/react";
|
|
1629
|
+
import React23 from "react";
|
|
1630
|
+
function Overlay3(props) {
|
|
1631
|
+
let { enableOverlay: enabled, overlayOpacity: opacity, className } = props;
|
|
1632
|
+
if (enabled) {
|
|
1633
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1634
|
+
StyledOverlay2,
|
|
1635
|
+
{
|
|
1636
|
+
className,
|
|
1637
|
+
css: { ["--overlay-opacity"]: opacity / 100 }
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1640
|
+
}
|
|
1641
|
+
return null;
|
|
1642
|
+
}
|
|
1643
|
+
var StyledOverlay2 = styled4("div", {
|
|
1644
|
+
display: "block !important",
|
|
1645
|
+
position: "absolute",
|
|
1646
|
+
inset: 0,
|
|
1647
|
+
backgroundColor: "rgba(0, 0, 0, var(--overlay-opacity, .3))"
|
|
1648
|
+
});
|
|
1649
|
+
|
|
1650
|
+
// src/components/slider/dots.tsx
|
|
1651
|
+
import { styled as styled5 } from "@stitches/react";
|
|
1652
|
+
import clsx4 from "clsx";
|
|
1653
|
+
import React24 from "react";
|
|
1654
|
+
function Dots(props) {
|
|
1655
|
+
let { currentSlide, instanceRef, className, absolute, position, color } = props;
|
|
1656
|
+
let _className = clsx4(
|
|
1657
|
+
className,
|
|
1658
|
+
absolute && "dots--absolute",
|
|
1659
|
+
position && `dots--${position}`,
|
|
1660
|
+
color && `dots--${color}`
|
|
1661
|
+
);
|
|
1662
|
+
return /* @__PURE__ */ React24.createElement(StyledDots, { className: _className }, [...Array(instanceRef.current?.track.details.slides.length).keys()].map(
|
|
1663
|
+
(idx) => {
|
|
1664
|
+
let className2 = clsx4("dot", currentSlide === idx && "dot--active");
|
|
1665
|
+
return /* @__PURE__ */ React24.createElement(
|
|
1666
|
+
"button",
|
|
1667
|
+
{
|
|
1668
|
+
key: idx,
|
|
1669
|
+
type: "button",
|
|
1670
|
+
onClick: () => instanceRef.current?.moveToIdx(idx),
|
|
1671
|
+
className: className2
|
|
1672
|
+
}
|
|
1673
|
+
);
|
|
1674
|
+
}
|
|
1675
|
+
));
|
|
1676
|
+
}
|
|
1677
|
+
var StyledDots = styled5("div", {
|
|
1678
|
+
padding: "10px 0",
|
|
1679
|
+
display: "flex",
|
|
1680
|
+
justifyContent: "center",
|
|
1681
|
+
alignItems: "center",
|
|
1682
|
+
gap: "12px",
|
|
1683
|
+
"&.dots--absolute": {
|
|
1684
|
+
position: "absolute",
|
|
1685
|
+
"&.dots--top, &.dots--bottom": { left: 0, right: 0 },
|
|
1686
|
+
"&.dots--top": { top: 10 },
|
|
1687
|
+
"&.dots--bottom": { bottom: 10 },
|
|
1688
|
+
"&.dots--left, &.dots--right": {
|
|
1689
|
+
top: 0,
|
|
1690
|
+
bottom: 0,
|
|
1379
1691
|
flexDirection: "column"
|
|
1380
1692
|
},
|
|
1381
1693
|
"&.dots--left": { left: 20 },
|
|
@@ -1407,10 +1719,6 @@ var StyledDots = styled2("div", {
|
|
|
1407
1719
|
}
|
|
1408
1720
|
});
|
|
1409
1721
|
|
|
1410
|
-
// src/elements/slideshow/use-slideshow-configs.ts
|
|
1411
|
-
import { useKeenSlider } from "keen-slider/react";
|
|
1412
|
-
import React19, { useContext as useContext4, useEffect as useEffect2, useState } from "react";
|
|
1413
|
-
|
|
1414
1722
|
// src/components/slider/autoplay-plugin.ts
|
|
1415
1723
|
function AutoplayPlugin(changeSlidesEvery) {
|
|
1416
1724
|
return (slider) => {
|
|
@@ -1444,28 +1752,161 @@ function AutoplayPlugin(changeSlidesEvery) {
|
|
|
1444
1752
|
};
|
|
1445
1753
|
}
|
|
1446
1754
|
|
|
1447
|
-
// src/components/
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1755
|
+
// src/components/placeholder.tsx
|
|
1756
|
+
import React25, { forwardRef as forwardRef9 } from "react";
|
|
1757
|
+
var Placeholder = forwardRef9(
|
|
1758
|
+
(props, ref) => {
|
|
1759
|
+
let { element, className, children, ...rest } = props;
|
|
1760
|
+
return /* @__PURE__ */ React25.createElement("div", { "data-wv-placeholder": true, ref, className, ...rest }, /* @__PURE__ */ React25.createElement("div", { style: { fontWeight: 600, marginBottom: "10px" } }, element), /* @__PURE__ */ React25.createElement("div", null, children));
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
var placeholder_default = Placeholder;
|
|
1764
|
+
|
|
1765
|
+
// src/components/index.ts
|
|
1766
|
+
var Components = {
|
|
1767
|
+
Background: Background2,
|
|
1768
|
+
Icon,
|
|
1769
|
+
ModalComponents: modal_exports,
|
|
1770
|
+
Overlay: Overlay3,
|
|
1771
|
+
Placeholder: placeholder_default,
|
|
1772
|
+
Spinner,
|
|
1773
|
+
Slider,
|
|
1774
|
+
Tooltip
|
|
1775
|
+
};
|
|
1776
|
+
var SliderComponents = {
|
|
1777
|
+
Arrows,
|
|
1778
|
+
Dots,
|
|
1779
|
+
ResizePlugin,
|
|
1780
|
+
AutoplayPlugin
|
|
1456
1781
|
};
|
|
1457
1782
|
|
|
1783
|
+
// src/elements/instagram.tsx
|
|
1784
|
+
var Instagram = forwardRef10(
|
|
1785
|
+
(props, ref) => {
|
|
1786
|
+
let { token, username, numberOfImages, imagesPerRow, gap, ...rest } = props;
|
|
1787
|
+
let [media, setMedia] = useState2([]);
|
|
1788
|
+
let [error, setError] = useState2(null);
|
|
1789
|
+
useEffect3(() => {
|
|
1790
|
+
if (token) {
|
|
1791
|
+
let params = new URLSearchParams({
|
|
1792
|
+
access_token: token,
|
|
1793
|
+
fields: "id,media_type,caption,media_url,permalink,thumbnail_url"
|
|
1794
|
+
});
|
|
1795
|
+
fetch(`${INSTAGRAM_API}/me/media?${params.toString()}`).then((res) => res.json()).then((res) => {
|
|
1796
|
+
if (res.error) {
|
|
1797
|
+
setError(res);
|
|
1798
|
+
} else {
|
|
1799
|
+
setError(null);
|
|
1800
|
+
setMedia([...res.data]);
|
|
1801
|
+
}
|
|
1802
|
+
}).catch(setError);
|
|
1803
|
+
}
|
|
1804
|
+
}, [token]);
|
|
1805
|
+
if (!token || error) {
|
|
1806
|
+
return /* @__PURE__ */ React26.createElement("div", { ref, ...rest }, /* @__PURE__ */ React26.createElement(Components.Placeholder, { element: "Instagram" }, !token ? "Connect to Instagram to display photos on your site." : "Invalid or expired token!"));
|
|
1807
|
+
}
|
|
1808
|
+
let style = {
|
|
1809
|
+
"--wv-ig-images-per-row": imagesPerRow,
|
|
1810
|
+
"--wv-ig-images-gap": gap + "px"
|
|
1811
|
+
};
|
|
1812
|
+
return /* @__PURE__ */ React26.createElement("div", { ref, ...rest, style }, /* @__PURE__ */ React26.createElement("div", { className: "wv-ig-media-container" }, media.slice(0, numberOfImages).map((item) => {
|
|
1813
|
+
let {
|
|
1814
|
+
id,
|
|
1815
|
+
permalink,
|
|
1816
|
+
caption,
|
|
1817
|
+
media_url,
|
|
1818
|
+
media_type,
|
|
1819
|
+
thumbnail_url
|
|
1820
|
+
} = item;
|
|
1821
|
+
if (media_type === "VIDEO") {
|
|
1822
|
+
return /* @__PURE__ */ React26.createElement("video", { key: id, controls: true, poster: thumbnail_url }, /* @__PURE__ */ React26.createElement("source", { src: media_url, type: "video/mp4" }));
|
|
1823
|
+
}
|
|
1824
|
+
return /* @__PURE__ */ React26.createElement("a", { key: id, href: permalink, target: "_blank", rel: "noreferrer" }, /* @__PURE__ */ React26.createElement("img", { alt: caption, src: media_url }));
|
|
1825
|
+
})));
|
|
1826
|
+
}
|
|
1827
|
+
);
|
|
1828
|
+
var css9 = {
|
|
1829
|
+
// '@desktop': {
|
|
1830
|
+
// '.wv-ig-media-container': {
|
|
1831
|
+
// overflow: 'hidden',
|
|
1832
|
+
// maxWidth: '100%',
|
|
1833
|
+
// maxHeight: '100%',
|
|
1834
|
+
// display: 'grid',
|
|
1835
|
+
// gridTemplateColumns: 'repeat(var(--wv-ig-images-per-row, 4), 1fr)',
|
|
1836
|
+
// gap: 'var(--wv-ig-images-gap, 0px)',
|
|
1837
|
+
// img: {
|
|
1838
|
+
// // aspectRatio: '1 / 1',
|
|
1839
|
+
// maxWidth: '100%',
|
|
1840
|
+
// maxHeight: '100%',
|
|
1841
|
+
// objectFit: 'cover',
|
|
1842
|
+
// },
|
|
1843
|
+
// },
|
|
1844
|
+
// },
|
|
1845
|
+
};
|
|
1846
|
+
var permanentCss = {
|
|
1847
|
+
"@desktop": {
|
|
1848
|
+
".wv-ig-media-container": {
|
|
1849
|
+
overflow: "hidden",
|
|
1850
|
+
maxWidth: "100%",
|
|
1851
|
+
maxHeight: "100%",
|
|
1852
|
+
display: "grid",
|
|
1853
|
+
gridTemplateColumns: "repeat(var(--wv-ig-images-per-row, 4), 1fr)",
|
|
1854
|
+
gap: "var(--wv-ig-images-gap, 0px)",
|
|
1855
|
+
img: {
|
|
1856
|
+
// aspectRatio: '1 / 1',
|
|
1857
|
+
maxWidth: "100%",
|
|
1858
|
+
maxHeight: "100%",
|
|
1859
|
+
objectFit: "cover"
|
|
1860
|
+
},
|
|
1861
|
+
video: {
|
|
1862
|
+
width: "100%",
|
|
1863
|
+
height: "100%"
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
"@mobile": {
|
|
1868
|
+
".wv-ig-media-container": {
|
|
1869
|
+
overflowX: "auto",
|
|
1870
|
+
display: "flex",
|
|
1871
|
+
scrollSnapType: "x mandatory"
|
|
1872
|
+
},
|
|
1873
|
+
".wv-ig-media-container a": {
|
|
1874
|
+
scrollSnapAlign: "start",
|
|
1875
|
+
flexGrow: 0,
|
|
1876
|
+
flexShrink: 0,
|
|
1877
|
+
flexBasis: "100%"
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
Instagram.defaultProps = {
|
|
1882
|
+
token: "",
|
|
1883
|
+
username: "",
|
|
1884
|
+
numberOfImages: 8,
|
|
1885
|
+
imagesPerRow: 4,
|
|
1886
|
+
gap: 0
|
|
1887
|
+
};
|
|
1888
|
+
var instagram_default = Instagram;
|
|
1889
|
+
|
|
1890
|
+
// src/elements/slideshow/index.tsx
|
|
1891
|
+
import { css as stitchesCss } from "@stitches/react";
|
|
1892
|
+
import clsx6 from "clsx";
|
|
1893
|
+
import React28, { forwardRef as forwardRef11 } from "react";
|
|
1894
|
+
|
|
1895
|
+
// src/elements/slideshow/use-slideshow-configs.ts
|
|
1896
|
+
import { useKeenSlider as useKeenSlider2 } from "keen-slider/react";
|
|
1897
|
+
import React27, { useContext as useContext5, useEffect as useEffect4, useState as useState3 } from "react";
|
|
1898
|
+
|
|
1458
1899
|
// src/utils/css.ts
|
|
1459
|
-
import
|
|
1460
|
-
function formatCSS(
|
|
1900
|
+
import clsx5 from "clsx";
|
|
1901
|
+
function formatCSS(css12) {
|
|
1461
1902
|
return {
|
|
1462
|
-
"@desktop":
|
|
1463
|
-
"@mobile":
|
|
1903
|
+
"@desktop": css12["@desktop"],
|
|
1904
|
+
"@mobile": css12["@mobile"]
|
|
1464
1905
|
};
|
|
1465
1906
|
}
|
|
1466
1907
|
var permanentClasses = {};
|
|
1467
1908
|
function generateItemClassName(instance, stitchesInstance) {
|
|
1468
|
-
let { css:
|
|
1909
|
+
let { css: css12, type, className: cls = "" } = instance.data;
|
|
1469
1910
|
let className = "";
|
|
1470
1911
|
let permanentClass = "";
|
|
1471
1912
|
let perCss = instance.Element?.permanentCss;
|
|
@@ -1479,12 +1920,12 @@ function generateItemClassName(instance, stitchesInstance) {
|
|
|
1479
1920
|
}
|
|
1480
1921
|
}
|
|
1481
1922
|
className = permanentClass;
|
|
1482
|
-
if (
|
|
1483
|
-
let formattedCss = formatCSS(
|
|
1923
|
+
if (css12) {
|
|
1924
|
+
let formattedCss = formatCSS(css12);
|
|
1484
1925
|
let newStitchesClass = stitchesInstance.css(formattedCss)().className || "";
|
|
1485
1926
|
let { stitchesClass } = instance;
|
|
1486
1927
|
let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
|
|
1487
|
-
className =
|
|
1928
|
+
className = clsx5(permanentClass, cls, newStitchesClass, otherClass);
|
|
1488
1929
|
instance.stitchesClass = newStitchesClass;
|
|
1489
1930
|
}
|
|
1490
1931
|
return className;
|
|
@@ -1513,19 +1954,19 @@ function useSlideshowConfigs(props) {
|
|
|
1513
1954
|
changeSlidesEvery,
|
|
1514
1955
|
children
|
|
1515
1956
|
} = props;
|
|
1516
|
-
let { isDesignMode, isPreviewMode } =
|
|
1517
|
-
let [opacities, setOpacities] =
|
|
1518
|
-
let [cssLoaded, setCssLoaded] =
|
|
1519
|
-
let [created, setCreated] =
|
|
1520
|
-
let [ready, setReady] =
|
|
1521
|
-
let [currentSlide, setCurrentSlide] =
|
|
1957
|
+
let { isDesignMode, isPreviewMode } = useContext5(WeaverseContext);
|
|
1958
|
+
let [opacities, setOpacities] = React27.useState([]);
|
|
1959
|
+
let [cssLoaded, setCssLoaded] = useState3(false);
|
|
1960
|
+
let [created, setCreated] = useState3(false);
|
|
1961
|
+
let [ready, setReady] = useState3(false);
|
|
1962
|
+
let [currentSlide, setCurrentSlide] = useState3(0);
|
|
1522
1963
|
let sliderPlugins = [ResizePlugin];
|
|
1523
1964
|
if (autoRotate && (isPreviewMode || !isDesignMode)) {
|
|
1524
1965
|
sliderPlugins.push(AutoplayPlugin(changeSlidesEvery));
|
|
1525
1966
|
}
|
|
1526
|
-
let [sliderRef, instanceRef] =
|
|
1967
|
+
let [sliderRef, instanceRef] = useKeenSlider2(
|
|
1527
1968
|
{
|
|
1528
|
-
slides: animation === "fade" ?
|
|
1969
|
+
slides: animation === "fade" ? React27.Children.count(children) : { perView: slidesPerView, number: React27.Children.count(children) },
|
|
1529
1970
|
drag: isPreviewMode || !isDesignMode,
|
|
1530
1971
|
loop,
|
|
1531
1972
|
selector: animation === "fade" ? null : ".keen-slider__slide",
|
|
@@ -1555,13 +1996,13 @@ function useSlideshowConfigs(props) {
|
|
|
1555
1996
|
},
|
|
1556
1997
|
sliderPlugins
|
|
1557
1998
|
);
|
|
1558
|
-
|
|
1999
|
+
useEffect4(() => {
|
|
1559
2000
|
loadCSS({
|
|
1560
2001
|
rel: "stylesheet",
|
|
1561
2002
|
href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
|
|
1562
2003
|
}).then(() => setCssLoaded(true));
|
|
1563
2004
|
}, []);
|
|
1564
|
-
|
|
2005
|
+
useEffect4(() => {
|
|
1565
2006
|
if (created && cssLoaded) {
|
|
1566
2007
|
setReady(true);
|
|
1567
2008
|
}
|
|
@@ -1577,7 +2018,7 @@ function useSlideshowConfigs(props) {
|
|
|
1577
2018
|
}
|
|
1578
2019
|
|
|
1579
2020
|
// src/elements/slideshow/index.tsx
|
|
1580
|
-
var Slideshow =
|
|
2021
|
+
var Slideshow = forwardRef11((props, ref) => {
|
|
1581
2022
|
let {
|
|
1582
2023
|
animation,
|
|
1583
2024
|
showArrows,
|
|
@@ -1605,16 +2046,16 @@ var Slideshow = forwardRef8((props, ref) => {
|
|
|
1605
2046
|
}, {})
|
|
1606
2047
|
})().className;
|
|
1607
2048
|
}
|
|
1608
|
-
let _className =
|
|
2049
|
+
let _className = clsx6(
|
|
1609
2050
|
faderClass,
|
|
1610
2051
|
animation === "slide" ? "keen-slider" : "keen-fader"
|
|
1611
2052
|
);
|
|
1612
|
-
let arrowsClass =
|
|
2053
|
+
let arrowsClass = clsx6(
|
|
1613
2054
|
"wv-slideshow--arrows",
|
|
1614
2055
|
showArrowsOnHover && "show-on-hover",
|
|
1615
2056
|
`arrows--${arrowsColor}`
|
|
1616
2057
|
);
|
|
1617
|
-
return /* @__PURE__ */
|
|
2058
|
+
return /* @__PURE__ */ React28.createElement("div", { ref, style, ...rest }, /* @__PURE__ */ React28.createElement("div", { ref: sliderRef, className: _className }, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
|
|
1618
2059
|
Arrows,
|
|
1619
2060
|
{
|
|
1620
2061
|
instanceRef,
|
|
@@ -1623,7 +2064,7 @@ var Slideshow = forwardRef8((props, ref) => {
|
|
|
1623
2064
|
icon: arrowIcon,
|
|
1624
2065
|
offset: 20
|
|
1625
2066
|
}
|
|
1626
|
-
), showDots && created && instanceRef?.current && /* @__PURE__ */
|
|
2067
|
+
), showDots && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
|
|
1627
2068
|
Dots,
|
|
1628
2069
|
{
|
|
1629
2070
|
instanceRef,
|
|
@@ -1635,7 +2076,7 @@ var Slideshow = forwardRef8((props, ref) => {
|
|
|
1635
2076
|
}
|
|
1636
2077
|
));
|
|
1637
2078
|
});
|
|
1638
|
-
var
|
|
2079
|
+
var css10 = {
|
|
1639
2080
|
"@desktop": {
|
|
1640
2081
|
opacity: "var(--slider-opacity, 0)",
|
|
1641
2082
|
padding: "32px 0",
|
|
@@ -1704,80 +2145,7 @@ Slideshow.defaultProps = {
|
|
|
1704
2145
|
var slideshow_default = Slideshow;
|
|
1705
2146
|
|
|
1706
2147
|
// src/elements/slideshow/slide.tsx
|
|
1707
|
-
import
|
|
1708
|
-
|
|
1709
|
-
// src/components/background.tsx
|
|
1710
|
-
import { styled as styled3 } from "@stitches/react";
|
|
1711
|
-
import React21 from "react";
|
|
1712
|
-
function Background2(props) {
|
|
1713
|
-
let {
|
|
1714
|
-
backgroundColor,
|
|
1715
|
-
backgroundImage,
|
|
1716
|
-
backgroundFit,
|
|
1717
|
-
backgroundPosition,
|
|
1718
|
-
className
|
|
1719
|
-
} = props;
|
|
1720
|
-
let style = {
|
|
1721
|
-
["--bg-color"]: backgroundColor,
|
|
1722
|
-
["--bg-fit"]: backgroundFit,
|
|
1723
|
-
["--bg-position"]: backgroundPosition
|
|
1724
|
-
};
|
|
1725
|
-
if (backgroundImage || backgroundColor) {
|
|
1726
|
-
return /* @__PURE__ */ React21.createElement(StyledBackground, { style, className }, backgroundImage && /* @__PURE__ */ React21.createElement(
|
|
1727
|
-
"img",
|
|
1728
|
-
{
|
|
1729
|
-
width: "100%",
|
|
1730
|
-
height: "100%",
|
|
1731
|
-
"data-blink-src": backgroundImage,
|
|
1732
|
-
alt: "Background"
|
|
1733
|
-
}
|
|
1734
|
-
));
|
|
1735
|
-
}
|
|
1736
|
-
return null;
|
|
1737
|
-
}
|
|
1738
|
-
var StyledBackground = styled3("div", {
|
|
1739
|
-
display: "block !important",
|
|
1740
|
-
position: "absolute",
|
|
1741
|
-
inset: 0,
|
|
1742
|
-
backgroundColor: "var(--bg-color)",
|
|
1743
|
-
img: {
|
|
1744
|
-
objectFit: "var(--bg-fit, cover)",
|
|
1745
|
-
objectPosition: "var(--bg-position, 50% 50%)"
|
|
1746
|
-
}
|
|
1747
|
-
});
|
|
1748
|
-
|
|
1749
|
-
// src/components/overlay.tsx
|
|
1750
|
-
import { styled as styled4 } from "@stitches/react";
|
|
1751
|
-
import React22 from "react";
|
|
1752
|
-
function Overlay2(props) {
|
|
1753
|
-
let { enableOverlay: enabled, overlayOpacity: opacity, className } = props;
|
|
1754
|
-
if (enabled) {
|
|
1755
|
-
return /* @__PURE__ */ React22.createElement(
|
|
1756
|
-
StyledOverlay,
|
|
1757
|
-
{
|
|
1758
|
-
className,
|
|
1759
|
-
css: { ["--overlay-opacity"]: opacity / 100 }
|
|
1760
|
-
}
|
|
1761
|
-
);
|
|
1762
|
-
}
|
|
1763
|
-
return null;
|
|
1764
|
-
}
|
|
1765
|
-
var StyledOverlay = styled4("div", {
|
|
1766
|
-
display: "block !important",
|
|
1767
|
-
position: "absolute",
|
|
1768
|
-
inset: 0,
|
|
1769
|
-
backgroundColor: "rgba(0, 0, 0, var(--overlay-opacity, .3))"
|
|
1770
|
-
});
|
|
1771
|
-
|
|
1772
|
-
// src/components/placeholder.tsx
|
|
1773
|
-
import React23, { forwardRef as forwardRef9 } from "react";
|
|
1774
|
-
var Placeholder = forwardRef9(
|
|
1775
|
-
(props, ref) => {
|
|
1776
|
-
let { element, className, children, ...rest } = props;
|
|
1777
|
-
return /* @__PURE__ */ React23.createElement("div", { "data-wv-placeholder": true, ref, className, ...rest }, /* @__PURE__ */ React23.createElement("div", { style: { fontWeight: 600, marginBottom: "10px" } }, element), /* @__PURE__ */ React23.createElement("div", null, children));
|
|
1778
|
-
}
|
|
1779
|
-
);
|
|
1780
|
-
var placeholder_default = Placeholder;
|
|
2148
|
+
import React29, { forwardRef as forwardRef12 } from "react";
|
|
1781
2149
|
|
|
1782
2150
|
// src/elements/slideshow/position.ts
|
|
1783
2151
|
var slidePositionMap = {
|
|
@@ -1820,7 +2188,7 @@ var slidePositionMap = {
|
|
|
1820
2188
|
};
|
|
1821
2189
|
|
|
1822
2190
|
// src/elements/slideshow/slide.tsx
|
|
1823
|
-
var Slide =
|
|
2191
|
+
var Slide = forwardRef12((props, ref) => {
|
|
1824
2192
|
let {
|
|
1825
2193
|
contentPosition,
|
|
1826
2194
|
backgroundColor,
|
|
@@ -1832,7 +2200,7 @@ var Slide = forwardRef10((props, ref) => {
|
|
|
1832
2200
|
children,
|
|
1833
2201
|
...rest
|
|
1834
2202
|
} = props;
|
|
1835
|
-
return /* @__PURE__ */
|
|
2203
|
+
return /* @__PURE__ */ React29.createElement("div", { className: "keen-slider__slide" }, /* @__PURE__ */ React29.createElement(
|
|
1836
2204
|
Background2,
|
|
1837
2205
|
{
|
|
1838
2206
|
backgroundColor,
|
|
@@ -1841,16 +2209,16 @@ var Slide = forwardRef10((props, ref) => {
|
|
|
1841
2209
|
backgroundPosition,
|
|
1842
2210
|
className: "slide-background"
|
|
1843
2211
|
}
|
|
1844
|
-
), /* @__PURE__ */
|
|
1845
|
-
|
|
2212
|
+
), /* @__PURE__ */ React29.createElement(
|
|
2213
|
+
Overlay3,
|
|
1846
2214
|
{
|
|
1847
2215
|
enableOverlay,
|
|
1848
2216
|
overlayOpacity,
|
|
1849
2217
|
className: "slide-overlay"
|
|
1850
2218
|
}
|
|
1851
|
-
), /* @__PURE__ */
|
|
2219
|
+
), /* @__PURE__ */ React29.createElement("div", { ref, style: slidePositionMap[contentPosition], ...rest }, children?.length ? children : /* @__PURE__ */ React29.createElement(placeholder_default, { element: "Slide", className: "wv-slide-placeholder" }, "Drag and drop elements here")));
|
|
1852
2220
|
});
|
|
1853
|
-
var
|
|
2221
|
+
var css11 = {
|
|
1854
2222
|
"@desktop": {
|
|
1855
2223
|
position: "relative",
|
|
1856
2224
|
height: "100%",
|
|
@@ -1897,12 +2265,12 @@ var Elements = {
|
|
|
1897
2265
|
type: "image",
|
|
1898
2266
|
defaultCss: css4
|
|
1899
2267
|
},
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
2268
|
+
Instagram: {
|
|
2269
|
+
Component: instagram_default,
|
|
2270
|
+
type: "instagram",
|
|
2271
|
+
defaultCss: css9,
|
|
2272
|
+
permanentCss
|
|
2273
|
+
},
|
|
1906
2274
|
Layout: {
|
|
1907
2275
|
Component: layout_default,
|
|
1908
2276
|
type: "layout",
|
|
@@ -1951,12 +2319,12 @@ var Elements = {
|
|
|
1951
2319
|
Slideshow: {
|
|
1952
2320
|
Component: slideshow_default,
|
|
1953
2321
|
type: "slideshow",
|
|
1954
|
-
defaultCss:
|
|
2322
|
+
defaultCss: css10
|
|
1955
2323
|
},
|
|
1956
2324
|
Slide: {
|
|
1957
2325
|
Component: slide_default,
|
|
1958
2326
|
type: "slide",
|
|
1959
|
-
defaultCss:
|
|
2327
|
+
defaultCss: css11
|
|
1960
2328
|
}
|
|
1961
2329
|
};
|
|
1962
2330
|
|
|
@@ -1993,7 +2361,6 @@ function initUploadCareAdaptiveDelivery(baseUrl) {
|
|
|
1993
2361
|
// src/context.ts
|
|
1994
2362
|
var createRootContext = (configs) => {
|
|
1995
2363
|
let rootContext = new Weaverse(configs);
|
|
1996
|
-
initUploadCareAdaptiveDelivery(configs.weaverseHost);
|
|
1997
2364
|
Object.keys(Elements).forEach((key) => {
|
|
1998
2365
|
rootContext.registerElement(Elements[key]);
|
|
1999
2366
|
});
|
|
@@ -2003,273 +2370,17 @@ var WeaverseContext = createContext({});
|
|
|
2003
2370
|
var WeaverseContextProvider = WeaverseContext.Provider;
|
|
2004
2371
|
var WeaverseContextConsumer = WeaverseContext.Consumer;
|
|
2005
2372
|
|
|
2006
|
-
// src/components/modal/index.tsx
|
|
2007
|
-
var modal_exports = {};
|
|
2008
|
-
__export(modal_exports, {
|
|
2009
|
-
Modal: () => Modal,
|
|
2010
|
-
ModalClose: () => ModalClose,
|
|
2011
|
-
ModalContent: () => ModalContent,
|
|
2012
|
-
ModalHeader: () => ModalHeader,
|
|
2013
|
-
ModalTrigger: () => ModalTrigger
|
|
2014
|
-
});
|
|
2015
|
-
import { Close, Portal, Root, Trigger } from "@radix-ui/react-dialog";
|
|
2016
|
-
import React25, { forwardRef as forwardRef11 } from "react";
|
|
2017
|
-
|
|
2018
|
-
// src/components/modal/styled.ts
|
|
2019
|
-
import { Content, Overlay as Overlay3, Title } from "@radix-ui/react-dialog";
|
|
2020
|
-
import { keyframes, styled as styled5 } from "@stitches/react";
|
|
2021
|
-
var overlayShow = keyframes({
|
|
2022
|
-
"0%": { opacity: 0 },
|
|
2023
|
-
"100%": { opacity: 1 }
|
|
2024
|
-
});
|
|
2025
|
-
var contentShow = keyframes({
|
|
2026
|
-
"0%": { opacity: 0, transform: "translate(-50%, -48%) scale(.96)" },
|
|
2027
|
-
"100%": { opacity: 1, transform: "translate(-50%, -50%) scale(1)" }
|
|
2028
|
-
});
|
|
2029
|
-
var StyledOverlay2 = styled5(Overlay3, {
|
|
2030
|
-
display: "block !important",
|
|
2031
|
-
backgroundColor: "rgba(0, 0, 0, .3)",
|
|
2032
|
-
position: "fixed",
|
|
2033
|
-
zIndex: 99999,
|
|
2034
|
-
inset: 0,
|
|
2035
|
-
animation: `${overlayShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
2036
|
-
});
|
|
2037
|
-
var StyledTitle = styled5(Title, {
|
|
2038
|
-
margin: "0 0 24px",
|
|
2039
|
-
fontWeight: 500,
|
|
2040
|
-
fontSize: 24,
|
|
2041
|
-
"@media (max-width: 768px)": {
|
|
2042
|
-
margin: "0 0 16px",
|
|
2043
|
-
fontSize: 20
|
|
2044
|
-
}
|
|
2045
|
-
});
|
|
2046
|
-
var StyledContent = styled5(Content, {
|
|
2047
|
-
backgroundColor: "white",
|
|
2048
|
-
borderRadius: 6,
|
|
2049
|
-
boxShadow: "hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
|
|
2050
|
-
position: "fixed",
|
|
2051
|
-
top: "50%",
|
|
2052
|
-
left: "50%",
|
|
2053
|
-
transform: "translate(-50%, -50%)",
|
|
2054
|
-
padding: 24,
|
|
2055
|
-
animation: `${contentShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`,
|
|
2056
|
-
zIndex: 99999,
|
|
2057
|
-
maxWidth: "90vw",
|
|
2058
|
-
width: "auto",
|
|
2059
|
-
"*": {
|
|
2060
|
-
maxWidth: "100%"
|
|
2061
|
-
},
|
|
2062
|
-
"&:focus": { outline: "none" },
|
|
2063
|
-
'&[data-size="fullscreen"]': {
|
|
2064
|
-
width: "100vw",
|
|
2065
|
-
height: "100vh",
|
|
2066
|
-
maxWidth: "100vw",
|
|
2067
|
-
borderRadius: 0
|
|
2068
|
-
},
|
|
2069
|
-
"@media (max-width: 768px)": {
|
|
2070
|
-
width: "90vw",
|
|
2071
|
-
padding: 12,
|
|
2072
|
-
'&[data-size="fullscreen"]': {
|
|
2073
|
-
width: "100vw"
|
|
2074
|
-
}
|
|
2075
|
-
}
|
|
2076
|
-
});
|
|
2077
|
-
var StyledCloseIcon = styled5("button", {
|
|
2078
|
-
all: "unset",
|
|
2079
|
-
cursor: "pointer",
|
|
2080
|
-
fontFamily: "inherit",
|
|
2081
|
-
borderRadius: "100%",
|
|
2082
|
-
height: 32,
|
|
2083
|
-
width: 32,
|
|
2084
|
-
padding: 4,
|
|
2085
|
-
display: "inline-flex",
|
|
2086
|
-
alignItems: "center",
|
|
2087
|
-
justifyContent: "center",
|
|
2088
|
-
color: "rgb(55, 65, 81)",
|
|
2089
|
-
position: "absolute",
|
|
2090
|
-
top: 8,
|
|
2091
|
-
right: 8,
|
|
2092
|
-
"&:hover": {
|
|
2093
|
-
backgroundColor: "rgba(112, 112, 112, .1)"
|
|
2094
|
-
},
|
|
2095
|
-
svg: {
|
|
2096
|
-
width: 24,
|
|
2097
|
-
height: 24
|
|
2098
|
-
}
|
|
2099
|
-
});
|
|
2100
|
-
|
|
2101
|
-
// src/components/modal/use-open-change-effect.ts
|
|
2102
|
-
import { useContext as useContext5, useEffect as useEffect3 } from "react";
|
|
2103
|
-
function useOpenChangeEffect(props) {
|
|
2104
|
-
let { open, defaultOpen, onOpenChange } = props;
|
|
2105
|
-
let rootCtx = useContext5(WeaverseContext);
|
|
2106
|
-
let toggleRootzIndex = (open2) => {
|
|
2107
|
-
let { contentRootElement } = rootCtx;
|
|
2108
|
-
if (contentRootElement) {
|
|
2109
|
-
if (open2) {
|
|
2110
|
-
contentRootElement.classList.add("modal-open");
|
|
2111
|
-
} else {
|
|
2112
|
-
contentRootElement.classList.remove("modal-open");
|
|
2113
|
-
}
|
|
2114
|
-
}
|
|
2115
|
-
};
|
|
2116
|
-
useEffect3(() => {
|
|
2117
|
-
let isOpen = open || defaultOpen;
|
|
2118
|
-
toggleRootzIndex(isOpen);
|
|
2119
|
-
}, [open, defaultOpen]);
|
|
2120
|
-
let handleOpenChange = (open2) => {
|
|
2121
|
-
toggleRootzIndex(open2);
|
|
2122
|
-
onOpenChange?.(open2);
|
|
2123
|
-
};
|
|
2124
|
-
return handleOpenChange;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
// src/components/modal/index.tsx
|
|
2128
|
-
var Modal = (props) => {
|
|
2129
|
-
let { children, open, defaultOpen, onOpenChange, ...rest } = props;
|
|
2130
|
-
let handleOpenChange = useOpenChangeEffect(props);
|
|
2131
|
-
return /* @__PURE__ */ React25.createElement(
|
|
2132
|
-
Root,
|
|
2133
|
-
{
|
|
2134
|
-
open,
|
|
2135
|
-
defaultOpen,
|
|
2136
|
-
onOpenChange: handleOpenChange,
|
|
2137
|
-
...rest
|
|
2138
|
-
},
|
|
2139
|
-
children
|
|
2140
|
-
);
|
|
2141
|
-
};
|
|
2142
|
-
var ModalTrigger = Trigger;
|
|
2143
|
-
var ModalHeader = forwardRef11(
|
|
2144
|
-
(props, ref) => {
|
|
2145
|
-
let { children, ...rest } = props;
|
|
2146
|
-
return /* @__PURE__ */ React25.createElement(StyledTitle, { ref, ...rest, "data-wv-modal-header": true }, children);
|
|
2147
|
-
}
|
|
2148
|
-
);
|
|
2149
|
-
var ModalContent = forwardRef11(
|
|
2150
|
-
(props, ref) => {
|
|
2151
|
-
let { children, size, portal, ...rest } = props;
|
|
2152
|
-
let modalContent = /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(StyledOverlay2, null), /* @__PURE__ */ React25.createElement(
|
|
2153
|
-
StyledContent,
|
|
2154
|
-
{
|
|
2155
|
-
...rest,
|
|
2156
|
-
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
2157
|
-
"data-wv-modal": true,
|
|
2158
|
-
"data-size": size,
|
|
2159
|
-
ref
|
|
2160
|
-
},
|
|
2161
|
-
/* @__PURE__ */ React25.createElement(ModalClose, null),
|
|
2162
|
-
/* @__PURE__ */ React25.createElement("div", { className: "wv-modal-content" }, children)
|
|
2163
|
-
));
|
|
2164
|
-
if (portal) {
|
|
2165
|
-
return /* @__PURE__ */ React25.createElement(Portal, null, modalContent);
|
|
2166
|
-
}
|
|
2167
|
-
return modalContent;
|
|
2168
|
-
}
|
|
2169
|
-
);
|
|
2170
|
-
ModalContent.defaultProps = {
|
|
2171
|
-
size: "auto",
|
|
2172
|
-
portal: false
|
|
2173
|
-
};
|
|
2174
|
-
var ModalClose = forwardRef11(
|
|
2175
|
-
(props, ref) => {
|
|
2176
|
-
let { asChild, children, ...rest } = props;
|
|
2177
|
-
let closeIcon = /* @__PURE__ */ React25.createElement(StyledCloseIcon, null, /* @__PURE__ */ React25.createElement(Icon, { name: "X" }));
|
|
2178
|
-
return /* @__PURE__ */ React25.createElement(Close, { asChild: true, ...rest, ref }, asChild ? children : closeIcon);
|
|
2179
|
-
}
|
|
2180
|
-
);
|
|
2181
|
-
|
|
2182
|
-
// src/components/spinner.tsx
|
|
2183
|
-
import React26 from "react";
|
|
2184
|
-
function Spinner() {
|
|
2185
|
-
return /* @__PURE__ */ React26.createElement("span", { className: "wv-spinner-wrapper" }, /* @__PURE__ */ React26.createElement(Icon, { name: "CircleNotch", className: "wv-spinner" }));
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2188
|
-
// src/components/tooltip.tsx
|
|
2189
|
-
import React27 from "react";
|
|
2190
|
-
function Tooltip({ children }) {
|
|
2191
|
-
return /* @__PURE__ */ React27.createElement("span", { className: "wv-tooltip" }, children);
|
|
2192
|
-
}
|
|
2193
|
-
|
|
2194
|
-
// src/components/slider/index.tsx
|
|
2195
|
-
import clsx6 from "clsx";
|
|
2196
|
-
import { useKeenSlider as useKeenSlider2 } from "keen-slider/react";
|
|
2197
|
-
import React28, { useState as useState2 } from "react";
|
|
2198
|
-
function Slider(props) {
|
|
2199
|
-
let { children, className, gap, slidesPerView, arrowOffset } = props;
|
|
2200
|
-
let [currentSlide, setCurrentSlide] = useState2(0);
|
|
2201
|
-
let [created, setCreated] = useState2(false);
|
|
2202
|
-
let [ref, instanceRef] = useKeenSlider2(
|
|
2203
|
-
{
|
|
2204
|
-
slides: { perView: slidesPerView, spacing: gap },
|
|
2205
|
-
breakpoints: {
|
|
2206
|
-
"(max-width: 1024px)": {
|
|
2207
|
-
slides: { perView: 3, spacing: gap }
|
|
2208
|
-
},
|
|
2209
|
-
"(max-width: 768px)": {
|
|
2210
|
-
slides: {
|
|
2211
|
-
perView: 1,
|
|
2212
|
-
spacing: 32
|
|
2213
|
-
}
|
|
2214
|
-
}
|
|
2215
|
-
},
|
|
2216
|
-
created: () => {
|
|
2217
|
-
setCreated(true);
|
|
2218
|
-
},
|
|
2219
|
-
slideChanged: (slider) => {
|
|
2220
|
-
setCurrentSlide(slider.track.details.rel);
|
|
2221
|
-
}
|
|
2222
|
-
},
|
|
2223
|
-
[ResizePlugin]
|
|
2224
|
-
);
|
|
2225
|
-
let _className = clsx6("keen-slider", className);
|
|
2226
|
-
let arrowsClass = clsx6(className && `${className}-arrows`);
|
|
2227
|
-
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement("div", { ref, className: _className }, /* @__PURE__ */ React28.createElement(
|
|
2228
|
-
"link",
|
|
2229
|
-
{
|
|
2230
|
-
rel: "stylesheet",
|
|
2231
|
-
href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
|
|
2232
|
-
}
|
|
2233
|
-
), children), created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
|
|
2234
|
-
Arrows,
|
|
2235
|
-
{
|
|
2236
|
-
currentSlide,
|
|
2237
|
-
instanceRef,
|
|
2238
|
-
className: arrowsClass,
|
|
2239
|
-
offset: arrowOffset,
|
|
2240
|
-
icon: "arrow"
|
|
2241
|
-
}
|
|
2242
|
-
));
|
|
2243
|
-
}
|
|
2244
|
-
|
|
2245
|
-
// src/components/index.ts
|
|
2246
|
-
var Components = {
|
|
2247
|
-
Background: Background2,
|
|
2248
|
-
Icon,
|
|
2249
|
-
ModalComponents: modal_exports,
|
|
2250
|
-
Overlay: Overlay2,
|
|
2251
|
-
Placeholder: placeholder_default,
|
|
2252
|
-
Spinner,
|
|
2253
|
-
Slider,
|
|
2254
|
-
Tooltip
|
|
2255
|
-
};
|
|
2256
|
-
var SliderComponents = {
|
|
2257
|
-
Arrows,
|
|
2258
|
-
Dots,
|
|
2259
|
-
ResizePlugin,
|
|
2260
|
-
AutoplayPlugin
|
|
2261
|
-
};
|
|
2262
|
-
|
|
2263
2373
|
// src/renderer.tsx
|
|
2264
2374
|
import { isBrowser as isBrowser2 } from "@weaverse/core";
|
|
2265
|
-
import
|
|
2375
|
+
import React30, { useContext as useContext6, useEffect as useEffect5, useRef, useState as useState4 } from "react";
|
|
2266
2376
|
var WeaverseRoot = ({ context }) => {
|
|
2267
|
-
let [, setData] =
|
|
2377
|
+
let [, setData] = useState4(context.data);
|
|
2268
2378
|
let rootRef = useRef();
|
|
2269
2379
|
let renderRoot = () => setData({});
|
|
2270
|
-
|
|
2380
|
+
useEffect5(() => {
|
|
2271
2381
|
context.subscribe(renderRoot);
|
|
2272
2382
|
context.contentRootElement = rootRef.current;
|
|
2383
|
+
initUploadCareAdaptiveDelivery(context.weaverseHost);
|
|
2273
2384
|
return () => {
|
|
2274
2385
|
context.unsubscribe(renderRoot);
|
|
2275
2386
|
};
|
|
@@ -2277,24 +2388,24 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2277
2388
|
let eventHandlers = context?.studioBridge?.eventHandlers || {};
|
|
2278
2389
|
let themeClass = context.stitchesInstance.theme.className;
|
|
2279
2390
|
if (context.data?.rootId) {
|
|
2280
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2281
2392
|
"div",
|
|
2282
2393
|
{
|
|
2283
2394
|
className: `weaverse-content-root ${themeClass}`,
|
|
2284
2395
|
...eventHandlers,
|
|
2285
2396
|
ref: rootRef
|
|
2286
2397
|
},
|
|
2287
|
-
/* @__PURE__ */
|
|
2288
|
-
context.platformType === "react-ssr" ? /* @__PURE__ */
|
|
2398
|
+
/* @__PURE__ */ React30.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ React30.createElement(ItemInstance, { id: context.data.rootId })),
|
|
2399
|
+
context.platformType === "react-ssr" ? /* @__PURE__ */ React30.createElement(StitchesSSR, { stitchesInstance: context.stitchesInstance }) : null
|
|
2289
2400
|
);
|
|
2290
2401
|
}
|
|
2291
2402
|
return null;
|
|
2292
2403
|
};
|
|
2293
2404
|
var ItemComponent = ({ instance }) => {
|
|
2294
2405
|
let { stitchesInstance, elementInstances } = useContext6(WeaverseContext);
|
|
2295
|
-
let [data, setData] =
|
|
2296
|
-
let { id, type, childIds = [], css:
|
|
2297
|
-
|
|
2406
|
+
let [data, setData] = useState4(instance.data);
|
|
2407
|
+
let { id, type, childIds = [], css: css12, className, ...rest } = data;
|
|
2408
|
+
useEffect5(() => {
|
|
2298
2409
|
let render = (data2) => setData({ ...data2 });
|
|
2299
2410
|
instance.subscribe(render);
|
|
2300
2411
|
if (isBrowser2 && !instance.ref.current) {
|
|
@@ -2310,7 +2421,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
2310
2421
|
if (Component.$$typeof === Symbol.for("react.forward_ref")) {
|
|
2311
2422
|
rest.ref = instance.ref;
|
|
2312
2423
|
}
|
|
2313
|
-
return /* @__PURE__ */
|
|
2424
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2314
2425
|
Component,
|
|
2315
2426
|
{
|
|
2316
2427
|
key: id,
|
|
@@ -2319,7 +2430,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
2319
2430
|
className: generateItemClassName(instance, stitchesInstance),
|
|
2320
2431
|
...rest
|
|
2321
2432
|
},
|
|
2322
|
-
childIds.map((id2) => /* @__PURE__ */
|
|
2433
|
+
childIds.map((id2) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: id2, id: id2 }))
|
|
2323
2434
|
);
|
|
2324
2435
|
} else {
|
|
2325
2436
|
console.log(`Unknown element: ${type}`);
|
|
@@ -2328,7 +2439,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
2328
2439
|
};
|
|
2329
2440
|
var StitchesSSR = ({ stitchesInstance }) => {
|
|
2330
2441
|
const stitchesCss2 = stitchesInstance.getCssText();
|
|
2331
|
-
return /* @__PURE__ */
|
|
2442
|
+
return /* @__PURE__ */ React30.createElement(
|
|
2332
2443
|
"style",
|
|
2333
2444
|
{
|
|
2334
2445
|
id: "stitches",
|
|
@@ -2343,9 +2454,9 @@ var ItemInstance = ({ id }) => {
|
|
|
2343
2454
|
let { itemInstances } = context;
|
|
2344
2455
|
let instance = itemInstances.get(id);
|
|
2345
2456
|
if (!instance) {
|
|
2346
|
-
return /* @__PURE__ */
|
|
2457
|
+
return /* @__PURE__ */ React30.createElement("div", { style: { display: "none" } }, "Item instance ", id, " not found");
|
|
2347
2458
|
}
|
|
2348
|
-
return /* @__PURE__ */
|
|
2459
|
+
return /* @__PURE__ */ React30.createElement(ItemComponent, { key: id, instance });
|
|
2349
2460
|
};
|
|
2350
2461
|
export {
|
|
2351
2462
|
Components,
|