@weaverse/react 0.6.16 → 0.6.19
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 +70 -4
- package/dist/index.js +404 -466
- package/dist/index.mjs +407 -469
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -34,554 +34,489 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
import { Weaverse } from "@weaverse/core";
|
|
35
35
|
import { createContext } from "react";
|
|
36
36
|
|
|
37
|
-
// src/elements/base.tsx
|
|
38
|
-
import React from "react";
|
|
39
|
-
var BaseElement = React.forwardRef((_a, ref) => {
|
|
40
|
-
var _b = _a, { tag, children } = _b, props = __objRest(_b, ["tag", "children"]);
|
|
41
|
-
return React.createElement(tag, __spreadValues({
|
|
42
|
-
ref
|
|
43
|
-
}, props), children);
|
|
44
|
-
});
|
|
45
|
-
BaseElement.defaultProps = {
|
|
46
|
-
tag: "div",
|
|
47
|
-
style: {}
|
|
48
|
-
};
|
|
49
|
-
var schema = {
|
|
50
|
-
type: "base",
|
|
51
|
-
parentType: "container",
|
|
52
|
-
title: "Base",
|
|
53
|
-
settings: []
|
|
54
|
-
};
|
|
55
|
-
var base_default = BaseElement;
|
|
56
|
-
|
|
57
37
|
// src/elements/button.tsx
|
|
58
|
-
import * as
|
|
59
|
-
var Button =
|
|
60
|
-
|
|
38
|
+
import * as React from "react";
|
|
39
|
+
var Button = React.forwardRef((props, ref) => {
|
|
40
|
+
let _a = props, { openInNewTab, target, value } = _a, rest = __objRest(_a, ["openInNewTab", "target", "value"]);
|
|
61
41
|
if (target) {
|
|
62
|
-
return /* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ React.createElement("a", __spreadProps(__spreadValues({
|
|
63
43
|
href: target,
|
|
64
|
-
target: openInNewTab ? "_blank" : "_self"
|
|
65
|
-
|
|
44
|
+
target: openInNewTab ? "_blank" : "_self",
|
|
45
|
+
rel: "noreferrer"
|
|
46
|
+
}, rest), {
|
|
66
47
|
ref
|
|
67
|
-
}
|
|
48
|
+
}), value);
|
|
68
49
|
}
|
|
69
|
-
return /* @__PURE__ */
|
|
50
|
+
return /* @__PURE__ */ React.createElement("button", __spreadValues({
|
|
70
51
|
ref
|
|
71
|
-
}, rest),
|
|
52
|
+
}, rest), value);
|
|
72
53
|
});
|
|
73
54
|
Button.defaultProps = {
|
|
74
|
-
value: "Shop now"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
title: "Button",
|
|
55
|
+
value: "Shop now",
|
|
56
|
+
openInNewTab: false,
|
|
57
|
+
target: "",
|
|
78
58
|
type: "button",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
type: "border"
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
type: "background"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: "spacing"
|
|
95
|
-
}
|
|
96
|
-
],
|
|
97
|
-
settings: [],
|
|
98
|
-
toolbar: [
|
|
99
|
-
{
|
|
100
|
-
type: "delete"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
type: "duplicate"
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
type: "link"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
type: "color"
|
|
59
|
+
css: {
|
|
60
|
+
"@desktop": {
|
|
61
|
+
borderRadius: "72px",
|
|
62
|
+
border: "none",
|
|
63
|
+
backgroundColor: "#0F71FF",
|
|
64
|
+
color: "#fff",
|
|
65
|
+
fontSize: "13px",
|
|
66
|
+
padding: "10px 20px"
|
|
110
67
|
}
|
|
111
|
-
],
|
|
112
|
-
data: {
|
|
113
|
-
css: {
|
|
114
|
-
"@desktop": {
|
|
115
|
-
borderRadius: "72px",
|
|
116
|
-
border: "none",
|
|
117
|
-
backgroundColor: "#0F71FF",
|
|
118
|
-
color: "#fff",
|
|
119
|
-
fontSize: "13px",
|
|
120
|
-
padding: "10px 20px"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
target: "",
|
|
124
|
-
openInNewTab: false
|
|
125
|
-
},
|
|
126
|
-
flags: {
|
|
127
|
-
draggable: true
|
|
128
68
|
}
|
|
129
69
|
};
|
|
130
70
|
var button_default = Button;
|
|
131
71
|
|
|
132
72
|
// src/elements/container.tsx
|
|
133
|
-
import
|
|
73
|
+
import React2, { forwardRef as forwardRef2 } from "react";
|
|
134
74
|
var Container = forwardRef2((props, ref) => {
|
|
135
|
-
|
|
75
|
+
let _a = props, { children } = _a, rest = __objRest(_a, ["children"]);
|
|
76
|
+
return /* @__PURE__ */ React2.createElement("div", __spreadValues({
|
|
136
77
|
ref
|
|
137
|
-
},
|
|
78
|
+
}, rest), children);
|
|
138
79
|
});
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
"
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
gridArea: "1 / 1 / 3 / 6",
|
|
153
|
-
width: "100%",
|
|
154
|
-
height: "fit-content"
|
|
155
|
-
}
|
|
80
|
+
Container.defaultProps = {
|
|
81
|
+
css: {
|
|
82
|
+
"@desktop": {
|
|
83
|
+
alignItems: "flex-start",
|
|
84
|
+
backgroundColor: "rgba(248,203,203,0.38)",
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
gridArea: "1 / 1 / 3 / 6",
|
|
88
|
+
height: "fit-content",
|
|
89
|
+
justifyContent: "flex-start",
|
|
90
|
+
overflow: "hidden",
|
|
91
|
+
textAlign: "left",
|
|
92
|
+
width: "100%"
|
|
156
93
|
}
|
|
157
|
-
},
|
|
158
|
-
settings: [],
|
|
159
|
-
flags: {
|
|
160
|
-
draggable: true,
|
|
161
|
-
resizable: true,
|
|
162
|
-
sortable: true
|
|
163
94
|
}
|
|
164
95
|
};
|
|
165
96
|
var container_default = Container;
|
|
166
97
|
|
|
167
|
-
// src/elements/
|
|
168
|
-
import React4, { forwardRef as forwardRef3 } from "react";
|
|
169
|
-
var Layout = forwardRef3((props, ref) => {
|
|
170
|
-
const _a = props, { css, children, rows, gap, rowSize, columns, gridSize } = _a, rest = __objRest(_a, ["css", "children", "rows", "gap", "rowSize", "columns", "gridSize"]);
|
|
171
|
-
return /* @__PURE__ */ React4.createElement("section", __spreadValues({
|
|
172
|
-
ref,
|
|
173
|
-
style: {
|
|
174
|
-
"--grid-size": gridSize + "px",
|
|
175
|
-
"--rows": rows,
|
|
176
|
-
"--columns": columns,
|
|
177
|
-
"--gap": gap + "px",
|
|
178
|
-
"--row-size": rowSize + "px",
|
|
179
|
-
"--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))"
|
|
180
|
-
}
|
|
181
|
-
}, rest), /* @__PURE__ */ React4.createElement("div", {
|
|
182
|
-
"data-layout-content": true
|
|
183
|
-
}, children));
|
|
184
|
-
});
|
|
185
|
-
var schema4 = {
|
|
186
|
-
title: "Layout",
|
|
187
|
-
type: "layout",
|
|
188
|
-
parentType: "root",
|
|
189
|
-
data: {
|
|
190
|
-
css: {
|
|
191
|
-
"@desktop": {
|
|
192
|
-
paddingTop: "16px",
|
|
193
|
-
paddingBottom: "16px",
|
|
194
|
-
paddingLeft: "var(--gap)",
|
|
195
|
-
paddingRight: "var(--gap)",
|
|
196
|
-
"> [data-layout-content]": {
|
|
197
|
-
margin: "0 auto",
|
|
198
|
-
display: "grid !important",
|
|
199
|
-
gridTemplateRows: "repeat(var(--rows), var(--row-size))",
|
|
200
|
-
gridTemplateColumns: "repeat(var(--columns), minmax(0, var(--col-size)))",
|
|
201
|
-
gap: "var(--gap)",
|
|
202
|
-
maxWidth: "var(--grid-size)"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
"@mobile": {
|
|
206
|
-
padding: "0 16px",
|
|
207
|
-
"> [data-layout-content]": {
|
|
208
|
-
display: "flex !important",
|
|
209
|
-
flexDirection: "column"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
gridSize: 1224,
|
|
214
|
-
rows: 12,
|
|
215
|
-
columns: 12,
|
|
216
|
-
gap: 16,
|
|
217
|
-
rowSize: 48
|
|
218
|
-
},
|
|
219
|
-
settings: []
|
|
220
|
-
};
|
|
221
|
-
var layout_default = Layout;
|
|
98
|
+
// src/elements/countdown/index.tsx
|
|
99
|
+
import React4, { forwardRef as forwardRef3, useContext, useEffect } from "react";
|
|
222
100
|
|
|
223
|
-
// src/elements/
|
|
224
|
-
import
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
101
|
+
// src/elements/countdown/timer-block.tsx
|
|
102
|
+
import React3 from "react";
|
|
103
|
+
function TimerBlock({ value, label }) {
|
|
104
|
+
return /* @__PURE__ */ React3.createElement("div", null, /* @__PURE__ */ React3.createElement("div", {
|
|
105
|
+
className: "wv-countdown-number"
|
|
106
|
+
}, value.toString().padStart(2, "0")), label && /* @__PURE__ */ React3.createElement("div", {
|
|
107
|
+
className: "wv-countdown-label"
|
|
108
|
+
}, label));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// src/elements/countdown/utils.ts
|
|
112
|
+
var times = ["days", "hours", "minutes", "seconds"];
|
|
113
|
+
function getTime(_seconds) {
|
|
114
|
+
const ONE_MINUTE = 60 * 1e3;
|
|
115
|
+
const ONE_HOUR = 60 * ONE_MINUTE;
|
|
116
|
+
const ONE_DAY = 24 * ONE_HOUR;
|
|
117
|
+
const days = Math.floor(_seconds / ONE_DAY);
|
|
118
|
+
const hours = Math.floor((_seconds - days * ONE_DAY) / ONE_HOUR);
|
|
119
|
+
const minutes = Math.floor((_seconds - days * ONE_DAY - hours * ONE_HOUR) / ONE_MINUTE);
|
|
120
|
+
const seconds = Math.floor((_seconds - days * ONE_DAY - hours * ONE_HOUR - minutes * ONE_MINUTE) / 1e3);
|
|
121
|
+
return { days, hours, minutes, seconds };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// src/elements/countdown/index.tsx
|
|
125
|
+
var Countdown = forwardRef3((props, ref) => {
|
|
126
|
+
const { isDesignMode } = useContext(WeaverseContext);
|
|
127
|
+
let _a = props, {
|
|
128
|
+
timerType,
|
|
129
|
+
startTime,
|
|
130
|
+
endTime,
|
|
131
|
+
periods,
|
|
132
|
+
redirectUrl,
|
|
133
|
+
openInNewTab,
|
|
134
|
+
showColon,
|
|
135
|
+
showLabel
|
|
136
|
+
} = _a, rest = __objRest(_a, [
|
|
137
|
+
"timerType",
|
|
138
|
+
"startTime",
|
|
139
|
+
"endTime",
|
|
140
|
+
"periods",
|
|
141
|
+
"redirectUrl",
|
|
142
|
+
"openInNewTab",
|
|
143
|
+
"showColon",
|
|
144
|
+
"showLabel"
|
|
145
|
+
]);
|
|
146
|
+
const [remaining, setRemaining] = React4.useState(0);
|
|
147
|
+
if (typeof endTime !== "number") {
|
|
148
|
+
endTime = Number.parseInt(endTime);
|
|
149
|
+
}
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
const flag = setInterval(() => {
|
|
152
|
+
const remainingTime = Math.max((timerType === "fixed-time" ? new Date(endTime).getTime() : new Date(startTime).getTime() + periods * 60 * 1e3) - Date.now(), 0);
|
|
153
|
+
if (!isDesignMode && redirectUrl && remainingTime > 0 && remainingTime < 1e3) {
|
|
154
|
+
window.open(redirectUrl, openInNewTab ? "_blank" : "_self");
|
|
155
|
+
}
|
|
156
|
+
setRemaining(remainingTime);
|
|
157
|
+
}, 1e3);
|
|
158
|
+
return () => {
|
|
159
|
+
clearInterval(flag);
|
|
160
|
+
};
|
|
161
|
+
}, [startTime, endTime, periods, timerType]);
|
|
162
|
+
const timer = getTime(remaining);
|
|
163
|
+
return /* @__PURE__ */ React4.createElement("div", __spreadValues({
|
|
228
164
|
ref
|
|
229
|
-
}, rest), {
|
|
230
|
-
|
|
165
|
+
}, rest), times.map((time) => {
|
|
166
|
+
return /* @__PURE__ */ React4.createElement(React4.Fragment, {
|
|
167
|
+
key: time
|
|
168
|
+
}, /* @__PURE__ */ React4.createElement(TimerBlock, {
|
|
169
|
+
label: showLabel ? time : "",
|
|
170
|
+
value: timer[time]
|
|
171
|
+
}), time !== "seconds" && /* @__PURE__ */ React4.createElement("span", {
|
|
172
|
+
className: `wv-countdown-number ${showColon ? "" : "hidden"}`
|
|
173
|
+
}, ":"));
|
|
231
174
|
}));
|
|
232
175
|
});
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
176
|
+
Countdown.defaultProps = {
|
|
177
|
+
timerType: "fixed-time",
|
|
178
|
+
startTime: Date.now(),
|
|
179
|
+
endTime: 1661140528e3,
|
|
180
|
+
periods: 90,
|
|
181
|
+
redirectUrl: "https://myshop.com",
|
|
182
|
+
openInNewTab: false,
|
|
183
|
+
showLabel: true,
|
|
184
|
+
showColon: true,
|
|
185
|
+
css: {
|
|
186
|
+
"@desktop": {
|
|
187
|
+
fontFamily: "Inter",
|
|
188
|
+
fontSize: 36,
|
|
189
|
+
fontWeight: 500,
|
|
190
|
+
display: "grid",
|
|
191
|
+
gridAutoFlow: "column",
|
|
192
|
+
gap: 10,
|
|
193
|
+
"& > div": {
|
|
194
|
+
width: 48,
|
|
195
|
+
textAlign: "center"
|
|
196
|
+
},
|
|
197
|
+
"& .wv-countdown-label": {
|
|
198
|
+
fontSize: 10
|
|
199
|
+
},
|
|
200
|
+
"& > span": {
|
|
201
|
+
lineHeight: "100%"
|
|
202
|
+
},
|
|
203
|
+
"& .hidden": {
|
|
204
|
+
visibility: "hidden"
|
|
252
205
|
}
|
|
253
206
|
}
|
|
254
207
|
}
|
|
255
208
|
};
|
|
256
|
-
var
|
|
209
|
+
var countdown_default = Countdown;
|
|
257
210
|
|
|
258
211
|
// src/elements/image.tsx
|
|
259
|
-
import
|
|
260
|
-
var Image =
|
|
261
|
-
let _a = props, { src, alt
|
|
262
|
-
return /* @__PURE__ */
|
|
212
|
+
import React5 from "react";
|
|
213
|
+
var Image = React5.forwardRef((props, ref) => {
|
|
214
|
+
let _a = props, { src, alt } = _a, rest = __objRest(_a, ["src", "alt"]);
|
|
215
|
+
return /* @__PURE__ */ React5.createElement("div", __spreadValues({
|
|
263
216
|
ref
|
|
264
|
-
}, rest), {
|
|
217
|
+
}, rest), /* @__PURE__ */ React5.createElement("img", {
|
|
265
218
|
alt,
|
|
266
219
|
src
|
|
267
220
|
}));
|
|
268
221
|
});
|
|
269
222
|
Image.defaultProps = {
|
|
270
223
|
src: "https://ucarecdn.com/1cdc9d39-ca62-492e-8ec7-f1a86b241a90/",
|
|
271
|
-
alt: "weaverse image element"
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
type: "image",
|
|
276
|
-
parentType: "layout",
|
|
277
|
-
title: "Image",
|
|
278
|
-
data: {
|
|
279
|
-
css: {
|
|
280
|
-
"@desktop": {
|
|
224
|
+
alt: "weaverse image element",
|
|
225
|
+
css: {
|
|
226
|
+
"@desktop": {
|
|
227
|
+
img: {
|
|
281
228
|
width: "100%",
|
|
282
229
|
height: "100%",
|
|
283
230
|
objectFit: "cover"
|
|
284
|
-
},
|
|
285
|
-
"@mobile": {
|
|
286
|
-
display: "block"
|
|
287
231
|
}
|
|
288
232
|
}
|
|
289
|
-
},
|
|
290
|
-
flags: {
|
|
291
|
-
resizable: true,
|
|
292
|
-
draggable: true,
|
|
293
|
-
sortable: true
|
|
294
233
|
}
|
|
295
234
|
};
|
|
296
235
|
var image_default = Image;
|
|
297
236
|
|
|
298
|
-
// src/elements/
|
|
299
|
-
import
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
let
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
controlsList: "nodownload",
|
|
318
|
-
disablePictureInPicture: true
|
|
319
|
-
}));
|
|
237
|
+
// src/elements/layout.tsx
|
|
238
|
+
import React6, { forwardRef as forwardRef4 } from "react";
|
|
239
|
+
var Layout = forwardRef4((props, ref) => {
|
|
240
|
+
let _a = props, { children, rows, gap, rowSize, columns, gridSize } = _a, rest = __objRest(_a, ["children", "rows", "gap", "rowSize", "columns", "gridSize"]);
|
|
241
|
+
let style = {
|
|
242
|
+
"--grid-size": gridSize + "px",
|
|
243
|
+
"--rows": rows,
|
|
244
|
+
"--columns": columns,
|
|
245
|
+
"--gap": gap + "px",
|
|
246
|
+
"--row-size": rowSize + "px",
|
|
247
|
+
"--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))"
|
|
248
|
+
};
|
|
249
|
+
return /* @__PURE__ */ React6.createElement("section", __spreadProps(__spreadValues({
|
|
250
|
+
ref
|
|
251
|
+
}, rest), {
|
|
252
|
+
style
|
|
253
|
+
}), /* @__PURE__ */ React6.createElement("div", {
|
|
254
|
+
"data-layout-content": true
|
|
255
|
+
}, children));
|
|
320
256
|
});
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
var
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
type: "duplicate"
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
type: "link"
|
|
257
|
+
Layout.defaultProps = {
|
|
258
|
+
gridSize: 1224,
|
|
259
|
+
rows: 12,
|
|
260
|
+
columns: 12,
|
|
261
|
+
gap: 16,
|
|
262
|
+
rowSize: 48,
|
|
263
|
+
css: {
|
|
264
|
+
"@desktop": {
|
|
265
|
+
paddingTop: "16px",
|
|
266
|
+
paddingBottom: "16px",
|
|
267
|
+
paddingLeft: "var(--gap)",
|
|
268
|
+
paddingRight: "var(--gap)",
|
|
269
|
+
"> [data-layout-content]": {
|
|
270
|
+
margin: "0 auto",
|
|
271
|
+
display: "grid !important",
|
|
272
|
+
gridTemplateRows: "repeat(var(--rows), var(--row-size))",
|
|
273
|
+
gridTemplateColumns: "repeat(var(--columns), minmax(0, var(--col-size)))",
|
|
274
|
+
gap: "var(--gap)",
|
|
275
|
+
maxWidth: "var(--grid-size)"
|
|
276
|
+
}
|
|
345
277
|
},
|
|
346
|
-
{
|
|
347
|
-
|
|
278
|
+
"@mobile": {
|
|
279
|
+
padding: "0 16px",
|
|
280
|
+
"> [data-layout-content]": {
|
|
281
|
+
display: "flex !important",
|
|
282
|
+
flexDirection: "column"
|
|
283
|
+
}
|
|
348
284
|
}
|
|
349
|
-
],
|
|
350
|
-
flags: {
|
|
351
|
-
resizable: true,
|
|
352
|
-
draggable: true,
|
|
353
|
-
sortable: true
|
|
354
285
|
}
|
|
355
286
|
};
|
|
356
|
-
var
|
|
287
|
+
var layout_default = Layout;
|
|
357
288
|
|
|
358
289
|
// src/elements/map.tsx
|
|
359
|
-
import
|
|
360
|
-
var Map =
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
return /* @__PURE__ */ React8.createElement("div", __spreadValues({
|
|
290
|
+
import React7, { forwardRef as forwardRef5 } from "react";
|
|
291
|
+
var Map = forwardRef5((props, ref) => {
|
|
292
|
+
let _a = props, { place, zoom } = _a, rest = __objRest(_a, ["place", "zoom"]);
|
|
293
|
+
return /* @__PURE__ */ React7.createElement("div", __spreadValues({
|
|
364
294
|
ref
|
|
365
|
-
},
|
|
295
|
+
}, rest), /* @__PURE__ */ React7.createElement("iframe", {
|
|
366
296
|
loading: "lazy",
|
|
367
297
|
scrolling: "no",
|
|
368
298
|
width: "100%",
|
|
369
299
|
height: "100%",
|
|
370
300
|
title: "map",
|
|
371
301
|
src: `https://maps.google.com/maps?z=${zoom}&t=m&q=${place}&ie=UTF8&&output=embed`,
|
|
372
|
-
style: {
|
|
373
|
-
pointerEvents: "none"
|
|
374
|
-
}
|
|
302
|
+
style: { pointerEvents: "none" }
|
|
375
303
|
}));
|
|
376
304
|
});
|
|
377
305
|
Map.defaultProps = {
|
|
378
306
|
place: "Hanoi",
|
|
379
307
|
zoom: 14
|
|
380
308
|
};
|
|
381
|
-
var
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
309
|
+
var map_default = Map;
|
|
310
|
+
|
|
311
|
+
// src/elements/text.tsx
|
|
312
|
+
import * as React8 from "react";
|
|
313
|
+
var Text = React8.forwardRef((props, ref) => {
|
|
314
|
+
let _a = props, { children, value } = _a, rest = __objRest(_a, ["children", "value"]);
|
|
315
|
+
return /* @__PURE__ */ React8.createElement("div", __spreadProps(__spreadValues({
|
|
316
|
+
ref
|
|
317
|
+
}, rest), {
|
|
318
|
+
dangerouslySetInnerHTML: { __html: value }
|
|
319
|
+
}));
|
|
320
|
+
});
|
|
321
|
+
Text.defaultProps = {
|
|
322
|
+
value: "The quick brown fox jumps over the lazy dog",
|
|
323
|
+
css: {
|
|
324
|
+
"@desktop": {
|
|
325
|
+
width: "100%",
|
|
326
|
+
height: "fit-content",
|
|
327
|
+
padding: "20px",
|
|
328
|
+
outline: "none",
|
|
329
|
+
wordBreak: "break-word",
|
|
330
|
+
overflowWrap: "break-word",
|
|
331
|
+
whiteSpace: "break-spaces"
|
|
404
332
|
}
|
|
405
|
-
},
|
|
406
|
-
flags: {
|
|
407
|
-
resizable: true,
|
|
408
|
-
draggable: true,
|
|
409
|
-
sortable: true
|
|
410
333
|
}
|
|
411
334
|
};
|
|
412
|
-
var
|
|
413
|
-
|
|
414
|
-
// src/elements/countdown/index.tsx
|
|
415
|
-
import React10, { forwardRef as forwardRef7, useContext as useContext2, useEffect } from "react";
|
|
416
|
-
|
|
417
|
-
// src/elements/countdown/utils.ts
|
|
418
|
-
function getTime(seconds) {
|
|
419
|
-
const ONE_MINUTE = 60 * 1e3;
|
|
420
|
-
const ONE_HOUR = 60 * ONE_MINUTE;
|
|
421
|
-
const ONE_DAY = 24 * ONE_HOUR;
|
|
422
|
-
const days = Math.floor(seconds / ONE_DAY);
|
|
423
|
-
const hours = Math.floor((seconds - days * ONE_DAY) / ONE_HOUR);
|
|
424
|
-
const mins = Math.floor((seconds - days * ONE_DAY - hours * ONE_HOUR) / ONE_MINUTE);
|
|
425
|
-
const secs = Math.floor((seconds - days * ONE_DAY - hours * ONE_HOUR - mins * ONE_MINUTE) / 1e3);
|
|
426
|
-
return { days, hours, mins, secs };
|
|
427
|
-
}
|
|
335
|
+
var text_default = Text;
|
|
428
336
|
|
|
429
|
-
// src/elements/
|
|
430
|
-
import React9 from "react";
|
|
431
|
-
var
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
337
|
+
// src/elements/video.tsx
|
|
338
|
+
import React9, { forwardRef as forwardRef7, useContext as useContext2 } from "react";
|
|
339
|
+
var Video = forwardRef7((props, ref) => {
|
|
340
|
+
let { isDesignMode } = useContext2(WeaverseContext);
|
|
341
|
+
let _a = props, { src, type, controls, poster, autoPlay, loop, muted } = _a, rest = __objRest(_a, ["src", "type", "controls", "poster", "autoPlay", "loop", "muted"]);
|
|
342
|
+
return /* @__PURE__ */ React9.createElement("div", __spreadValues({
|
|
343
|
+
ref
|
|
344
|
+
}, rest), /* @__PURE__ */ React9.createElement("video", {
|
|
345
|
+
controls: isDesignMode ? false : controls,
|
|
346
|
+
autoPlay: isDesignMode ? false : autoPlay,
|
|
347
|
+
loop,
|
|
348
|
+
muted: true,
|
|
349
|
+
controlsList: "nodownload",
|
|
350
|
+
disablePictureInPicture: true
|
|
351
|
+
}, /* @__PURE__ */ React9.createElement("source", {
|
|
352
|
+
src,
|
|
353
|
+
type: type || "video/mp4"
|
|
354
|
+
})));
|
|
355
|
+
});
|
|
356
|
+
Video.defaultProps = {
|
|
357
|
+
src: "https://ucarecdn.com/7cae0dab-8966-4484-9998-602728c360ca/IMG_0048.MOV",
|
|
358
|
+
poster: "https://ucarecdn.com/48d73272-3fe3-43f6-8b5b-22b68fc5a8c8/section.png",
|
|
359
|
+
loop: false,
|
|
360
|
+
type: "video/mp4",
|
|
361
|
+
controls: false,
|
|
362
|
+
autoPlay: true,
|
|
363
|
+
muted: true,
|
|
364
|
+
css: {
|
|
365
|
+
"@desktop": {
|
|
366
|
+
height: "fit-content",
|
|
367
|
+
margin: 0,
|
|
368
|
+
outline: "none",
|
|
369
|
+
overflowWrap: "break-word",
|
|
370
|
+
padding: 0,
|
|
371
|
+
whiteSpace: "break-spaces",
|
|
372
|
+
width: "100%",
|
|
373
|
+
wordBreak: "break-word"
|
|
374
|
+
}
|
|
375
|
+
}
|
|
435
376
|
};
|
|
436
|
-
var
|
|
377
|
+
var video_default = Video;
|
|
437
378
|
|
|
438
|
-
// src/elements/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
endTime = Number.parseInt(endTime);
|
|
454
|
-
}
|
|
455
|
-
useEffect(() => {
|
|
456
|
-
const flag = setInterval(() => {
|
|
457
|
-
const remainingTime = Math.max((type === "specific" ? new Date(endTime).getTime() : new Date(startTime) + periods * 60 * 1e3) - Date.now(), 0);
|
|
458
|
-
if (!isDesignMode && redirectUrl && remainingTime > 0 && remainingTime < 1e3) {
|
|
459
|
-
window.open(redirectUrl, openInNewTab ? "_blank" : "_self");
|
|
460
|
-
}
|
|
461
|
-
setRemaining(remainingTime);
|
|
462
|
-
}, 1e3);
|
|
463
|
-
return () => {
|
|
464
|
-
clearInterval(flag);
|
|
465
|
-
};
|
|
466
|
-
}, [startTime, endTime, periods, type]);
|
|
467
|
-
const timer = getTime(remaining);
|
|
379
|
+
// src/elements/instagram.tsx
|
|
380
|
+
import React11, { forwardRef as forwardRef9, useContext as useContext3, useEffect as useEffect2, useState } from "react";
|
|
381
|
+
|
|
382
|
+
// src/elements/shared/Placeholder.tsx
|
|
383
|
+
import React10, { forwardRef as forwardRef8 } from "react";
|
|
384
|
+
var Placeholder = forwardRef8((props, ref) => {
|
|
385
|
+
let _a = props, { element, children } = _a, rest = __objRest(_a, ["element", "children"]);
|
|
386
|
+
let style = {
|
|
387
|
+
height: "100%",
|
|
388
|
+
display: "flex",
|
|
389
|
+
flexDirection: "column",
|
|
390
|
+
alignItems: "center",
|
|
391
|
+
justifyContent: "center",
|
|
392
|
+
color: "#374151"
|
|
393
|
+
};
|
|
468
394
|
return /* @__PURE__ */ React10.createElement("div", __spreadValues({
|
|
395
|
+
style,
|
|
469
396
|
ref
|
|
470
|
-
},
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
474
|
-
className: !showColon && "hidden"
|
|
475
|
-
}, ":"), /* @__PURE__ */ React10.createElement(timer_block_default, {
|
|
476
|
-
value: timer.hours,
|
|
477
|
-
label: showLabel && "hours"
|
|
478
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
479
|
-
className: !showColon && "hidden"
|
|
480
|
-
}, ":"), /* @__PURE__ */ React10.createElement(timer_block_default, {
|
|
481
|
-
value: timer.mins,
|
|
482
|
-
label: showLabel && "minutes"
|
|
483
|
-
}), /* @__PURE__ */ React10.createElement("span", {
|
|
484
|
-
className: !showColon && "hidden"
|
|
485
|
-
}, ":"), /* @__PURE__ */ React10.createElement(timer_block_default, {
|
|
486
|
-
value: timer.secs,
|
|
487
|
-
label: showLabel && "seconds"
|
|
488
|
-
}));
|
|
397
|
+
}, rest), /* @__PURE__ */ React10.createElement("div", {
|
|
398
|
+
style: { fontWeight: 600, marginBottom: "10px" }
|
|
399
|
+
}, element), /* @__PURE__ */ React10.createElement("div", null, children));
|
|
489
400
|
});
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
};
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
401
|
+
var Placeholder_default = Placeholder;
|
|
402
|
+
|
|
403
|
+
// src/elements/instagram.tsx
|
|
404
|
+
var INSTAGRAM_API = "https://graph.instagram.com";
|
|
405
|
+
var Instagram = forwardRef9((props, ref) => {
|
|
406
|
+
const _a = props, { token, username, numberOfImages, imagesPerRow, gap } = _a, rest = __objRest(_a, ["token", "username", "numberOfImages", "imagesPerRow", "gap"]);
|
|
407
|
+
const [media, setMedia] = useState([]);
|
|
408
|
+
const [error, setError] = useState(null);
|
|
409
|
+
let { isDesignMode } = useContext3(WeaverseContext);
|
|
410
|
+
useEffect2(() => {
|
|
411
|
+
if (token) {
|
|
412
|
+
let params = new URLSearchParams({
|
|
413
|
+
access_token: token,
|
|
414
|
+
fields: "id,media_type,caption,media_url,permalink"
|
|
415
|
+
});
|
|
416
|
+
fetch(`${INSTAGRAM_API}/me/media?${params.toString()}`).then((res) => res.json()).then((res) => {
|
|
417
|
+
if (res.error) {
|
|
418
|
+
setError(res);
|
|
419
|
+
} else {
|
|
420
|
+
setError(null);
|
|
421
|
+
setMedia([...res.data]);
|
|
422
|
+
}
|
|
423
|
+
}).catch(setError);
|
|
424
|
+
}
|
|
425
|
+
}, [token]);
|
|
426
|
+
if (!token || error) {
|
|
427
|
+
return /* @__PURE__ */ React11.createElement("div", __spreadValues({
|
|
428
|
+
ref
|
|
429
|
+
}, rest), /* @__PURE__ */ React11.createElement(Placeholder_default, {
|
|
430
|
+
element: "Instagram"
|
|
431
|
+
}, !token ? "Connect your Instagram account to display photos on your site." : "Invalid or expired token!"));
|
|
432
|
+
}
|
|
433
|
+
let style = {
|
|
434
|
+
"--wv-ig-images-per-row": imagesPerRow,
|
|
435
|
+
"--wv-ig-images-gap": gap
|
|
436
|
+
};
|
|
437
|
+
return /* @__PURE__ */ React11.createElement("div", __spreadProps(__spreadValues({
|
|
438
|
+
ref
|
|
439
|
+
}, rest), {
|
|
440
|
+
style
|
|
441
|
+
}), /* @__PURE__ */ React11.createElement("div", {
|
|
442
|
+
className: "wv-ig-medias"
|
|
443
|
+
}, media.slice(0, numberOfImages).map((item) => {
|
|
444
|
+
let linkProps;
|
|
445
|
+
if (!isDesignMode) {
|
|
446
|
+
linkProps = { href: item.permalink, target: "_blank" };
|
|
515
447
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
448
|
+
return /* @__PURE__ */ React11.createElement("a", __spreadValues({
|
|
449
|
+
key: item.id
|
|
450
|
+
}, linkProps), /* @__PURE__ */ React11.createElement("img", {
|
|
451
|
+
alt: item.caption,
|
|
452
|
+
src: item.media_url
|
|
453
|
+
}));
|
|
454
|
+
})));
|
|
455
|
+
});
|
|
456
|
+
Instagram.defaultProps = {
|
|
457
|
+
token: "",
|
|
458
|
+
username: "",
|
|
459
|
+
numberOfImages: 8,
|
|
460
|
+
imagesPerRow: 4,
|
|
461
|
+
gap: 0,
|
|
462
|
+
css: {
|
|
463
|
+
"@desktop": {
|
|
464
|
+
".wv-ig-medias": {
|
|
465
|
+
overflow: "hidden",
|
|
466
|
+
maxWidth: "100%",
|
|
467
|
+
maxHeight: "100%",
|
|
523
468
|
display: "grid",
|
|
524
|
-
|
|
525
|
-
gap:
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
fontSize: 10
|
|
532
|
-
},
|
|
533
|
-
"& > span": {
|
|
534
|
-
lineHeight: "100%"
|
|
535
|
-
},
|
|
536
|
-
"& .hidden": {
|
|
537
|
-
visibility: "hidden"
|
|
469
|
+
gridTemplateColumns: "repeat(var(--wv-ig-images-per-row, 4), 1fr)",
|
|
470
|
+
gap: "var(--wv-ig-images-gap, 0px)",
|
|
471
|
+
img: {
|
|
472
|
+
aspectRatio: "1 / 1",
|
|
473
|
+
width: "100%",
|
|
474
|
+
height: "100%",
|
|
475
|
+
objectFit: "cover"
|
|
538
476
|
}
|
|
539
477
|
}
|
|
540
478
|
}
|
|
541
|
-
},
|
|
542
|
-
flags: {
|
|
543
|
-
draggable: true
|
|
544
479
|
}
|
|
545
480
|
};
|
|
546
|
-
var
|
|
481
|
+
var instagram_default = Instagram;
|
|
547
482
|
|
|
548
483
|
// src/elements/index.ts
|
|
549
484
|
var elements = {
|
|
485
|
+
Countdown: {
|
|
486
|
+
Component: countdown_default,
|
|
487
|
+
type: "countdown"
|
|
488
|
+
},
|
|
550
489
|
Button: {
|
|
551
490
|
Component: button_default,
|
|
552
|
-
|
|
553
|
-
},
|
|
554
|
-
BaseElement: {
|
|
555
|
-
Component: base_default,
|
|
556
|
-
schema
|
|
557
|
-
},
|
|
558
|
-
Text: {
|
|
559
|
-
Component: text_default,
|
|
560
|
-
schema: schema5
|
|
561
|
-
},
|
|
562
|
-
Layout: {
|
|
563
|
-
Component: layout_default,
|
|
564
|
-
schema: schema4
|
|
491
|
+
type: "button"
|
|
565
492
|
},
|
|
566
493
|
Container: {
|
|
567
494
|
Component: container_default,
|
|
568
|
-
|
|
495
|
+
type: "container"
|
|
569
496
|
},
|
|
570
497
|
Image: {
|
|
571
498
|
Component: image_default,
|
|
572
|
-
|
|
499
|
+
type: "image"
|
|
573
500
|
},
|
|
574
|
-
|
|
575
|
-
Component:
|
|
576
|
-
|
|
501
|
+
Instagram: {
|
|
502
|
+
Component: instagram_default,
|
|
503
|
+
type: "instagram"
|
|
504
|
+
},
|
|
505
|
+
Layout: {
|
|
506
|
+
Component: layout_default,
|
|
507
|
+
type: "layout"
|
|
577
508
|
},
|
|
578
509
|
Map: {
|
|
579
510
|
Component: map_default,
|
|
580
|
-
|
|
511
|
+
type: "map"
|
|
581
512
|
},
|
|
582
|
-
|
|
583
|
-
Component:
|
|
584
|
-
|
|
513
|
+
Text: {
|
|
514
|
+
Component: text_default,
|
|
515
|
+
type: "text"
|
|
516
|
+
},
|
|
517
|
+
Video: {
|
|
518
|
+
Component: video_default,
|
|
519
|
+
type: "video"
|
|
585
520
|
}
|
|
586
521
|
};
|
|
587
522
|
var elements_default = elements;
|
|
@@ -600,24 +535,25 @@ var WeaverseContextConsumer = WeaverseContext.Consumer;
|
|
|
600
535
|
|
|
601
536
|
// src/renderer.tsx
|
|
602
537
|
import { isBrowser } from "@weaverse/core";
|
|
603
|
-
import
|
|
538
|
+
import React12, { useContext as useContext4, useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
604
539
|
|
|
605
540
|
// src/utils/index.ts
|
|
606
541
|
var shortCssObject = (css) => {
|
|
607
542
|
return {
|
|
608
|
-
"@desktop": css[
|
|
609
|
-
"@mobile": css[
|
|
543
|
+
"@desktop": css["@desktop"],
|
|
544
|
+
"@mobile": css["@mobile"]
|
|
610
545
|
};
|
|
611
546
|
};
|
|
612
547
|
function generateItemClass(instance, stitchesInstance) {
|
|
613
|
-
var _a;
|
|
548
|
+
var _a, _b, _c, _d;
|
|
614
549
|
let { css, className: cls = "" } = instance.data;
|
|
550
|
+
let defaultCss = ((_c = (_b = (_a = instance.Element) == null ? void 0 : _a.Component) == null ? void 0 : _b.defaultProps) == null ? void 0 : _c.css) || {};
|
|
615
551
|
let className = "";
|
|
616
|
-
if (css) {
|
|
617
|
-
let formattedCss = shortCssObject(css);
|
|
552
|
+
if (css || defaultCss) {
|
|
553
|
+
let formattedCss = shortCssObject(css || defaultCss);
|
|
618
554
|
let { className: newClass = "" } = stitchesInstance.css(formattedCss)();
|
|
619
555
|
let { stitchesClass } = instance;
|
|
620
|
-
let otherClass = (((
|
|
556
|
+
let otherClass = (((_d = instance.ref.current) == null ? void 0 : _d.className) || "").replace(stitchesClass, "").replace(cls, "").trim();
|
|
621
557
|
className = `${cls} ${newClass} ${otherClass}`.trim();
|
|
622
558
|
instance.stitchesClass = newClass;
|
|
623
559
|
}
|
|
@@ -627,9 +563,9 @@ function generateItemClass(instance, stitchesInstance) {
|
|
|
627
563
|
// src/renderer.tsx
|
|
628
564
|
var WeaverseRoot = ({ context }) => {
|
|
629
565
|
var _a;
|
|
630
|
-
let [, setData] =
|
|
566
|
+
let [, setData] = useState2(context.projectData);
|
|
631
567
|
let rootRef = useRef();
|
|
632
|
-
|
|
568
|
+
useEffect3(() => {
|
|
633
569
|
let update = () => setData({});
|
|
634
570
|
context.subscribe(update);
|
|
635
571
|
if (context.projectData) {
|
|
@@ -642,21 +578,22 @@ var WeaverseRoot = ({ context }) => {
|
|
|
642
578
|
}, []);
|
|
643
579
|
let eventHandlers = ((_a = context == null ? void 0 : context.studioBridge) == null ? void 0 : _a.eventHandlers) || {};
|
|
644
580
|
let themeClass = context.stitchesInstance.theme.className;
|
|
645
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ React12.createElement("div", __spreadProps(__spreadValues({
|
|
646
582
|
className: `weaverse-content-root ${themeClass}`
|
|
647
583
|
}, eventHandlers), {
|
|
648
584
|
ref: rootRef
|
|
649
|
-
}), /* @__PURE__ */
|
|
585
|
+
}), /* @__PURE__ */ React12.createElement(WeaverseContextProvider, {
|
|
650
586
|
value: context
|
|
651
|
-
}, /* @__PURE__ */
|
|
587
|
+
}, /* @__PURE__ */ React12.createElement(ItemInstance, {
|
|
652
588
|
id: context.projectData.rootId || 0
|
|
653
589
|
})));
|
|
654
590
|
};
|
|
655
591
|
var ItemComponent = ({ instance }) => {
|
|
656
|
-
let { stitchesInstance, elementInstances } =
|
|
657
|
-
let [data, setData] =
|
|
658
|
-
let _a = data, { id, type, childIds = [], css, className
|
|
659
|
-
|
|
592
|
+
let { stitchesInstance, elementInstances } = useContext4(WeaverseContext);
|
|
593
|
+
let [data, setData] = useState2(instance.data);
|
|
594
|
+
let _a = data, { id, type, childIds = [], css, className } = _a, rest = __objRest(_a, ["id", "type", "childIds", "css", "className"]);
|
|
595
|
+
useEffect3(() => {
|
|
596
|
+
var _a2;
|
|
660
597
|
let update = (data2) => setData(__spreadValues({}, data2));
|
|
661
598
|
instance.subscribe(update);
|
|
662
599
|
if (isBrowser && !instance.ref.current) {
|
|
@@ -664,22 +601,23 @@ var ItemComponent = ({ instance }) => {
|
|
|
664
601
|
current: document.querySelector(`[data-wv-id="${id}"]`)
|
|
665
602
|
});
|
|
666
603
|
}
|
|
604
|
+
(_a2 = instance.ref.current) == null ? void 0 : _a2.removeAttribute("css");
|
|
667
605
|
return () => {
|
|
668
606
|
instance.unsubscribe(update);
|
|
669
607
|
};
|
|
670
608
|
}, []);
|
|
671
|
-
let Element = elementInstances.get(type
|
|
609
|
+
let Element = elementInstances.get(type);
|
|
672
610
|
if (Element == null ? void 0 : Element.Component) {
|
|
673
611
|
let Component = Element.Component;
|
|
674
612
|
if (Component.$$typeof === Symbol.for("react.forward_ref")) {
|
|
675
613
|
rest.ref = instance.ref;
|
|
676
614
|
}
|
|
677
|
-
return /* @__PURE__ */
|
|
615
|
+
return /* @__PURE__ */ React12.createElement(Component, __spreadValues({
|
|
678
616
|
key: id,
|
|
679
617
|
"data-wv-type": type,
|
|
680
618
|
"data-wv-id": id,
|
|
681
619
|
className: generateItemClass(instance, stitchesInstance)
|
|
682
|
-
}, rest), childIds.map((id2) => /* @__PURE__ */
|
|
620
|
+
}, rest), childIds.map((id2) => /* @__PURE__ */ React12.createElement(ItemInstance, {
|
|
683
621
|
key: id2,
|
|
684
622
|
id: id2
|
|
685
623
|
})));
|
|
@@ -687,15 +625,15 @@ var ItemComponent = ({ instance }) => {
|
|
|
687
625
|
return null;
|
|
688
626
|
};
|
|
689
627
|
var ItemInstance = ({ id }) => {
|
|
690
|
-
let context =
|
|
628
|
+
let context = useContext4(WeaverseContext);
|
|
691
629
|
let { itemInstances } = context;
|
|
692
630
|
let instance = itemInstances.get(id);
|
|
693
631
|
if (!instance) {
|
|
694
|
-
return /* @__PURE__ */
|
|
632
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
695
633
|
style: { display: "none" }
|
|
696
634
|
}, "Item instance ", id, " not found");
|
|
697
635
|
}
|
|
698
|
-
return /* @__PURE__ */
|
|
636
|
+
return /* @__PURE__ */ React12.createElement(ItemComponent, {
|
|
699
637
|
instance
|
|
700
638
|
});
|
|
701
639
|
};
|