@weaverse/react 0.7.54 → 0.7.56
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 +50 -33
- package/dist/index.mjs +56 -39
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -992,7 +992,7 @@ var StyledOverlay = (0, import_react17.styled)(import_react_dialog.Overlay, {
|
|
|
992
992
|
display: "block !important",
|
|
993
993
|
backgroundColor: "rgba(0, 0, 0, .3)",
|
|
994
994
|
position: "fixed",
|
|
995
|
-
zIndex:
|
|
995
|
+
zIndex: 99999,
|
|
996
996
|
inset: 0,
|
|
997
997
|
animation: `${overlayShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
998
998
|
});
|
|
@@ -1015,7 +1015,7 @@ var StyledContent = (0, import_react17.styled)(import_react_dialog.Content, {
|
|
|
1015
1015
|
transform: "translate(-50%, -50%)",
|
|
1016
1016
|
padding: 24,
|
|
1017
1017
|
animation: `${contentShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`,
|
|
1018
|
-
zIndex:
|
|
1018
|
+
zIndex: 99999,
|
|
1019
1019
|
maxWidth: "90vw",
|
|
1020
1020
|
width: "auto",
|
|
1021
1021
|
"*": {
|
|
@@ -1041,8 +1041,8 @@ var StyledCloseIcon = (0, import_react17.styled)("button", {
|
|
|
1041
1041
|
cursor: "pointer",
|
|
1042
1042
|
fontFamily: "inherit",
|
|
1043
1043
|
borderRadius: "100%",
|
|
1044
|
-
height:
|
|
1045
|
-
width:
|
|
1044
|
+
height: 32,
|
|
1045
|
+
width: 32,
|
|
1046
1046
|
padding: 4,
|
|
1047
1047
|
display: "inline-flex",
|
|
1048
1048
|
alignItems: "center",
|
|
@@ -1055,8 +1055,8 @@ var StyledCloseIcon = (0, import_react17.styled)("button", {
|
|
|
1055
1055
|
backgroundColor: "rgba(112, 112, 112, .1)"
|
|
1056
1056
|
},
|
|
1057
1057
|
svg: {
|
|
1058
|
-
width:
|
|
1059
|
-
height:
|
|
1058
|
+
width: 24,
|
|
1059
|
+
height: 24
|
|
1060
1060
|
}
|
|
1061
1061
|
});
|
|
1062
1062
|
|
|
@@ -1064,20 +1064,23 @@ var StyledCloseIcon = (0, import_react17.styled)("button", {
|
|
|
1064
1064
|
var import_react18 = require("react");
|
|
1065
1065
|
function useOpenChangeEffect(props) {
|
|
1066
1066
|
let { open, defaultOpen, onOpenChange } = props;
|
|
1067
|
+
let rootCtx = (0, import_react18.useContext)(WeaverseContext);
|
|
1068
|
+
let toggleRootzIndex = (open2) => {
|
|
1069
|
+
let { contentRootElement } = rootCtx;
|
|
1070
|
+
if (contentRootElement) {
|
|
1071
|
+
if (open2) {
|
|
1072
|
+
contentRootElement.classList.add("modal-open");
|
|
1073
|
+
} else {
|
|
1074
|
+
contentRootElement.classList.remove("modal-open");
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1067
1078
|
(0, import_react18.useEffect)(() => {
|
|
1068
1079
|
let isOpen = open || defaultOpen;
|
|
1069
|
-
|
|
1070
|
-
document.body.classList.add("wv-modal-open");
|
|
1071
|
-
} else {
|
|
1072
|
-
document.body.classList.remove("wv-modal-open");
|
|
1073
|
-
}
|
|
1080
|
+
toggleRootzIndex(isOpen);
|
|
1074
1081
|
}, [open, defaultOpen]);
|
|
1075
1082
|
let handleOpenChange = (open2) => {
|
|
1076
|
-
|
|
1077
|
-
document.body.classList.add("wv-modal-open");
|
|
1078
|
-
} else {
|
|
1079
|
-
document.body.classList.remove("wv-modal-open");
|
|
1080
|
-
}
|
|
1083
|
+
toggleRootzIndex(open2);
|
|
1081
1084
|
onOpenChange?.(open2);
|
|
1082
1085
|
};
|
|
1083
1086
|
return handleOpenChange;
|
|
@@ -1251,30 +1254,44 @@ var css9 = {
|
|
|
1251
1254
|
}
|
|
1252
1255
|
};
|
|
1253
1256
|
|
|
1257
|
+
// src/components/Slider/ResizePlugin.ts
|
|
1258
|
+
var ResizePlugin = (slider) => {
|
|
1259
|
+
let observer = new ResizeObserver(() => slider.update());
|
|
1260
|
+
slider.on("created", () => {
|
|
1261
|
+
observer.observe(slider.container);
|
|
1262
|
+
});
|
|
1263
|
+
slider.on("destroyed", () => {
|
|
1264
|
+
observer.unobserve(slider.container);
|
|
1265
|
+
});
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1254
1268
|
// src/components/Slider/index.tsx
|
|
1255
1269
|
function Slider({ children, className }) {
|
|
1256
1270
|
let [currentSlide, setCurrentSlide] = (0, import_react24.useState)(0);
|
|
1257
1271
|
let [created, setCreated] = (0, import_react24.useState)(false);
|
|
1258
|
-
let [ref, instanceRef] = (0, import_react23.useKeenSlider)(
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1272
|
+
let [ref, instanceRef] = (0, import_react23.useKeenSlider)(
|
|
1273
|
+
{
|
|
1274
|
+
slides: { perView: 4, spacing: 16 },
|
|
1275
|
+
breakpoints: {
|
|
1276
|
+
"(max-width: 1024px)": {
|
|
1277
|
+
slides: { perView: 3, spacing: 16 }
|
|
1278
|
+
},
|
|
1279
|
+
"(max-width: 768px)": {
|
|
1280
|
+
slides: {
|
|
1281
|
+
perView: 1,
|
|
1282
|
+
spacing: 32
|
|
1283
|
+
}
|
|
1268
1284
|
}
|
|
1285
|
+
},
|
|
1286
|
+
created: () => {
|
|
1287
|
+
setCreated(true);
|
|
1288
|
+
},
|
|
1289
|
+
slideChanged: (slider) => {
|
|
1290
|
+
setCurrentSlide(slider.track.details.rel);
|
|
1269
1291
|
}
|
|
1270
1292
|
},
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
},
|
|
1274
|
-
slideChanged: (slider) => {
|
|
1275
|
-
setCurrentSlide(slider.track.details.rel);
|
|
1276
|
-
}
|
|
1277
|
-
});
|
|
1293
|
+
[ResizePlugin]
|
|
1294
|
+
);
|
|
1278
1295
|
let _className = (0, import_clsx4.default)("keen-slider", className);
|
|
1279
1296
|
let arrowsClass = (0, import_clsx4.default)(className && `${className}-arrows`);
|
|
1280
1297
|
return /* @__PURE__ */ import_react24.default.createElement(import_react24.default.Fragment, null, /* @__PURE__ */ import_react24.default.createElement("div", {
|
package/dist/index.mjs
CHANGED
|
@@ -961,7 +961,7 @@ var StyledOverlay = styled(Overlay2, {
|
|
|
961
961
|
display: "block !important",
|
|
962
962
|
backgroundColor: "rgba(0, 0, 0, .3)",
|
|
963
963
|
position: "fixed",
|
|
964
|
-
zIndex:
|
|
964
|
+
zIndex: 99999,
|
|
965
965
|
inset: 0,
|
|
966
966
|
animation: `${overlayShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`
|
|
967
967
|
});
|
|
@@ -984,7 +984,7 @@ var StyledContent = styled(Content, {
|
|
|
984
984
|
transform: "translate(-50%, -50%)",
|
|
985
985
|
padding: 24,
|
|
986
986
|
animation: `${contentShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`,
|
|
987
|
-
zIndex:
|
|
987
|
+
zIndex: 99999,
|
|
988
988
|
maxWidth: "90vw",
|
|
989
989
|
width: "auto",
|
|
990
990
|
"*": {
|
|
@@ -1010,8 +1010,8 @@ var StyledCloseIcon = styled("button", {
|
|
|
1010
1010
|
cursor: "pointer",
|
|
1011
1011
|
fontFamily: "inherit",
|
|
1012
1012
|
borderRadius: "100%",
|
|
1013
|
-
height:
|
|
1014
|
-
width:
|
|
1013
|
+
height: 32,
|
|
1014
|
+
width: 32,
|
|
1015
1015
|
padding: 4,
|
|
1016
1016
|
display: "inline-flex",
|
|
1017
1017
|
alignItems: "center",
|
|
@@ -1024,29 +1024,32 @@ var StyledCloseIcon = styled("button", {
|
|
|
1024
1024
|
backgroundColor: "rgba(112, 112, 112, .1)"
|
|
1025
1025
|
},
|
|
1026
1026
|
svg: {
|
|
1027
|
-
width:
|
|
1028
|
-
height:
|
|
1027
|
+
width: 24,
|
|
1028
|
+
height: 24
|
|
1029
1029
|
}
|
|
1030
1030
|
});
|
|
1031
1031
|
|
|
1032
1032
|
// src/components/Modal/useOpenChangeEffect.ts
|
|
1033
|
-
import { useEffect as useEffect2 } from "react";
|
|
1033
|
+
import { useContext as useContext4, useEffect as useEffect2 } from "react";
|
|
1034
1034
|
function useOpenChangeEffect(props) {
|
|
1035
1035
|
let { open, defaultOpen, onOpenChange } = props;
|
|
1036
|
+
let rootCtx = useContext4(WeaverseContext);
|
|
1037
|
+
let toggleRootzIndex = (open2) => {
|
|
1038
|
+
let { contentRootElement } = rootCtx;
|
|
1039
|
+
if (contentRootElement) {
|
|
1040
|
+
if (open2) {
|
|
1041
|
+
contentRootElement.classList.add("modal-open");
|
|
1042
|
+
} else {
|
|
1043
|
+
contentRootElement.classList.remove("modal-open");
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1036
1047
|
useEffect2(() => {
|
|
1037
1048
|
let isOpen = open || defaultOpen;
|
|
1038
|
-
|
|
1039
|
-
document.body.classList.add("wv-modal-open");
|
|
1040
|
-
} else {
|
|
1041
|
-
document.body.classList.remove("wv-modal-open");
|
|
1042
|
-
}
|
|
1049
|
+
toggleRootzIndex(isOpen);
|
|
1043
1050
|
}, [open, defaultOpen]);
|
|
1044
1051
|
let handleOpenChange = (open2) => {
|
|
1045
|
-
|
|
1046
|
-
document.body.classList.add("wv-modal-open");
|
|
1047
|
-
} else {
|
|
1048
|
-
document.body.classList.remove("wv-modal-open");
|
|
1049
|
-
}
|
|
1052
|
+
toggleRootzIndex(open2);
|
|
1050
1053
|
onOpenChange?.(open2);
|
|
1051
1054
|
};
|
|
1052
1055
|
return handleOpenChange;
|
|
@@ -1136,10 +1139,10 @@ import React22, { useState } from "react";
|
|
|
1136
1139
|
|
|
1137
1140
|
// src/components/Slider/Arrows.tsx
|
|
1138
1141
|
import clsx3 from "clsx";
|
|
1139
|
-
import React21, { useContext as
|
|
1142
|
+
import React21, { useContext as useContext5 } from "react";
|
|
1140
1143
|
function Arrows(props) {
|
|
1141
1144
|
let { currentSlide, instanceRef, className } = props;
|
|
1142
|
-
let { stitchesInstance } =
|
|
1145
|
+
let { stitchesInstance } = useContext5(WeaverseContext);
|
|
1143
1146
|
let { className: cssClass } = stitchesInstance.css(css9)();
|
|
1144
1147
|
let isFirstSlide = currentSlide === 0;
|
|
1145
1148
|
let isLastSlide = false;
|
|
@@ -1220,30 +1223,44 @@ var css9 = {
|
|
|
1220
1223
|
}
|
|
1221
1224
|
};
|
|
1222
1225
|
|
|
1226
|
+
// src/components/Slider/ResizePlugin.ts
|
|
1227
|
+
var ResizePlugin = (slider) => {
|
|
1228
|
+
let observer = new ResizeObserver(() => slider.update());
|
|
1229
|
+
slider.on("created", () => {
|
|
1230
|
+
observer.observe(slider.container);
|
|
1231
|
+
});
|
|
1232
|
+
slider.on("destroyed", () => {
|
|
1233
|
+
observer.unobserve(slider.container);
|
|
1234
|
+
});
|
|
1235
|
+
};
|
|
1236
|
+
|
|
1223
1237
|
// src/components/Slider/index.tsx
|
|
1224
1238
|
function Slider({ children, className }) {
|
|
1225
1239
|
let [currentSlide, setCurrentSlide] = useState(0);
|
|
1226
1240
|
let [created, setCreated] = useState(false);
|
|
1227
|
-
let [ref, instanceRef] = useKeenSlider(
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1241
|
+
let [ref, instanceRef] = useKeenSlider(
|
|
1242
|
+
{
|
|
1243
|
+
slides: { perView: 4, spacing: 16 },
|
|
1244
|
+
breakpoints: {
|
|
1245
|
+
"(max-width: 1024px)": {
|
|
1246
|
+
slides: { perView: 3, spacing: 16 }
|
|
1247
|
+
},
|
|
1248
|
+
"(max-width: 768px)": {
|
|
1249
|
+
slides: {
|
|
1250
|
+
perView: 1,
|
|
1251
|
+
spacing: 32
|
|
1252
|
+
}
|
|
1237
1253
|
}
|
|
1254
|
+
},
|
|
1255
|
+
created: () => {
|
|
1256
|
+
setCreated(true);
|
|
1257
|
+
},
|
|
1258
|
+
slideChanged: (slider) => {
|
|
1259
|
+
setCurrentSlide(slider.track.details.rel);
|
|
1238
1260
|
}
|
|
1239
1261
|
},
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
},
|
|
1243
|
-
slideChanged: (slider) => {
|
|
1244
|
-
setCurrentSlide(slider.track.details.rel);
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1262
|
+
[ResizePlugin]
|
|
1263
|
+
);
|
|
1247
1264
|
let _className = clsx4("keen-slider", className);
|
|
1248
1265
|
let arrowsClass = clsx4(className && `${className}-arrows`);
|
|
1249
1266
|
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement("div", {
|
|
@@ -1406,7 +1423,7 @@ var WeaverseContextConsumer = WeaverseContext.Consumer;
|
|
|
1406
1423
|
|
|
1407
1424
|
// src/renderer.tsx
|
|
1408
1425
|
import { isBrowser } from "@weaverse/core";
|
|
1409
|
-
import React24, { useContext as
|
|
1426
|
+
import React24, { useContext as useContext6, useEffect as useEffect5, useRef, useState as useState3 } from "react";
|
|
1410
1427
|
var WeaverseRoot = ({ context }) => {
|
|
1411
1428
|
let [, setData] = useState3(context.projectData);
|
|
1412
1429
|
let rootRef = useRef();
|
|
@@ -1434,7 +1451,7 @@ var WeaverseRoot = ({ context }) => {
|
|
|
1434
1451
|
return null;
|
|
1435
1452
|
};
|
|
1436
1453
|
var ItemComponent = ({ instance }) => {
|
|
1437
|
-
let { stitchesInstance, elementInstances } =
|
|
1454
|
+
let { stitchesInstance, elementInstances } = useContext6(WeaverseContext);
|
|
1438
1455
|
let [data, setData] = useState3(instance.data);
|
|
1439
1456
|
let { id, type, childIds = [], css: css10, className, ...rest } = data;
|
|
1440
1457
|
useEffect5(() => {
|
|
@@ -1469,7 +1486,7 @@ var ItemComponent = ({ instance }) => {
|
|
|
1469
1486
|
}
|
|
1470
1487
|
};
|
|
1471
1488
|
var ItemInstance = ({ id }) => {
|
|
1472
|
-
let context =
|
|
1489
|
+
let context = useContext6(WeaverseContext);
|
|
1473
1490
|
let { itemInstances } = context;
|
|
1474
1491
|
let instance = itemInstances.get(id);
|
|
1475
1492
|
if (!instance) {
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.
|
|
2
|
+
"version": "0.7.56",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@radix-ui/react-dialog": "^1.0.2",
|
|
36
36
|
"@stitches/react": "^1.2.8",
|
|
37
|
-
"@weaverse/core": "0.7.
|
|
37
|
+
"@weaverse/core": "0.7.56",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"keen-slider": "^6.8.5"
|
|
40
40
|
}
|