@weaverse/react 1.0.23 → 1.0.24
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 +4 -2
- package/dist/index.js +33 -16
- package/dist/index.mjs +34 -17
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -158,9 +158,11 @@ declare function Dots(props: SliderDotsProps): JSX.Element;
|
|
|
158
158
|
|
|
159
159
|
declare function AutoplayPlugin(changeSlidesEvery: number): KeenSliderPlugin;
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
type NoHydrateProps = {
|
|
162
|
+
id: string;
|
|
162
163
|
getHTML?: () => string;
|
|
163
|
-
} & JSX.IntrinsicElements['div']
|
|
164
|
+
} & JSX.IntrinsicElements['div'];
|
|
165
|
+
declare function NoHydrate({ id, getHTML, ...rest }: NoHydrateProps): JSX.Element;
|
|
164
166
|
|
|
165
167
|
declare let Components: {
|
|
166
168
|
Background: typeof Background;
|
package/dist/index.js
CHANGED
|
@@ -70,16 +70,16 @@ var Button = React.forwardRef((props, ref) => {
|
|
|
70
70
|
});
|
|
71
71
|
Button.defaultProps = {
|
|
72
72
|
type: "button",
|
|
73
|
-
text: "
|
|
73
|
+
text: "BUTTON",
|
|
74
74
|
clickAction: "none",
|
|
75
75
|
linkTo: "",
|
|
76
76
|
openInNewTab: false
|
|
77
77
|
};
|
|
78
78
|
var css = {
|
|
79
79
|
"@desktop": {
|
|
80
|
-
borderRadius: "
|
|
80
|
+
borderRadius: "4px",
|
|
81
81
|
border: "none",
|
|
82
|
-
backgroundColor: "#
|
|
82
|
+
backgroundColor: "#3E3F40",
|
|
83
83
|
color: "#fff",
|
|
84
84
|
fontSize: "14px",
|
|
85
85
|
lineHeight: "1.5",
|
|
@@ -90,8 +90,8 @@ var css = {
|
|
|
90
90
|
minWidth: "120px",
|
|
91
91
|
textDecoration: "none",
|
|
92
92
|
textAlign: "center",
|
|
93
|
-
"
|
|
94
|
-
backgroundColor: "#
|
|
93
|
+
"&:hover": {
|
|
94
|
+
backgroundColor: "#1A1B1B"
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
};
|
|
@@ -112,7 +112,7 @@ var css2 = {
|
|
|
112
112
|
justifyContent: "flex-start",
|
|
113
113
|
gridArea: "1 / 1 / 3 / 6",
|
|
114
114
|
overflow: "hidden",
|
|
115
|
-
minWidth:
|
|
115
|
+
// minWidth: '300px',
|
|
116
116
|
minHeight: "100px"
|
|
117
117
|
},
|
|
118
118
|
"@mobile": {
|
|
@@ -1943,11 +1943,7 @@ var placeholder_default = Placeholder;
|
|
|
1943
1943
|
|
|
1944
1944
|
// src/components/no-hydrate.tsx
|
|
1945
1945
|
var import_react30 = __toESM(require("react"));
|
|
1946
|
-
function NoHydrate({
|
|
1947
|
-
getHTML,
|
|
1948
|
-
...rest
|
|
1949
|
-
}) {
|
|
1950
|
-
let id = (0, import_react30.useId)();
|
|
1946
|
+
function NoHydrate({ id, getHTML, ...rest }) {
|
|
1951
1947
|
let [html] = (0, import_react30.useState)(() => {
|
|
1952
1948
|
if (typeof document === "undefined") {
|
|
1953
1949
|
return getHTML?.() ?? "";
|
|
@@ -2105,7 +2101,7 @@ function formatCSS(css13) {
|
|
|
2105
2101
|
}
|
|
2106
2102
|
var permanentClasses = {};
|
|
2107
2103
|
function generateItemClassName(instance, stitchesInstance) {
|
|
2108
|
-
let { css: css13, type, className: cls = "" } = instance.data;
|
|
2104
|
+
let { css: css13, type, className: cls = "", tailwindClasses } = instance.data;
|
|
2109
2105
|
let className = "";
|
|
2110
2106
|
let permanentClass = "";
|
|
2111
2107
|
let perCss = instance.Element?.permanentCss;
|
|
@@ -2124,7 +2120,13 @@ function generateItemClassName(instance, stitchesInstance) {
|
|
|
2124
2120
|
let newStitchesClass = stitchesInstance.css(formattedCss)().className || "";
|
|
2125
2121
|
let { stitchesClass } = instance;
|
|
2126
2122
|
let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
|
|
2127
|
-
className = (0, import_clsx5.default)(
|
|
2123
|
+
className = (0, import_clsx5.default)(
|
|
2124
|
+
permanentClass,
|
|
2125
|
+
cls,
|
|
2126
|
+
tailwindClasses,
|
|
2127
|
+
newStitchesClass,
|
|
2128
|
+
otherClass
|
|
2129
|
+
);
|
|
2128
2130
|
instance.stitchesClass = newStitchesClass;
|
|
2129
2131
|
}
|
|
2130
2132
|
return className;
|
|
@@ -2582,9 +2584,23 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2582
2584
|
return null;
|
|
2583
2585
|
};
|
|
2584
2586
|
var ItemComponent = ({ instance }) => {
|
|
2585
|
-
let
|
|
2587
|
+
let context = (0, import_react38.useContext)(WeaverseContext);
|
|
2588
|
+
let { stitchesInstance, elementInstances } = context;
|
|
2586
2589
|
let [data, setData] = (0, import_react38.useState)(instance.data);
|
|
2587
|
-
let {
|
|
2590
|
+
let {
|
|
2591
|
+
id,
|
|
2592
|
+
type,
|
|
2593
|
+
childIds = [],
|
|
2594
|
+
children = [],
|
|
2595
|
+
parentId,
|
|
2596
|
+
createdAt,
|
|
2597
|
+
updatedAt,
|
|
2598
|
+
deletedAt,
|
|
2599
|
+
tailwindClasses,
|
|
2600
|
+
css: css13,
|
|
2601
|
+
className,
|
|
2602
|
+
...rest
|
|
2603
|
+
} = data;
|
|
2588
2604
|
(0, import_react38.useEffect)(() => {
|
|
2589
2605
|
let render = (data2) => setData({ ...data2 });
|
|
2590
2606
|
instance.subscribe(render);
|
|
@@ -2610,7 +2626,8 @@ var ItemComponent = ({ instance }) => {
|
|
|
2610
2626
|
className: generateItemClassName(instance, stitchesInstance),
|
|
2611
2627
|
...rest
|
|
2612
2628
|
},
|
|
2613
|
-
childIds.map((
|
|
2629
|
+
childIds.map((cid) => /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { key: cid, id: cid })),
|
|
2630
|
+
children.map((item) => /* @__PURE__ */ import_react38.default.createElement(ItemInstance, { key: item.id, id: item.id }))
|
|
2614
2631
|
);
|
|
2615
2632
|
} else {
|
|
2616
2633
|
console.log(`Unknown element: ${type}`);
|
package/dist/index.mjs
CHANGED
|
@@ -34,16 +34,16 @@ var Button = React.forwardRef((props, ref) => {
|
|
|
34
34
|
});
|
|
35
35
|
Button.defaultProps = {
|
|
36
36
|
type: "button",
|
|
37
|
-
text: "
|
|
37
|
+
text: "BUTTON",
|
|
38
38
|
clickAction: "none",
|
|
39
39
|
linkTo: "",
|
|
40
40
|
openInNewTab: false
|
|
41
41
|
};
|
|
42
42
|
var css = {
|
|
43
43
|
"@desktop": {
|
|
44
|
-
borderRadius: "
|
|
44
|
+
borderRadius: "4px",
|
|
45
45
|
border: "none",
|
|
46
|
-
backgroundColor: "#
|
|
46
|
+
backgroundColor: "#3E3F40",
|
|
47
47
|
color: "#fff",
|
|
48
48
|
fontSize: "14px",
|
|
49
49
|
lineHeight: "1.5",
|
|
@@ -54,8 +54,8 @@ var css = {
|
|
|
54
54
|
minWidth: "120px",
|
|
55
55
|
textDecoration: "none",
|
|
56
56
|
textAlign: "center",
|
|
57
|
-
"
|
|
58
|
-
backgroundColor: "#
|
|
57
|
+
"&:hover": {
|
|
58
|
+
backgroundColor: "#1A1B1B"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
};
|
|
@@ -76,7 +76,7 @@ var css2 = {
|
|
|
76
76
|
justifyContent: "flex-start",
|
|
77
77
|
gridArea: "1 / 1 / 3 / 6",
|
|
78
78
|
overflow: "hidden",
|
|
79
|
-
minWidth:
|
|
79
|
+
// minWidth: '300px',
|
|
80
80
|
minHeight: "100px"
|
|
81
81
|
},
|
|
82
82
|
"@mobile": {
|
|
@@ -1906,12 +1906,8 @@ var Placeholder = forwardRef9(
|
|
|
1906
1906
|
var placeholder_default = Placeholder;
|
|
1907
1907
|
|
|
1908
1908
|
// src/components/no-hydrate.tsx
|
|
1909
|
-
import React25, {
|
|
1910
|
-
function NoHydrate({
|
|
1911
|
-
getHTML,
|
|
1912
|
-
...rest
|
|
1913
|
-
}) {
|
|
1914
|
-
let id = useId();
|
|
1909
|
+
import React25, { useState as useState3 } from "react";
|
|
1910
|
+
function NoHydrate({ id, getHTML, ...rest }) {
|
|
1915
1911
|
let [html] = useState3(() => {
|
|
1916
1912
|
if (typeof document === "undefined") {
|
|
1917
1913
|
return getHTML?.() ?? "";
|
|
@@ -2069,7 +2065,7 @@ function formatCSS(css13) {
|
|
|
2069
2065
|
}
|
|
2070
2066
|
var permanentClasses = {};
|
|
2071
2067
|
function generateItemClassName(instance, stitchesInstance) {
|
|
2072
|
-
let { css: css13, type, className: cls = "" } = instance.data;
|
|
2068
|
+
let { css: css13, type, className: cls = "", tailwindClasses } = instance.data;
|
|
2073
2069
|
let className = "";
|
|
2074
2070
|
let permanentClass = "";
|
|
2075
2071
|
let perCss = instance.Element?.permanentCss;
|
|
@@ -2088,7 +2084,13 @@ function generateItemClassName(instance, stitchesInstance) {
|
|
|
2088
2084
|
let newStitchesClass = stitchesInstance.css(formattedCss)().className || "";
|
|
2089
2085
|
let { stitchesClass } = instance;
|
|
2090
2086
|
let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
|
|
2091
|
-
className = clsx5(
|
|
2087
|
+
className = clsx5(
|
|
2088
|
+
permanentClass,
|
|
2089
|
+
cls,
|
|
2090
|
+
tailwindClasses,
|
|
2091
|
+
newStitchesClass,
|
|
2092
|
+
otherClass
|
|
2093
|
+
);
|
|
2092
2094
|
instance.stitchesClass = newStitchesClass;
|
|
2093
2095
|
}
|
|
2094
2096
|
return className;
|
|
@@ -2546,9 +2548,23 @@ var WeaverseRoot = ({ context }) => {
|
|
|
2546
2548
|
return null;
|
|
2547
2549
|
};
|
|
2548
2550
|
var ItemComponent = ({ instance }) => {
|
|
2549
|
-
let
|
|
2551
|
+
let context = useContext6(WeaverseContext);
|
|
2552
|
+
let { stitchesInstance, elementInstances } = context;
|
|
2550
2553
|
let [data, setData] = useState6(instance.data);
|
|
2551
|
-
let {
|
|
2554
|
+
let {
|
|
2555
|
+
id,
|
|
2556
|
+
type,
|
|
2557
|
+
childIds = [],
|
|
2558
|
+
children = [],
|
|
2559
|
+
parentId,
|
|
2560
|
+
createdAt,
|
|
2561
|
+
updatedAt,
|
|
2562
|
+
deletedAt,
|
|
2563
|
+
tailwindClasses,
|
|
2564
|
+
css: css13,
|
|
2565
|
+
className,
|
|
2566
|
+
...rest
|
|
2567
|
+
} = data;
|
|
2552
2568
|
useEffect5(() => {
|
|
2553
2569
|
let render = (data2) => setData({ ...data2 });
|
|
2554
2570
|
instance.subscribe(render);
|
|
@@ -2574,7 +2590,8 @@ var ItemComponent = ({ instance }) => {
|
|
|
2574
2590
|
className: generateItemClassName(instance, stitchesInstance),
|
|
2575
2591
|
...rest
|
|
2576
2592
|
},
|
|
2577
|
-
childIds.map((
|
|
2593
|
+
childIds.map((cid) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: cid, id: cid })),
|
|
2594
|
+
children.map((item) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: item.id, id: item.id }))
|
|
2578
2595
|
);
|
|
2579
2596
|
} else {
|
|
2580
2597
|
console.log(`Unknown element: ${type}`);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.24",
|
|
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.3",
|
|
36
36
|
"@stitches/react": "^1.2.8",
|
|
37
|
-
"@weaverse/core": "1.0.
|
|
37
|
+
"@weaverse/core": "1.0.24",
|
|
38
38
|
"clsx": "^1.2.1",
|
|
39
39
|
"keen-slider": "^6.8.5"
|
|
40
40
|
}
|