@weaverse/react 0.7.58 → 0.7.60
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.d.ts +25 -2
- package/dist/index.js +287 -140
- package/dist/index.mjs +260 -114
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -489,6 +489,7 @@ var Text = React10.forwardRef(
|
|
|
489
489
|
);
|
|
490
490
|
var css7 = {
|
|
491
491
|
"@desktop": {
|
|
492
|
+
display: "flex",
|
|
492
493
|
padding: "10px",
|
|
493
494
|
overflow: "hidden",
|
|
494
495
|
".wv-text-content": {
|
|
@@ -626,8 +627,9 @@ Video.defaultProps = {
|
|
|
626
627
|
var Video_default = Video;
|
|
627
628
|
|
|
628
629
|
// src/elements/Slideshow/index.tsx
|
|
629
|
-
import {
|
|
630
|
-
import
|
|
630
|
+
import { css as stitchesCss } from "@stitches/react";
|
|
631
|
+
import clsx5 from "clsx";
|
|
632
|
+
import React20, { forwardRef as forwardRef8 } from "react";
|
|
631
633
|
|
|
632
634
|
// src/components/Slider/Arrows.tsx
|
|
633
635
|
import { styled } from "@stitches/react";
|
|
@@ -893,25 +895,21 @@ function Icon({ name, className, ...props }) {
|
|
|
893
895
|
|
|
894
896
|
// src/components/Slider/Arrows.tsx
|
|
895
897
|
function Arrows(props) {
|
|
896
|
-
let { currentSlide, instanceRef, className } = props;
|
|
897
|
-
let
|
|
898
|
-
let
|
|
898
|
+
let { currentSlide, instanceRef, className, offset } = props;
|
|
899
|
+
let isFirst = currentSlide === 0;
|
|
900
|
+
let isLast = false;
|
|
899
901
|
if (instanceRef.current) {
|
|
900
|
-
|
|
902
|
+
isLast = currentSlide === instanceRef?.current?.track?.details?.maxIdx;
|
|
901
903
|
}
|
|
902
|
-
let
|
|
903
|
-
"
|
|
904
|
-
|
|
905
|
-
);
|
|
906
|
-
let arrowRightClass = clsx2(
|
|
907
|
-
"wv-slider-arrow arrow--right",
|
|
908
|
-
isLastSlide && "arrow--disabled"
|
|
909
|
-
);
|
|
904
|
+
let style = {
|
|
905
|
+
"--offset": `${offset}px`
|
|
906
|
+
};
|
|
910
907
|
return /* @__PURE__ */ React17.createElement(StyledArrows, {
|
|
911
|
-
className
|
|
908
|
+
className,
|
|
909
|
+
style
|
|
912
910
|
}, /* @__PURE__ */ React17.createElement("button", {
|
|
913
911
|
type: "button",
|
|
914
|
-
className:
|
|
912
|
+
className: clsx2("arrow arrow--left", isFirst && "arrow--disabled"),
|
|
915
913
|
onClick: (e) => {
|
|
916
914
|
e.stopPropagation();
|
|
917
915
|
instanceRef?.current?.prev();
|
|
@@ -920,7 +918,7 @@ function Arrows(props) {
|
|
|
920
918
|
name: "ArrowLeft"
|
|
921
919
|
})), /* @__PURE__ */ React17.createElement("button", {
|
|
922
920
|
type: "button",
|
|
923
|
-
className:
|
|
921
|
+
className: clsx2("arrow arrow--right", isLast && "arrow--disabled"),
|
|
924
922
|
onClick: (e) => {
|
|
925
923
|
e.stopPropagation();
|
|
926
924
|
instanceRef?.current?.next();
|
|
@@ -930,7 +928,7 @@ function Arrows(props) {
|
|
|
930
928
|
})));
|
|
931
929
|
}
|
|
932
930
|
var StyledArrows = styled("div", {
|
|
933
|
-
".
|
|
931
|
+
".arrow": {
|
|
934
932
|
position: "absolute",
|
|
935
933
|
top: "50%",
|
|
936
934
|
transform: "translateY(-50%)",
|
|
@@ -954,17 +952,17 @@ var StyledArrows = styled("div", {
|
|
|
954
952
|
height: "22px"
|
|
955
953
|
},
|
|
956
954
|
"&.arrow--left": {
|
|
957
|
-
left: "
|
|
955
|
+
left: "var(--offset, 0px)"
|
|
958
956
|
},
|
|
959
957
|
"&.arrow--right": {
|
|
960
|
-
right: "
|
|
958
|
+
right: "var(--offset, 0px)"
|
|
961
959
|
},
|
|
962
960
|
"&.arrow--disabled": {
|
|
963
961
|
opacity: 0.5
|
|
964
962
|
}
|
|
965
963
|
},
|
|
966
964
|
"@media (max-width: 768px)": {
|
|
967
|
-
".
|
|
965
|
+
".arrow": {
|
|
968
966
|
display: "none"
|
|
969
967
|
}
|
|
970
968
|
}
|
|
@@ -975,9 +973,15 @@ import { styled as styled2 } from "@stitches/react";
|
|
|
975
973
|
import clsx3 from "clsx";
|
|
976
974
|
import React18 from "react";
|
|
977
975
|
function Dots(props) {
|
|
978
|
-
let { currentSlide, instanceRef, className } = props;
|
|
976
|
+
let { currentSlide, instanceRef, className, absolute, position, color } = props;
|
|
977
|
+
let _className = clsx3(
|
|
978
|
+
className,
|
|
979
|
+
absolute && "dots--absolute",
|
|
980
|
+
position && `dots--${position}`,
|
|
981
|
+
color && `dots--${color}`
|
|
982
|
+
);
|
|
979
983
|
return /* @__PURE__ */ React18.createElement(StyledDots, {
|
|
980
|
-
className
|
|
984
|
+
className: _className
|
|
981
985
|
}, [...Array(instanceRef.current?.track.details.slides.length).keys()].map(
|
|
982
986
|
(idx) => {
|
|
983
987
|
let className2 = clsx3("dot", currentSlide === idx && "dot--active");
|
|
@@ -992,22 +996,86 @@ function Dots(props) {
|
|
|
992
996
|
}
|
|
993
997
|
var StyledDots = styled2("div", {
|
|
994
998
|
padding: "10px 0",
|
|
999
|
+
display: "flex",
|
|
995
1000
|
justifyContent: "center",
|
|
1001
|
+
alignItems: "center",
|
|
1002
|
+
gap: "12px",
|
|
1003
|
+
"&.dots--absolute": {
|
|
1004
|
+
position: "absolute",
|
|
1005
|
+
"&.dots--top, &.dots--bottom": { left: 0, right: 0 },
|
|
1006
|
+
"&.dots--top": { top: 10 },
|
|
1007
|
+
"&.dots--bottom": { bottom: 10 },
|
|
1008
|
+
"&.dots--left, &.dots--right": {
|
|
1009
|
+
top: 0,
|
|
1010
|
+
bottom: 0,
|
|
1011
|
+
flexDirection: "column"
|
|
1012
|
+
},
|
|
1013
|
+
"&.dots--left": { left: 20 },
|
|
1014
|
+
"&.dots--right": { right: 20 }
|
|
1015
|
+
},
|
|
1016
|
+
"&.dots--light": {
|
|
1017
|
+
".dot": {
|
|
1018
|
+
backgroundColor: "#ffffff66",
|
|
1019
|
+
"&.dot--active": {
|
|
1020
|
+
backgroundColor: "#ffffff"
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
},
|
|
1024
|
+
"&.dots--dark": {
|
|
1025
|
+
".dot": {
|
|
1026
|
+
backgroundColor: "#00000033",
|
|
1027
|
+
"&.dot--active": {
|
|
1028
|
+
backgroundColor: "#000000"
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
},
|
|
996
1032
|
".dot": {
|
|
997
1033
|
width: "9px",
|
|
998
1034
|
height: "9px",
|
|
999
1035
|
padding: "0",
|
|
1000
|
-
margin: "0 5px",
|
|
1001
1036
|
border: "none",
|
|
1002
1037
|
borderRadius: "50%",
|
|
1003
|
-
|
|
1004
|
-
transition: "all 0.2s ease-in-out",
|
|
1005
|
-
"&.dot--active": {
|
|
1006
|
-
background: "#212529"
|
|
1007
|
-
}
|
|
1038
|
+
transition: "all 0.2s ease-in-out"
|
|
1008
1039
|
}
|
|
1009
1040
|
});
|
|
1010
1041
|
|
|
1042
|
+
// src/elements/Slideshow/useSlideshowConfigs.ts
|
|
1043
|
+
import { useKeenSlider } from "keen-slider/react";
|
|
1044
|
+
import React19, { useContext as useContext4, useEffect as useEffect2, useState } from "react";
|
|
1045
|
+
|
|
1046
|
+
// src/components/Slider/AutoplayPlugin.ts
|
|
1047
|
+
function AutoplayPlugin(changeSlidesEvery) {
|
|
1048
|
+
return (slider) => {
|
|
1049
|
+
let timeout;
|
|
1050
|
+
let mouseOver = false;
|
|
1051
|
+
function clearNextTimeout() {
|
|
1052
|
+
clearTimeout(timeout);
|
|
1053
|
+
}
|
|
1054
|
+
function nextTimeout() {
|
|
1055
|
+
clearTimeout(timeout);
|
|
1056
|
+
if (mouseOver)
|
|
1057
|
+
return;
|
|
1058
|
+
timeout = setTimeout(() => {
|
|
1059
|
+
slider.next();
|
|
1060
|
+
}, changeSlidesEvery * 1e3);
|
|
1061
|
+
}
|
|
1062
|
+
slider.on("created", () => {
|
|
1063
|
+
slider.container.addEventListener("mouseover", () => {
|
|
1064
|
+
mouseOver = true;
|
|
1065
|
+
clearNextTimeout();
|
|
1066
|
+
});
|
|
1067
|
+
slider.container.addEventListener("mouseout", () => {
|
|
1068
|
+
mouseOver = false;
|
|
1069
|
+
nextTimeout();
|
|
1070
|
+
});
|
|
1071
|
+
nextTimeout();
|
|
1072
|
+
});
|
|
1073
|
+
slider.on("dragStarted", clearNextTimeout);
|
|
1074
|
+
slider.on("animationEnded", nextTimeout);
|
|
1075
|
+
slider.on("updated", nextTimeout);
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1011
1079
|
// src/components/Slider/ResizePlugin.ts
|
|
1012
1080
|
var ResizePlugin = (slider) => {
|
|
1013
1081
|
let observer = new ResizeObserver(() => slider.update());
|
|
@@ -1067,37 +1135,46 @@ function loadCSS(attrs) {
|
|
|
1067
1135
|
});
|
|
1068
1136
|
}
|
|
1069
1137
|
|
|
1070
|
-
// src/elements/Slideshow/
|
|
1071
|
-
|
|
1138
|
+
// src/elements/Slideshow/useSlideshowConfigs.ts
|
|
1139
|
+
function useSlideshowConfigs(props) {
|
|
1072
1140
|
let {
|
|
1073
1141
|
animation,
|
|
1074
1142
|
slidesPerView,
|
|
1075
|
-
|
|
1076
|
-
showArrows,
|
|
1077
|
-
showDots,
|
|
1078
|
-
dotsPosition,
|
|
1143
|
+
loop,
|
|
1079
1144
|
autoRotate,
|
|
1080
1145
|
changeSlidesEvery,
|
|
1081
|
-
children
|
|
1082
|
-
...rest
|
|
1146
|
+
children
|
|
1083
1147
|
} = props;
|
|
1148
|
+
let { isDesignMode, isPreviewMode } = useContext4(WeaverseContext);
|
|
1149
|
+
let [opacities, setOpacities] = React19.useState([]);
|
|
1084
1150
|
let [cssLoaded, setCssLoaded] = useState(false);
|
|
1085
1151
|
let [created, setCreated] = useState(false);
|
|
1086
1152
|
let [ready, setReady] = useState(false);
|
|
1087
1153
|
let [currentSlide, setCurrentSlide] = useState(0);
|
|
1154
|
+
let sliderPlugins = [ResizePlugin];
|
|
1155
|
+
if (autoRotate && (isPreviewMode || !isDesignMode)) {
|
|
1156
|
+
sliderPlugins.push(AutoplayPlugin(changeSlidesEvery));
|
|
1157
|
+
}
|
|
1088
1158
|
let [sliderRef, instanceRef] = useKeenSlider(
|
|
1089
1159
|
{
|
|
1090
|
-
slides: {
|
|
1091
|
-
|
|
1092
|
-
|
|
1160
|
+
slides: animation === "fade" ? React19.Children.count(children) : { perView: slidesPerView },
|
|
1161
|
+
drag: isPreviewMode || !isDesignMode,
|
|
1162
|
+
loop,
|
|
1163
|
+
selector: animation === "fade" ? null : ".keen-slider__slide",
|
|
1093
1164
|
created: () => {
|
|
1094
1165
|
setCreated(true);
|
|
1095
1166
|
},
|
|
1096
1167
|
slideChanged: (slider) => {
|
|
1097
1168
|
setCurrentSlide(slider.track.details.rel);
|
|
1169
|
+
},
|
|
1170
|
+
detailsChanged: (slider) => {
|
|
1171
|
+
let newOpacities = slider.track?.details?.slides?.map(
|
|
1172
|
+
(slide) => slide.portion
|
|
1173
|
+
);
|
|
1174
|
+
setOpacities(newOpacities);
|
|
1098
1175
|
}
|
|
1099
1176
|
},
|
|
1100
|
-
|
|
1177
|
+
sliderPlugins
|
|
1101
1178
|
);
|
|
1102
1179
|
useEffect2(() => {
|
|
1103
1180
|
loadCSS({
|
|
@@ -1110,53 +1187,105 @@ var Slideshow = forwardRef8((props, ref) => {
|
|
|
1110
1187
|
setReady(true);
|
|
1111
1188
|
}
|
|
1112
1189
|
}, [created, cssLoaded]);
|
|
1190
|
+
return {
|
|
1191
|
+
sliderRef,
|
|
1192
|
+
instanceRef,
|
|
1193
|
+
currentSlide,
|
|
1194
|
+
opacities,
|
|
1195
|
+
ready,
|
|
1196
|
+
created
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
// src/elements/Slideshow/index.tsx
|
|
1201
|
+
var Slideshow = forwardRef8((props, ref) => {
|
|
1202
|
+
let {
|
|
1203
|
+
animation,
|
|
1204
|
+
showArrows,
|
|
1205
|
+
showDots,
|
|
1206
|
+
dotsPosition,
|
|
1207
|
+
dotsColor,
|
|
1208
|
+
children,
|
|
1209
|
+
...rest
|
|
1210
|
+
} = props;
|
|
1211
|
+
let { sliderRef, instanceRef, currentSlide, opacities, ready, created } = useSlideshowConfigs(props);
|
|
1113
1212
|
let style = {
|
|
1114
1213
|
"--slider-opacity": ready ? 1 : 0
|
|
1115
1214
|
};
|
|
1116
|
-
|
|
1215
|
+
let faderClass = "";
|
|
1216
|
+
if (animation === "fade") {
|
|
1217
|
+
faderClass = stitchesCss({
|
|
1218
|
+
".keen-slider__slide": opacities.reduce((acc, opacity, index) => {
|
|
1219
|
+
acc[`&:nth-child(${index + 1})`] = {
|
|
1220
|
+
opacity
|
|
1221
|
+
};
|
|
1222
|
+
return acc;
|
|
1223
|
+
}, {})
|
|
1224
|
+
})().className;
|
|
1225
|
+
}
|
|
1226
|
+
let _className = clsx5(
|
|
1227
|
+
faderClass,
|
|
1228
|
+
animation === "slide" ? "keen-slider" : "keen-fader"
|
|
1229
|
+
);
|
|
1230
|
+
return /* @__PURE__ */ React20.createElement("div", {
|
|
1117
1231
|
ref,
|
|
1118
1232
|
style,
|
|
1119
1233
|
...rest
|
|
1120
|
-
}, /* @__PURE__ */
|
|
1234
|
+
}, /* @__PURE__ */ React20.createElement("div", {
|
|
1121
1235
|
ref: sliderRef,
|
|
1122
|
-
className:
|
|
1123
|
-
}, children), showArrows && created && instanceRef?.current && /* @__PURE__ */
|
|
1236
|
+
className: _className
|
|
1237
|
+
}, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ React20.createElement(Arrows, {
|
|
1124
1238
|
instanceRef,
|
|
1125
1239
|
currentSlide,
|
|
1126
|
-
className: "wv-slideshow--arrows"
|
|
1127
|
-
|
|
1240
|
+
className: "wv-slideshow--arrows",
|
|
1241
|
+
offset: 20
|
|
1242
|
+
}), showDots && created && instanceRef?.current && /* @__PURE__ */ React20.createElement(Dots, {
|
|
1128
1243
|
instanceRef,
|
|
1129
1244
|
currentSlide,
|
|
1130
|
-
className: "wv-slideshow--dots"
|
|
1245
|
+
className: "wv-slideshow--dots",
|
|
1246
|
+
position: dotsPosition,
|
|
1247
|
+
color: dotsColor,
|
|
1248
|
+
absolute: true
|
|
1131
1249
|
}));
|
|
1132
1250
|
});
|
|
1133
1251
|
var css9 = {
|
|
1134
1252
|
"@desktop": {
|
|
1135
1253
|
opacity: "var(--slider-opacity, 0)",
|
|
1136
1254
|
padding: "32px 0",
|
|
1255
|
+
position: "relative",
|
|
1137
1256
|
".keen-slider": {
|
|
1138
1257
|
height: "100%"
|
|
1258
|
+
},
|
|
1259
|
+
".keen-fader": {
|
|
1260
|
+
position: "relative",
|
|
1261
|
+
height: "100%",
|
|
1262
|
+
".keen-slider__slide": {
|
|
1263
|
+
position: "absolute",
|
|
1264
|
+
inset: 0
|
|
1265
|
+
}
|
|
1139
1266
|
}
|
|
1140
1267
|
}
|
|
1141
1268
|
};
|
|
1142
1269
|
Slideshow.defaultProps = {
|
|
1143
|
-
animation: "
|
|
1270
|
+
animation: "slide",
|
|
1144
1271
|
slidesPerView: 1,
|
|
1145
1272
|
spacing: 0,
|
|
1146
1273
|
showArrows: true,
|
|
1147
1274
|
showDots: true,
|
|
1148
1275
|
dotsPosition: "bottom",
|
|
1276
|
+
dotsColor: "light",
|
|
1277
|
+
loop: true,
|
|
1149
1278
|
autoRotate: false,
|
|
1150
1279
|
changeSlidesEvery: 5
|
|
1151
1280
|
};
|
|
1152
1281
|
var Slideshow_default = Slideshow;
|
|
1153
1282
|
|
|
1154
1283
|
// src/elements/Slideshow/Slide.tsx
|
|
1155
|
-
import
|
|
1284
|
+
import React24, { forwardRef as forwardRef10 } from "react";
|
|
1156
1285
|
|
|
1157
1286
|
// src/components/Background.tsx
|
|
1158
1287
|
import { styled as styled3 } from "@stitches/react";
|
|
1159
|
-
import
|
|
1288
|
+
import React21 from "react";
|
|
1160
1289
|
function Background2(props) {
|
|
1161
1290
|
let {
|
|
1162
1291
|
backgroundColor,
|
|
@@ -1171,10 +1300,10 @@ function Background2(props) {
|
|
|
1171
1300
|
["--bg-position"]: backgroundPosition
|
|
1172
1301
|
};
|
|
1173
1302
|
if (backgroundImage || backgroundColor) {
|
|
1174
|
-
return /* @__PURE__ */
|
|
1303
|
+
return /* @__PURE__ */ React21.createElement(StyledBackground, {
|
|
1175
1304
|
style,
|
|
1176
1305
|
className
|
|
1177
|
-
}, backgroundImage && /* @__PURE__ */
|
|
1306
|
+
}, backgroundImage && /* @__PURE__ */ React21.createElement("img", {
|
|
1178
1307
|
width: "100%",
|
|
1179
1308
|
height: "100%",
|
|
1180
1309
|
"data-blink-src": backgroundImage,
|
|
@@ -1196,11 +1325,11 @@ var StyledBackground = styled3("div", {
|
|
|
1196
1325
|
|
|
1197
1326
|
// src/components/Overlay.tsx
|
|
1198
1327
|
import { styled as styled4 } from "@stitches/react";
|
|
1199
|
-
import
|
|
1328
|
+
import React22 from "react";
|
|
1200
1329
|
function Overlay2(props) {
|
|
1201
1330
|
let { enableOverlay: enabled, overlayOpacity: opacity, className } = props;
|
|
1202
1331
|
if (enabled) {
|
|
1203
|
-
return /* @__PURE__ */
|
|
1332
|
+
return /* @__PURE__ */ React22.createElement(StyledOverlay, {
|
|
1204
1333
|
className,
|
|
1205
1334
|
css: { ["--overlay-opacity"]: opacity / 100 }
|
|
1206
1335
|
});
|
|
@@ -1214,6 +1343,23 @@ var StyledOverlay = styled4("div", {
|
|
|
1214
1343
|
backgroundColor: "rgba(0, 0, 0, var(--overlay-opacity, .3))"
|
|
1215
1344
|
});
|
|
1216
1345
|
|
|
1346
|
+
// src/components/Placeholder.tsx
|
|
1347
|
+
import React23, { forwardRef as forwardRef9 } from "react";
|
|
1348
|
+
var Placeholder = forwardRef9(
|
|
1349
|
+
(props, ref) => {
|
|
1350
|
+
let { element, className, children, ...rest } = props;
|
|
1351
|
+
return /* @__PURE__ */ React23.createElement("div", {
|
|
1352
|
+
"data-wv-placeholder": true,
|
|
1353
|
+
ref,
|
|
1354
|
+
className,
|
|
1355
|
+
...rest
|
|
1356
|
+
}, /* @__PURE__ */ React23.createElement("div", {
|
|
1357
|
+
style: { fontWeight: 600, marginBottom: "10px" }
|
|
1358
|
+
}, element), /* @__PURE__ */ React23.createElement("div", null, children));
|
|
1359
|
+
}
|
|
1360
|
+
);
|
|
1361
|
+
var Placeholder_default = Placeholder;
|
|
1362
|
+
|
|
1217
1363
|
// src/elements/Slideshow/position.ts
|
|
1218
1364
|
var slidePositionMap = {
|
|
1219
1365
|
"top left": {
|
|
@@ -1255,7 +1401,7 @@ var slidePositionMap = {
|
|
|
1255
1401
|
};
|
|
1256
1402
|
|
|
1257
1403
|
// src/elements/Slideshow/Slide.tsx
|
|
1258
|
-
var Slide =
|
|
1404
|
+
var Slide = forwardRef10((props, ref) => {
|
|
1259
1405
|
let {
|
|
1260
1406
|
contentPosition,
|
|
1261
1407
|
backgroundColor,
|
|
@@ -1267,34 +1413,41 @@ var Slide = forwardRef9((props, ref) => {
|
|
|
1267
1413
|
children,
|
|
1268
1414
|
...rest
|
|
1269
1415
|
} = props;
|
|
1270
|
-
|
|
1271
|
-
return /* @__PURE__ */ React22.createElement("div", {
|
|
1416
|
+
return /* @__PURE__ */ React24.createElement("div", {
|
|
1272
1417
|
className: "keen-slider__slide"
|
|
1273
|
-
}, /* @__PURE__ */
|
|
1418
|
+
}, /* @__PURE__ */ React24.createElement(Background2, {
|
|
1274
1419
|
backgroundColor,
|
|
1275
1420
|
backgroundImage,
|
|
1276
1421
|
backgroundFit,
|
|
1277
1422
|
backgroundPosition,
|
|
1278
1423
|
className: "slide-background"
|
|
1279
|
-
}), /* @__PURE__ */
|
|
1424
|
+
}), /* @__PURE__ */ React24.createElement(Overlay2, {
|
|
1280
1425
|
enableOverlay,
|
|
1281
1426
|
overlayOpacity,
|
|
1282
1427
|
className: "slide-overlay"
|
|
1283
|
-
}), /* @__PURE__ */
|
|
1428
|
+
}), /* @__PURE__ */ React24.createElement("div", {
|
|
1284
1429
|
ref,
|
|
1285
|
-
style,
|
|
1430
|
+
style: slidePositionMap[contentPosition],
|
|
1286
1431
|
...rest
|
|
1287
|
-
}, children?.length ? children :
|
|
1432
|
+
}, children?.length ? children : /* @__PURE__ */ React24.createElement(Placeholder_default, {
|
|
1433
|
+
element: "Slide",
|
|
1434
|
+
className: "wv-slide-placeholder"
|
|
1435
|
+
}, "Drag and drop elements here")));
|
|
1288
1436
|
});
|
|
1289
1437
|
var css10 = {
|
|
1290
1438
|
"@desktop": {
|
|
1291
1439
|
position: "relative",
|
|
1292
1440
|
height: "100%",
|
|
1293
1441
|
width: "1224px",
|
|
1442
|
+
maxWidth: "100%",
|
|
1294
1443
|
margin: "0 auto",
|
|
1295
1444
|
display: "flex",
|
|
1296
1445
|
flexDirection: "column",
|
|
1297
|
-
padding: "100px 20px"
|
|
1446
|
+
padding: "100px 20px",
|
|
1447
|
+
".wv-slide-placeholder": {
|
|
1448
|
+
height: "200px",
|
|
1449
|
+
zIndex: 1
|
|
1450
|
+
}
|
|
1298
1451
|
}
|
|
1299
1452
|
};
|
|
1300
1453
|
Slide.defaultProps = {
|
|
@@ -1372,22 +1525,6 @@ var WeaverseContext = createContext({});
|
|
|
1372
1525
|
var WeaverseContextProvider = WeaverseContext.Provider;
|
|
1373
1526
|
var WeaverseContextConsumer = WeaverseContext.Consumer;
|
|
1374
1527
|
|
|
1375
|
-
// src/components/Placeholder.tsx
|
|
1376
|
-
import React23, { forwardRef as forwardRef10 } from "react";
|
|
1377
|
-
var Placeholder = forwardRef10(
|
|
1378
|
-
(props, ref) => {
|
|
1379
|
-
let { element, children, ...rest } = props;
|
|
1380
|
-
return /* @__PURE__ */ React23.createElement("div", {
|
|
1381
|
-
"data-wv-placeholder": true,
|
|
1382
|
-
ref,
|
|
1383
|
-
...rest
|
|
1384
|
-
}, /* @__PURE__ */ React23.createElement("div", {
|
|
1385
|
-
style: { fontWeight: 600, marginBottom: "10px" }
|
|
1386
|
-
}, element), /* @__PURE__ */ React23.createElement("div", null, children));
|
|
1387
|
-
}
|
|
1388
|
-
);
|
|
1389
|
-
var Placeholder_default = Placeholder;
|
|
1390
|
-
|
|
1391
1528
|
// src/components/Modal/index.tsx
|
|
1392
1529
|
var Modal_exports = {};
|
|
1393
1530
|
__export(Modal_exports, {
|
|
@@ -1398,7 +1535,7 @@ __export(Modal_exports, {
|
|
|
1398
1535
|
ModalTrigger: () => ModalTrigger
|
|
1399
1536
|
});
|
|
1400
1537
|
import { Close, Portal, Root, Trigger } from "@radix-ui/react-dialog";
|
|
1401
|
-
import
|
|
1538
|
+
import React25, { forwardRef as forwardRef11 } from "react";
|
|
1402
1539
|
|
|
1403
1540
|
// src/components/Modal/styled.ts
|
|
1404
1541
|
import { Content, Overlay as Overlay3, Title } from "@radix-ui/react-dialog";
|
|
@@ -1484,10 +1621,10 @@ var StyledCloseIcon = styled5("button", {
|
|
|
1484
1621
|
});
|
|
1485
1622
|
|
|
1486
1623
|
// src/components/Modal/useOpenChangeEffect.ts
|
|
1487
|
-
import { useContext as
|
|
1624
|
+
import { useContext as useContext5, useEffect as useEffect3 } from "react";
|
|
1488
1625
|
function useOpenChangeEffect(props) {
|
|
1489
1626
|
let { open, defaultOpen, onOpenChange } = props;
|
|
1490
|
-
let rootCtx =
|
|
1627
|
+
let rootCtx = useContext5(WeaverseContext);
|
|
1491
1628
|
let toggleRootzIndex = (open2) => {
|
|
1492
1629
|
let { contentRootElement } = rootCtx;
|
|
1493
1630
|
if (contentRootElement) {
|
|
@@ -1513,7 +1650,7 @@ function useOpenChangeEffect(props) {
|
|
|
1513
1650
|
var Modal = (props) => {
|
|
1514
1651
|
let { children, open, defaultOpen, onOpenChange, ...rest } = props;
|
|
1515
1652
|
let handleOpenChange = useOpenChangeEffect(props);
|
|
1516
|
-
return /* @__PURE__ */
|
|
1653
|
+
return /* @__PURE__ */ React25.createElement(Root, {
|
|
1517
1654
|
open,
|
|
1518
1655
|
defaultOpen,
|
|
1519
1656
|
onOpenChange: handleOpenChange,
|
|
@@ -1524,7 +1661,7 @@ var ModalTrigger = Trigger;
|
|
|
1524
1661
|
var ModalHeader = forwardRef11(
|
|
1525
1662
|
(props, ref) => {
|
|
1526
1663
|
let { children, ...rest } = props;
|
|
1527
|
-
return /* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ React25.createElement(StyledTitle, {
|
|
1528
1665
|
ref,
|
|
1529
1666
|
...rest,
|
|
1530
1667
|
"data-wv-modal-header": true
|
|
@@ -1534,17 +1671,17 @@ var ModalHeader = forwardRef11(
|
|
|
1534
1671
|
var ModalContent = forwardRef11(
|
|
1535
1672
|
(props, ref) => {
|
|
1536
1673
|
let { children, size, portal, ...rest } = props;
|
|
1537
|
-
let modalContent = /* @__PURE__ */
|
|
1674
|
+
let modalContent = /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(StyledOverlay2, null), /* @__PURE__ */ React25.createElement(StyledContent, {
|
|
1538
1675
|
...rest,
|
|
1539
1676
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1540
1677
|
"data-wv-modal": true,
|
|
1541
1678
|
"data-size": size,
|
|
1542
1679
|
ref
|
|
1543
|
-
}, /* @__PURE__ */
|
|
1680
|
+
}, /* @__PURE__ */ React25.createElement(ModalClose, null), /* @__PURE__ */ React25.createElement("div", {
|
|
1544
1681
|
className: "wv-modal-content"
|
|
1545
1682
|
}, children)));
|
|
1546
1683
|
if (portal) {
|
|
1547
|
-
return /* @__PURE__ */
|
|
1684
|
+
return /* @__PURE__ */ React25.createElement(Portal, null, modalContent);
|
|
1548
1685
|
}
|
|
1549
1686
|
return modalContent;
|
|
1550
1687
|
}
|
|
@@ -1556,10 +1693,10 @@ ModalContent.defaultProps = {
|
|
|
1556
1693
|
var ModalClose = forwardRef11(
|
|
1557
1694
|
(props, ref) => {
|
|
1558
1695
|
let { asChild, children, ...rest } = props;
|
|
1559
|
-
let closeIcon = /* @__PURE__ */
|
|
1696
|
+
let closeIcon = /* @__PURE__ */ React25.createElement(StyledCloseIcon, null, /* @__PURE__ */ React25.createElement(Icon, {
|
|
1560
1697
|
name: "X"
|
|
1561
1698
|
}));
|
|
1562
|
-
return /* @__PURE__ */
|
|
1699
|
+
return /* @__PURE__ */ React25.createElement(Close, {
|
|
1563
1700
|
asChild: true,
|
|
1564
1701
|
...rest,
|
|
1565
1702
|
ref
|
|
@@ -1568,29 +1705,30 @@ var ModalClose = forwardRef11(
|
|
|
1568
1705
|
);
|
|
1569
1706
|
|
|
1570
1707
|
// src/components/Spinner.tsx
|
|
1571
|
-
import
|
|
1708
|
+
import React26 from "react";
|
|
1572
1709
|
function Spinner() {
|
|
1573
|
-
return /* @__PURE__ */
|
|
1710
|
+
return /* @__PURE__ */ React26.createElement("span", {
|
|
1574
1711
|
className: "wv-spinner-wrapper"
|
|
1575
|
-
}, /* @__PURE__ */
|
|
1712
|
+
}, /* @__PURE__ */ React26.createElement(Icon, {
|
|
1576
1713
|
name: "CircleNotch",
|
|
1577
1714
|
className: "wv-spinner"
|
|
1578
1715
|
}));
|
|
1579
1716
|
}
|
|
1580
1717
|
|
|
1581
1718
|
// src/components/Tooltip.tsx
|
|
1582
|
-
import
|
|
1719
|
+
import React27 from "react";
|
|
1583
1720
|
function Tooltip({ children }) {
|
|
1584
|
-
return /* @__PURE__ */
|
|
1721
|
+
return /* @__PURE__ */ React27.createElement("span", {
|
|
1585
1722
|
className: "wv-tooltip"
|
|
1586
1723
|
}, children);
|
|
1587
1724
|
}
|
|
1588
1725
|
|
|
1589
1726
|
// src/components/Slider/index.tsx
|
|
1590
|
-
import
|
|
1727
|
+
import clsx6 from "clsx";
|
|
1591
1728
|
import { useKeenSlider as useKeenSlider2 } from "keen-slider/react";
|
|
1592
|
-
import
|
|
1593
|
-
function Slider(
|
|
1729
|
+
import React28, { useState as useState2 } from "react";
|
|
1730
|
+
function Slider(props) {
|
|
1731
|
+
let { children, className, gap, arrowOffset } = props;
|
|
1594
1732
|
let [currentSlide, setCurrentSlide] = useState2(0);
|
|
1595
1733
|
let [created, setCreated] = useState2(false);
|
|
1596
1734
|
let [ref, instanceRef] = useKeenSlider2(
|
|
@@ -1616,18 +1754,19 @@ function Slider({ children, className, gap }) {
|
|
|
1616
1754
|
},
|
|
1617
1755
|
[ResizePlugin]
|
|
1618
1756
|
);
|
|
1619
|
-
let _className =
|
|
1620
|
-
let arrowsClass =
|
|
1621
|
-
return /* @__PURE__ */
|
|
1757
|
+
let _className = clsx6("keen-slider", className);
|
|
1758
|
+
let arrowsClass = clsx6(className && `${className}-arrows`);
|
|
1759
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement("div", {
|
|
1622
1760
|
ref,
|
|
1623
1761
|
className: _className
|
|
1624
|
-
}, /* @__PURE__ */
|
|
1762
|
+
}, /* @__PURE__ */ React28.createElement("link", {
|
|
1625
1763
|
rel: "stylesheet",
|
|
1626
1764
|
href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
|
|
1627
|
-
}), children), created && instanceRef?.current && /* @__PURE__ */
|
|
1765
|
+
}), children), created && instanceRef?.current && /* @__PURE__ */ React28.createElement(Arrows, {
|
|
1628
1766
|
currentSlide,
|
|
1629
1767
|
instanceRef,
|
|
1630
|
-
className: arrowsClass
|
|
1768
|
+
className: arrowsClass,
|
|
1769
|
+
offset: arrowOffset
|
|
1631
1770
|
}));
|
|
1632
1771
|
}
|
|
1633
1772
|
|
|
@@ -1642,10 +1781,16 @@ var Components = {
|
|
|
1642
1781
|
Slider,
|
|
1643
1782
|
Tooltip
|
|
1644
1783
|
};
|
|
1784
|
+
var SliderComponents = {
|
|
1785
|
+
Arrows,
|
|
1786
|
+
Dots,
|
|
1787
|
+
ResizePlugin,
|
|
1788
|
+
AutoplayPlugin
|
|
1789
|
+
};
|
|
1645
1790
|
|
|
1646
1791
|
// src/renderer.tsx
|
|
1647
1792
|
import { isBrowser } from "@weaverse/core";
|
|
1648
|
-
import
|
|
1793
|
+
import React29, { useContext as useContext6, useEffect as useEffect5, useRef, useState as useState3 } from "react";
|
|
1649
1794
|
var WeaverseRoot = ({ context }) => {
|
|
1650
1795
|
let [, setData] = useState3(context.projectData);
|
|
1651
1796
|
let rootRef = useRef();
|
|
@@ -1660,20 +1805,20 @@ var WeaverseRoot = ({ context }) => {
|
|
|
1660
1805
|
let eventHandlers = context?.studioBridge?.eventHandlers || {};
|
|
1661
1806
|
let themeClass = context.stitchesInstance.theme.className;
|
|
1662
1807
|
if (context.projectData?.rootId) {
|
|
1663
|
-
return /* @__PURE__ */
|
|
1808
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
1664
1809
|
className: `weaverse-content-root ${themeClass}`,
|
|
1665
1810
|
...eventHandlers,
|
|
1666
1811
|
ref: rootRef
|
|
1667
|
-
}, /* @__PURE__ */
|
|
1812
|
+
}, /* @__PURE__ */ React29.createElement(WeaverseContextProvider, {
|
|
1668
1813
|
value: context
|
|
1669
|
-
}, /* @__PURE__ */
|
|
1814
|
+
}, /* @__PURE__ */ React29.createElement(ItemInstance, {
|
|
1670
1815
|
id: context.projectData.rootId
|
|
1671
1816
|
})));
|
|
1672
1817
|
}
|
|
1673
1818
|
return null;
|
|
1674
1819
|
};
|
|
1675
1820
|
var ItemComponent = ({ instance }) => {
|
|
1676
|
-
let { stitchesInstance, elementInstances } =
|
|
1821
|
+
let { stitchesInstance, elementInstances } = useContext6(WeaverseContext);
|
|
1677
1822
|
let [data, setData] = useState3(instance.data);
|
|
1678
1823
|
let { id, type, childIds = [], css: css11, className, ...rest } = data;
|
|
1679
1824
|
useEffect5(() => {
|
|
@@ -1692,13 +1837,13 @@ var ItemComponent = ({ instance }) => {
|
|
|
1692
1837
|
if (Component.$$typeof === Symbol.for("react.forward_ref")) {
|
|
1693
1838
|
rest.ref = instance.ref;
|
|
1694
1839
|
}
|
|
1695
|
-
return /* @__PURE__ */
|
|
1840
|
+
return /* @__PURE__ */ React29.createElement(Component, {
|
|
1696
1841
|
key: id,
|
|
1697
1842
|
"data-wv-type": type,
|
|
1698
1843
|
"data-wv-id": id,
|
|
1699
1844
|
className: generateItemClassName(instance, stitchesInstance),
|
|
1700
1845
|
...rest
|
|
1701
|
-
}, childIds.map((id2) => /* @__PURE__ */
|
|
1846
|
+
}, childIds.map((id2) => /* @__PURE__ */ React29.createElement(ItemInstance, {
|
|
1702
1847
|
key: id2,
|
|
1703
1848
|
id: id2
|
|
1704
1849
|
})));
|
|
@@ -1708,15 +1853,15 @@ var ItemComponent = ({ instance }) => {
|
|
|
1708
1853
|
}
|
|
1709
1854
|
};
|
|
1710
1855
|
var ItemInstance = ({ id }) => {
|
|
1711
|
-
let context =
|
|
1856
|
+
let context = useContext6(WeaverseContext);
|
|
1712
1857
|
let { itemInstances } = context;
|
|
1713
1858
|
let instance = itemInstances.get(id);
|
|
1714
1859
|
if (!instance) {
|
|
1715
|
-
return /* @__PURE__ */
|
|
1860
|
+
return /* @__PURE__ */ React29.createElement("div", {
|
|
1716
1861
|
style: { display: "none" }
|
|
1717
1862
|
}, "Item instance ", id, " not found");
|
|
1718
1863
|
}
|
|
1719
|
-
return /* @__PURE__ */
|
|
1864
|
+
return /* @__PURE__ */ React29.createElement(ItemComponent, {
|
|
1720
1865
|
key: id,
|
|
1721
1866
|
instance
|
|
1722
1867
|
});
|
|
@@ -1724,6 +1869,7 @@ var ItemInstance = ({ id }) => {
|
|
|
1724
1869
|
export {
|
|
1725
1870
|
Components,
|
|
1726
1871
|
Elements,
|
|
1872
|
+
SliderComponents,
|
|
1727
1873
|
WeaverseContext,
|
|
1728
1874
|
WeaverseContextConsumer,
|
|
1729
1875
|
WeaverseContextProvider,
|