@weaverse/react 1.0.47 → 1.0.48

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.mjs CHANGED
@@ -1,2068 +1,47 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, { get: all[name], enumerable: true });
5
- };
6
-
7
1
  // src/index.ts
8
2
  export * from "@weaverse/core";
9
3
 
10
4
  // src/context.ts
11
- import { Weaverse } from "@weaverse/core";
12
5
  import { createContext } from "react";
6
+ var WeaverseContext = createContext({});
7
+ var WeaverseContextProvider = WeaverseContext.Provider;
8
+ var WeaverseContextConsumer = WeaverseContext.Consumer;
13
9
 
14
- // src/elements/button.tsx
15
- import * as React from "react";
16
- import { useContext } from "react";
17
- var Button = React.forwardRef((props, ref) => {
18
- let { isDesignMode } = useContext(WeaverseContext);
19
- let { text, clickAction, linkTo, openInNewTab, ...rest } = props;
20
- if (clickAction === "none") {
21
- return /* @__PURE__ */ React.createElement("button", { ref, ...rest }, text);
22
- }
23
- return /* @__PURE__ */ React.createElement(
24
- "a",
25
- {
26
- ref,
27
- href: !isDesignMode ? linkTo : void 0,
28
- target: openInNewTab ? "_blank" : "_self",
29
- rel: "noreferrer",
30
- ...rest
31
- },
32
- text
33
- );
34
- });
35
- Button.defaultProps = {
36
- type: "button",
37
- text: "BUTTON",
38
- clickAction: "none",
39
- linkTo: "",
40
- openInNewTab: false
41
- };
42
- var css = {
43
- "@desktop": {
44
- borderRadius: "4px",
45
- border: "none",
46
- backgroundColor: "#3E3F40",
47
- color: "#fff",
48
- fontSize: "14px",
49
- lineHeight: "1.5",
50
- letterSpacing: "0",
51
- fontWeight: "medium",
52
- padding: "10px 20px",
53
- height: "42px",
54
- minWidth: "120px",
55
- textDecoration: "none",
56
- textAlign: "center",
57
- "&:hover": {
58
- backgroundColor: "#1A1B1B"
59
- }
60
- }
61
- };
62
- var button_default = Button;
63
-
64
- // src/elements/container.tsx
65
- import React14, { Children, forwardRef as forwardRef4 } from "react";
66
-
67
- // src/components/modal/index.tsx
68
- var modal_exports = {};
69
- __export(modal_exports, {
70
- Modal: () => Modal,
71
- ModalClose: () => ModalClose,
72
- ModalContent: () => ModalContent,
73
- ModalHeader: () => ModalHeader,
74
- ModalTrigger: () => ModalTrigger
75
- });
76
- import { Close, Portal, Root, Trigger } from "@radix-ui/react-dialog";
77
- import React4, { forwardRef as forwardRef2 } from "react";
78
-
79
- // src/components/icons/index.tsx
80
- import React3 from "react";
81
-
82
- // src/components/icons/phosphor.tsx
83
- var phosphor_exports = {};
84
- __export(phosphor_exports, {
85
- ArrowLeft: () => ArrowLeft,
86
- ArrowRight: () => ArrowRight,
87
- Backpack: () => Backpack,
88
- CaretLeft: () => CaretLeft,
89
- CaretRight: () => CaretRight,
90
- Circle: () => Circle,
91
- CircleNotch: () => CircleNotch,
92
- Eye: () => Eye,
93
- HandBag: () => HandBag,
94
- Image: () => Image,
95
- Minus: () => Minus,
96
- Newspaper: () => Newspaper,
97
- Package: () => Package,
98
- Plus: () => Plus,
99
- ShoppingCart: () => ShoppingCart,
100
- Storefront: () => Storefront,
101
- Tag: () => Tag,
102
- X: () => X
103
- });
104
- import React2 from "react";
105
- var Circle = (props) => {
106
- return /* @__PURE__ */ React2.createElement(
107
- "svg",
108
- {
109
- xmlns: "http://www.w3.org/2000/svg",
110
- width: "192",
111
- height: "192",
112
- fill: "currentColor",
113
- viewBox: "0 0 256 256",
114
- ...props
115
- },
116
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
117
- /* @__PURE__ */ React2.createElement("circle", { cx: "128", cy: "128", r: "104" })
118
- );
119
- };
120
- var CircleNotch = (props) => {
121
- return /* @__PURE__ */ React2.createElement(
122
- "svg",
123
- {
124
- xmlns: "http://www.w3.org/2000/svg",
125
- fill: "none",
126
- viewBox: "0 0 24 24",
127
- ...props
128
- },
129
- /* @__PURE__ */ React2.createElement(
130
- "circle",
131
- {
132
- style: { opacity: ".25" },
133
- cx: "12",
134
- cy: "12",
135
- r: "10",
136
- stroke: "currentColor",
137
- strokeWidth: "4"
138
- }
139
- ),
140
- /* @__PURE__ */ React2.createElement(
141
- "path",
142
- {
143
- style: { opacity: ".75" },
144
- fill: "currentColor",
145
- d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
146
- }
147
- )
148
- );
149
- };
150
- var X = (props) => {
151
- return /* @__PURE__ */ React2.createElement(
152
- "svg",
153
- {
154
- xmlns: "http://www.w3.org/2000/svg",
155
- width: "20",
156
- height: "20",
157
- fill: "currentColor",
158
- viewBox: "0 0 256 256",
159
- ...props
160
- },
161
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
162
- /* @__PURE__ */ React2.createElement(
163
- "line",
164
- {
165
- x1: "200",
166
- y1: "56",
167
- x2: "56",
168
- y2: "200",
169
- fill: "none",
170
- stroke: "currentColor",
171
- strokeLinecap: "round",
172
- strokeLinejoin: "round",
173
- strokeWidth: "12"
174
- }
175
- ),
176
- /* @__PURE__ */ React2.createElement(
177
- "line",
178
- {
179
- x1: "200",
180
- y1: "200",
181
- x2: "56",
182
- y2: "56",
183
- fill: "none",
184
- stroke: "currentColor",
185
- strokeLinecap: "round",
186
- strokeLinejoin: "round",
187
- strokeWidth: "12"
188
- }
189
- )
190
- );
191
- };
192
- var Minus = (props) => {
193
- return /* @__PURE__ */ React2.createElement(
194
- "svg",
195
- {
196
- xmlns: "http://www.w3.org/2000/svg",
197
- width: "192",
198
- height: "192",
199
- fill: "currentColor",
200
- viewBox: "0 0 256 256",
201
- ...props
202
- },
203
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
204
- /* @__PURE__ */ React2.createElement(
205
- "line",
206
- {
207
- x1: "40",
208
- y1: "128",
209
- x2: "216",
210
- y2: "128",
211
- fill: "none",
212
- stroke: "currentColor",
213
- strokeLinecap: "round",
214
- strokeLinejoin: "round",
215
- strokeWidth: "16"
216
- }
217
- )
218
- );
219
- };
220
- var Plus = (props) => {
221
- return /* @__PURE__ */ React2.createElement(
222
- "svg",
223
- {
224
- xmlns: "http://www.w3.org/2000/svg",
225
- width: "192",
226
- height: "192",
227
- fill: "currentColor",
228
- viewBox: "0 0 256 256",
229
- ...props
230
- },
231
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
232
- /* @__PURE__ */ React2.createElement(
233
- "line",
234
- {
235
- x1: "40",
236
- y1: "128",
237
- x2: "216",
238
- y2: "128",
239
- fill: "none",
240
- stroke: "currentColor",
241
- strokeLinecap: "round",
242
- strokeLinejoin: "round",
243
- strokeWidth: "16"
244
- }
245
- ),
246
- /* @__PURE__ */ React2.createElement(
247
- "line",
248
- {
249
- x1: "128",
250
- y1: "40",
251
- x2: "128",
252
- y2: "216",
253
- fill: "none",
254
- stroke: "currentColor",
255
- strokeLinecap: "round",
256
- strokeLinejoin: "round",
257
- strokeWidth: "16"
258
- }
259
- )
260
- );
261
- };
262
- var CaretLeft = (props) => {
263
- return /* @__PURE__ */ React2.createElement(
264
- "svg",
265
- {
266
- xmlns: "http://www.w3.org/2000/svg",
267
- width: "192",
268
- height: "192",
269
- fill: "currentColor",
270
- viewBox: "0 0 256 256",
271
- ...props
272
- },
273
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
274
- /* @__PURE__ */ React2.createElement(
275
- "polyline",
276
- {
277
- points: "160 208 80 128 160 48",
278
- fill: "none",
279
- stroke: "currentColor",
280
- strokeLinecap: "round",
281
- strokeLinejoin: "round",
282
- strokeWidth: "16"
283
- }
284
- )
285
- );
286
- };
287
- var CaretRight = (props) => {
288
- return /* @__PURE__ */ React2.createElement(
289
- "svg",
290
- {
291
- xmlns: "http://www.w3.org/2000/svg",
292
- width: "192",
293
- height: "192",
294
- fill: "currentColor",
295
- viewBox: "0 0 256 256",
296
- ...props
297
- },
298
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
299
- /* @__PURE__ */ React2.createElement(
300
- "polyline",
301
- {
302
- points: "96 48 176 128 96 208",
303
- fill: "none",
304
- stroke: "currentColor",
305
- strokeLinecap: "round",
306
- strokeLinejoin: "round",
307
- strokeWidth: "16"
308
- }
309
- )
310
- );
311
- };
312
- var ArrowLeft = (props) => {
313
- return /* @__PURE__ */ React2.createElement(
314
- "svg",
315
- {
316
- xmlns: "http://www.w3.org/2000/svg",
317
- width: "192",
318
- height: "192",
319
- fill: "currentColor",
320
- viewBox: "0 0 256 256",
321
- ...props
322
- },
323
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
324
- /* @__PURE__ */ React2.createElement(
325
- "line",
326
- {
327
- x1: "216",
328
- y1: "128",
329
- x2: "40",
330
- y2: "128",
331
- fill: "none",
332
- stroke: "currentColor",
333
- strokeLinecap: "round",
334
- strokeLinejoin: "round",
335
- strokeWidth: "16"
336
- }
337
- ),
338
- /* @__PURE__ */ React2.createElement(
339
- "polyline",
340
- {
341
- points: "112 56 40 128 112 200",
342
- fill: "none",
343
- stroke: "currentColor",
344
- strokeLinecap: "round",
345
- strokeLinejoin: "round",
346
- strokeWidth: "16"
347
- }
348
- )
349
- );
350
- };
351
- var ArrowRight = (props) => {
352
- return /* @__PURE__ */ React2.createElement(
353
- "svg",
354
- {
355
- xmlns: "http://www.w3.org/2000/svg",
356
- width: "192",
357
- height: "192",
358
- fill: "currentColor",
359
- viewBox: "0 0 256 256",
360
- ...props
361
- },
362
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
363
- /* @__PURE__ */ React2.createElement(
364
- "line",
365
- {
366
- x1: "40",
367
- y1: "128",
368
- x2: "216",
369
- y2: "128",
370
- fill: "none",
371
- stroke: "currentColor",
372
- strokeLinecap: "round",
373
- strokeLinejoin: "round",
374
- strokeWidth: "16"
375
- }
376
- ),
377
- /* @__PURE__ */ React2.createElement(
378
- "polyline",
379
- {
380
- points: "144 56 216 128 144 200",
381
- fill: "none",
382
- stroke: "currentColor",
383
- strokeLinecap: "round",
384
- strokeLinejoin: "round",
385
- strokeWidth: "16"
386
- }
387
- )
388
- );
389
- };
390
- var Image = (props) => {
391
- return /* @__PURE__ */ React2.createElement(
392
- "svg",
393
- {
394
- xmlns: "http://www.w3.org/2000/svg",
395
- "aria-hidden": "true",
396
- fill: "currentColor",
397
- viewBox: "0 0 640 512",
398
- ...props
399
- },
400
- /* @__PURE__ */ React2.createElement("path", { d: "M480 80C480 35.82 515.8 0 560 0C604.2 0 640 35.82 640 80C640 124.2 604.2 160 560 160C515.8 160 480 124.2 480 80zM0 456.1C0 445.6 2.964 435.3 8.551 426.4L225.3 81.01C231.9 70.42 243.5 64 256 64C268.5 64 280.1 70.42 286.8 81.01L412.7 281.7L460.9 202.7C464.1 196.1 472.2 192 480 192C487.8 192 495 196.1 499.1 202.7L631.1 419.1C636.9 428.6 640 439.7 640 450.9C640 484.6 612.6 512 578.9 512H55.91C25.03 512 .0006 486.1 .0006 456.1L0 456.1z" })
401
- );
402
- };
403
- var ShoppingCart = (props) => {
404
- return /* @__PURE__ */ React2.createElement(
405
- "svg",
406
- {
407
- xmlns: "http://www.w3.org/2000/svg",
408
- width: "192",
409
- height: "192",
410
- fill: "currentColor",
411
- viewBox: "0 0 256 256",
412
- ...props
413
- },
414
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
415
- /* @__PURE__ */ React2.createElement(
416
- "path",
417
- {
418
- d: "M184,184H69.8L41.9,30.6A8,8,0,0,0,34.1,24H16",
419
- fill: "none",
420
- stroke: "currentColor",
421
- strokeLinecap: "round",
422
- strokeLinejoin: "round",
423
- strokeWidth: "16"
424
- }
425
- ),
426
- /* @__PURE__ */ React2.createElement(
427
- "circle",
428
- {
429
- cx: "80",
430
- cy: "204",
431
- r: "20",
432
- fill: "none",
433
- stroke: "currentColor",
434
- strokeLinecap: "round",
435
- strokeLinejoin: "round",
436
- strokeWidth: "16"
437
- }
438
- ),
439
- /* @__PURE__ */ React2.createElement(
440
- "circle",
441
- {
442
- cx: "184",
443
- cy: "204",
444
- r: "20",
445
- fill: "none",
446
- stroke: "currentColor",
447
- strokeLinecap: "round",
448
- strokeLinejoin: "round",
449
- strokeWidth: "16"
450
- }
451
- ),
452
- /* @__PURE__ */ React2.createElement(
453
- "path",
454
- {
455
- d: "M62.5,144H188.1a15.9,15.9,0,0,0,15.7-13.1L216,64H48",
456
- fill: "none",
457
- stroke: "currentColor",
458
- strokeLinecap: "round",
459
- strokeLinejoin: "round",
460
- strokeWidth: "16"
461
- }
462
- )
463
- );
464
- };
465
- var Storefront = (props) => {
466
- return /* @__PURE__ */ React2.createElement(
467
- "svg",
468
- {
469
- xmlns: "http://www.w3.org/2000/svg",
470
- width: "192",
471
- height: "192",
472
- fill: "currentColor",
473
- viewBox: "0 0 256 256",
474
- ...props
475
- },
476
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
477
- /* @__PURE__ */ React2.createElement(
478
- "path",
479
- {
480
- d: "M48,139.6V208a8,8,0,0,0,8,8H200a8,8,0,0,0,8-8V139.6",
481
- fill: "none",
482
- stroke: "currentColor",
483
- strokeLinecap: "round",
484
- strokeLinejoin: "round",
485
- strokeWidth: "12"
486
- }
487
- ),
488
- /* @__PURE__ */ React2.createElement(
489
- "path",
490
- {
491
- d: "M54,40H202a8.1,8.1,0,0,1,7.7,5.8L224,96H32L46.3,45.8A8.1,8.1,0,0,1,54,40Z",
492
- fill: "none",
493
- stroke: "currentColor",
494
- strokeLinecap: "round",
495
- strokeLinejoin: "round",
496
- strokeWidth: "12"
497
- }
498
- ),
499
- /* @__PURE__ */ React2.createElement(
500
- "path",
501
- {
502
- d: "M96,96v16a32,32,0,0,1-64,0V96",
503
- fill: "none",
504
- stroke: "currentColor",
505
- strokeLinecap: "round",
506
- strokeLinejoin: "round",
507
- strokeWidth: "12"
508
- }
509
- ),
510
- /* @__PURE__ */ React2.createElement(
511
- "path",
512
- {
513
- d: "M160,96v16a32,32,0,0,1-64,0V96",
514
- fill: "none",
515
- stroke: "currentColor",
516
- strokeLinecap: "round",
517
- strokeLinejoin: "round",
518
- strokeWidth: "12"
519
- }
520
- ),
521
- /* @__PURE__ */ React2.createElement(
522
- "path",
523
- {
524
- d: "M224,96v16a32,32,0,0,1-64,0V96",
525
- fill: "none",
526
- stroke: "currentColor",
527
- strokeLinecap: "round",
528
- strokeLinejoin: "round",
529
- strokeWidth: "12"
530
- }
531
- )
532
- );
533
- };
534
- var Package = (props) => {
535
- return /* @__PURE__ */ React2.createElement(
536
- "svg",
537
- {
538
- xmlns: "http://www.w3.org/2000/svg",
539
- width: "192",
540
- height: "192",
541
- fill: "currentColor",
542
- viewBox: "0 0 256 256",
543
- ...props
544
- },
545
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
546
- /* @__PURE__ */ React2.createElement(
547
- "path",
548
- {
549
- d: "M224,177.3V78.7a8.1,8.1,0,0,0-4.1-7l-88-49.5a7.8,7.8,0,0,0-7.8,0l-88,49.5a8.1,8.1,0,0,0-4.1,7v98.6a8.1,8.1,0,0,0,4.1,7l88,49.5a7.8,7.8,0,0,0,7.8,0l88-49.5A8.1,8.1,0,0,0,224,177.3Z",
550
- fill: "none",
551
- stroke: "currentColor",
552
- strokeLinecap: "round",
553
- strokeLinejoin: "round",
554
- strokeWidth: "8"
555
- }
556
- ),
557
- /* @__PURE__ */ React2.createElement(
558
- "polyline",
559
- {
560
- points: "177 152.5 177 100.5 80 47",
561
- fill: "none",
562
- stroke: "currentColor",
563
- strokeLinecap: "round",
564
- strokeLinejoin: "round",
565
- strokeWidth: "8"
566
- }
567
- ),
568
- /* @__PURE__ */ React2.createElement(
569
- "polyline",
570
- {
571
- points: "222.9 74.6 128.9 128 33.1 74.6",
572
- fill: "none",
573
- stroke: "currentColor",
574
- strokeLinecap: "round",
575
- strokeLinejoin: "round",
576
- strokeWidth: "8"
577
- }
578
- ),
579
- /* @__PURE__ */ React2.createElement(
580
- "line",
581
- {
582
- x1: "128.9",
583
- y1: "128",
584
- x2: "128",
585
- y2: "234.8",
586
- fill: "none",
587
- stroke: "currentColor",
588
- strokeLinecap: "round",
589
- strokeLinejoin: "round",
590
- strokeWidth: "8"
591
- }
592
- )
593
- );
594
- };
595
- var HandBag = (props) => {
596
- return /* @__PURE__ */ React2.createElement(
597
- "svg",
598
- {
599
- xmlns: "http://www.w3.org/2000/svg",
600
- width: "192",
601
- height: "192",
602
- fill: "currentColor",
603
- viewBox: "0 0 256 256",
604
- ...props
605
- },
606
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
607
- /* @__PURE__ */ React2.createElement(
608
- "path",
609
- {
610
- d: "M208.8,72H47.2a8.1,8.1,0,0,0-8,7.1L25,207.1a8,8,0,0,0,7.9,8.9H223.1a8,8,0,0,0,7.9-8.9l-14.2-128A8.1,8.1,0,0,0,208.8,72Z",
611
- fill: "none",
612
- stroke: "currentColor",
613
- strokeLinecap: "round",
614
- strokeLinejoin: "round",
615
- strokeWidth: "16"
616
- }
617
- ),
618
- /* @__PURE__ */ React2.createElement(
619
- "path",
620
- {
621
- d: "M88,104V72a40,40,0,0,1,80,0v32",
622
- fill: "none",
623
- stroke: "currentColor",
624
- strokeLinecap: "round",
625
- strokeLinejoin: "round",
626
- strokeWidth: "16"
627
- }
628
- )
629
- );
630
- };
631
- var Tag = (props) => {
632
- return /* @__PURE__ */ React2.createElement(
633
- "svg",
634
- {
635
- xmlns: "http://www.w3.org/2000/svg",
636
- width: "192",
637
- height: "192",
638
- fill: "currentColor",
639
- viewBox: "0 0 256 256",
640
- ...props
641
- },
642
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
643
- /* @__PURE__ */ React2.createElement(
644
- "path",
645
- {
646
- d: "M122.7,25.9,42,42,25.9,122.7a8,8,0,0,0,2.2,7.2L132.5,234.3a7.9,7.9,0,0,0,11.3,0l90.5-90.5a7.9,7.9,0,0,0,0-11.3L129.9,28.1A8,8,0,0,0,122.7,25.9Z",
647
- fill: "none",
648
- stroke: "currentColor",
649
- strokeLinecap: "round",
650
- strokeLinejoin: "round",
651
- strokeWidth: "16"
652
- }
653
- ),
654
- /* @__PURE__ */ React2.createElement("circle", { cx: "84", cy: "84", r: "12" })
655
- );
656
- };
657
- var Backpack = (props) => {
658
- return /* @__PURE__ */ React2.createElement(
659
- "svg",
660
- {
661
- xmlns: "http://www.w3.org/2000/svg",
662
- width: "192",
663
- height: "192",
664
- fill: "currentColor",
665
- viewBox: "0 0 256 256",
666
- ...props
667
- },
668
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
669
- /* @__PURE__ */ React2.createElement(
670
- "path",
671
- {
672
- d: "M96,48h64a48,48,0,0,1,48,48V216a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V96A48,48,0,0,1,96,48Z",
673
- fill: "none",
674
- stroke: "currentColor",
675
- strokeLinecap: "round",
676
- strokeLinejoin: "round",
677
- strokeWidth: "12"
678
- }
679
- ),
680
- /* @__PURE__ */ React2.createElement(
681
- "path",
682
- {
683
- d: "M80,224V152a16,16,0,0,1,16-16h64a16,16,0,0,1,16,16v72",
684
- fill: "none",
685
- stroke: "currentColor",
686
- strokeLinecap: "round",
687
- strokeLinejoin: "round",
688
- strokeWidth: "12"
689
- }
690
- ),
691
- /* @__PURE__ */ React2.createElement(
692
- "path",
693
- {
694
- d: "M96,48V32a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V48",
695
- fill: "none",
696
- stroke: "currentColor",
697
- strokeLinecap: "round",
698
- strokeLinejoin: "round",
699
- strokeWidth: "12"
700
- }
701
- ),
702
- /* @__PURE__ */ React2.createElement(
703
- "line",
704
- {
705
- x1: "112",
706
- y1: "88",
707
- x2: "144",
708
- y2: "88",
709
- fill: "none",
710
- stroke: "currentColor",
711
- strokeLinecap: "round",
712
- strokeLinejoin: "round",
713
- strokeWidth: "12"
714
- }
715
- ),
716
- /* @__PURE__ */ React2.createElement(
717
- "line",
718
- {
719
- x1: "80",
720
- y1: "168",
721
- x2: "176",
722
- y2: "168",
723
- fill: "none",
724
- stroke: "currentColor",
725
- strokeLinecap: "round",
726
- strokeLinejoin: "round",
727
- strokeWidth: "12"
728
- }
729
- ),
730
- /* @__PURE__ */ React2.createElement(
731
- "line",
732
- {
733
- x1: "144",
734
- y1: "168",
735
- x2: "144",
736
- y2: "184",
737
- fill: "none",
738
- stroke: "currentColor",
739
- strokeLinecap: "round",
740
- strokeLinejoin: "round",
741
- strokeWidth: "12"
742
- }
743
- )
744
- );
745
- };
746
- var Newspaper = (props) => {
747
- return /* @__PURE__ */ React2.createElement(
748
- "svg",
749
- {
750
- xmlns: "http://www.w3.org/2000/svg",
751
- width: "192",
752
- height: "192",
753
- fill: "currentColor",
754
- viewBox: "0 0 256 256",
755
- ...props
756
- },
757
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
758
- /* @__PURE__ */ React2.createElement(
759
- "line",
760
- {
761
- x1: "96",
762
- y1: "112",
763
- x2: "176",
764
- y2: "112",
765
- fill: "none",
766
- stroke: "currentColor",
767
- strokeLinecap: "round",
768
- strokeLinejoin: "round",
769
- strokeWidth: "8"
770
- }
771
- ),
772
- /* @__PURE__ */ React2.createElement(
773
- "line",
774
- {
775
- x1: "96",
776
- y1: "144",
777
- x2: "176",
778
- y2: "144",
779
- fill: "none",
780
- stroke: "currentColor",
781
- strokeLinecap: "round",
782
- strokeLinejoin: "round",
783
- strokeWidth: "8"
784
- }
785
- ),
786
- /* @__PURE__ */ React2.createElement(
787
- "path",
788
- {
789
- d: "M32,200a16,16,0,0,0,16-16V64a8,8,0,0,1,8-8H216a8,8,0,0,1,8,8V184a16,16,0,0,1-16,16Z",
790
- fill: "none",
791
- stroke: "currentColor",
792
- strokeLinecap: "round",
793
- strokeLinejoin: "round",
794
- strokeWidth: "8"
795
- }
796
- ),
797
- /* @__PURE__ */ React2.createElement(
798
- "path",
799
- {
800
- d: "M32,200a16,16,0,0,1-16-16h0V88",
801
- fill: "none",
802
- stroke: "currentColor",
803
- strokeLinecap: "round",
804
- strokeLinejoin: "round",
805
- strokeWidth: "8"
806
- }
807
- )
808
- );
809
- };
810
- var Eye = (props) => {
811
- return /* @__PURE__ */ React2.createElement(
812
- "svg",
813
- {
814
- xmlns: "http://www.w3.org/2000/svg",
815
- width: "192",
816
- height: "192",
817
- fill: "currentColor",
818
- viewBox: "0 0 256 256",
819
- ...props
820
- },
821
- /* @__PURE__ */ React2.createElement("rect", { width: "256", height: "256", fill: "none" }),
822
- /* @__PURE__ */ React2.createElement(
823
- "path",
824
- {
825
- d: "M128,56C48,56,16,128,16,128s32,72,112,72,112-72,112-72S208,56,128,56Z",
826
- fill: "none",
827
- stroke: "currentColor",
828
- strokeLinecap: "round",
829
- strokeLinejoin: "round",
830
- strokeWidth: "12"
831
- }
832
- ),
833
- /* @__PURE__ */ React2.createElement(
834
- "circle",
835
- {
836
- cx: "128",
837
- cy: "128",
838
- r: "40",
839
- fill: "none",
840
- stroke: "currentColor",
841
- strokeLinecap: "round",
842
- strokeLinejoin: "round",
843
- strokeWidth: "12"
844
- }
845
- )
846
- );
847
- };
848
-
849
- // src/components/icons/index.tsx
850
- import clsx from "clsx";
851
- function Icon({ name, className, ...props }) {
852
- let WeaverseIcon = phosphor_exports[name];
853
- let cls = clsx("wv-icon", className);
854
- return /* @__PURE__ */ React3.createElement(WeaverseIcon, { className: cls, ...props });
855
- }
856
-
857
- // src/components/modal/styled.ts
858
- import { Content, Overlay, Title } from "@radix-ui/react-dialog";
859
- import { keyframes, styled } from "@stitches/react";
860
- var overlayShow = keyframes({
861
- "0%": { opacity: 0 },
862
- "100%": { opacity: 1 }
863
- });
864
- var contentShow = keyframes({
865
- "0%": { opacity: 0, transform: "translate(-50%, -48%) scale(.96)" },
866
- "100%": { opacity: 1, transform: "translate(-50%, -50%) scale(1)" }
867
- });
868
- var StyledOverlay = styled(Overlay, {
869
- display: "block !important",
870
- backgroundColor: "rgba(0, 0, 0, .3)",
871
- position: "fixed",
872
- zIndex: 99999,
873
- inset: 0,
874
- animation: `${overlayShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`
875
- });
876
- var StyledTitle = styled(Title, {
877
- margin: "0 0 24px",
878
- fontWeight: 500,
879
- fontSize: 24,
880
- "@media (max-width: 768px)": {
881
- margin: "0 0 16px",
882
- fontSize: 20
883
- }
884
- });
885
- var StyledContent = styled(Content, {
886
- backgroundColor: "white",
887
- borderRadius: 6,
888
- boxShadow: "hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px",
889
- position: "fixed",
890
- top: "50%",
891
- left: "50%",
892
- transform: "translate(-50%, -50%)",
893
- padding: 24,
894
- animation: `${contentShow} 300ms cubic-bezier(0.16, 1, 0.3, 1)`,
895
- zIndex: 99999,
896
- maxWidth: "90vw",
897
- width: "auto",
898
- "*": {
899
- maxWidth: "100%"
900
- },
901
- "&:focus": { outline: "none" },
902
- '&[data-size="fullscreen"]': {
903
- width: "100vw",
904
- height: "100vh",
905
- maxWidth: "100vw",
906
- borderRadius: 0
907
- },
908
- "@media (max-width: 768px)": {
909
- width: "90vw",
910
- padding: 12,
911
- '&[data-size="fullscreen"]': {
912
- width: "100vw"
913
- }
914
- }
915
- });
916
- var StyledCloseIcon = styled("button", {
917
- all: "unset",
918
- cursor: "pointer",
919
- fontFamily: "inherit",
920
- borderRadius: "100%",
921
- height: 32,
922
- width: 32,
923
- padding: 4,
924
- display: "inline-flex",
925
- alignItems: "center",
926
- justifyContent: "center",
927
- color: "rgb(55, 65, 81)",
928
- position: "absolute",
929
- top: 8,
930
- right: 8,
931
- "&:hover": {
932
- backgroundColor: "rgba(112, 112, 112, .1)"
933
- },
934
- svg: {
935
- width: 24,
936
- height: 24
937
- }
938
- });
939
-
940
- // src/components/modal/use-open-change-effect.ts
941
- import { useContext as useContext2, useEffect } from "react";
942
- function useOpenChangeEffect(props) {
943
- let { open, defaultOpen, onOpenChange } = props;
944
- let rootCtx = useContext2(WeaverseContext);
945
- let toggleRootzIndex = (open2) => {
946
- let { contentRootElement } = rootCtx;
947
- if (contentRootElement) {
948
- if (open2) {
949
- contentRootElement.classList.add("modal-open");
950
- } else {
951
- contentRootElement.classList.remove("modal-open");
952
- }
953
- }
954
- };
955
- useEffect(() => {
956
- let isOpen = open || defaultOpen;
957
- toggleRootzIndex(isOpen);
958
- }, [open, defaultOpen]);
959
- let handleOpenChange = (open2) => {
960
- toggleRootzIndex(open2);
961
- onOpenChange?.(open2);
962
- };
963
- return handleOpenChange;
964
- }
965
-
966
- // src/components/modal/index.tsx
967
- var Modal = (props) => {
968
- let { children, open, defaultOpen, onOpenChange, ...rest } = props;
969
- let handleOpenChange = useOpenChangeEffect(props);
970
- return /* @__PURE__ */ React4.createElement(
971
- Root,
972
- {
973
- open,
974
- defaultOpen,
975
- onOpenChange: handleOpenChange,
976
- ...rest
977
- },
978
- children
979
- );
980
- };
981
- var ModalTrigger = Trigger;
982
- var ModalHeader = forwardRef2(
983
- (props, ref) => {
984
- let { children, ...rest } = props;
985
- return /* @__PURE__ */ React4.createElement(StyledTitle, { ref, ...rest, "data-wv-modal-header": true }, children);
986
- }
987
- );
988
- var ModalContent = forwardRef2(
989
- (props, ref) => {
990
- let { children, size, portal, ...rest } = props;
991
- let modalContent = /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(StyledOverlay, null), /* @__PURE__ */ React4.createElement(
992
- StyledContent,
993
- {
994
- ...rest,
995
- onCloseAutoFocus: (e) => e.preventDefault(),
996
- "data-wv-modal": true,
997
- "data-size": size,
998
- ref
999
- },
1000
- /* @__PURE__ */ React4.createElement(ModalClose, null),
1001
- /* @__PURE__ */ React4.createElement("div", { className: "wv-modal-content" }, children)
1002
- ));
1003
- if (portal) {
1004
- return /* @__PURE__ */ React4.createElement(Portal, null, modalContent);
1005
- }
1006
- return modalContent;
1007
- }
1008
- );
1009
- ModalContent.defaultProps = {
1010
- size: "auto",
1011
- portal: false
1012
- };
1013
- var ModalClose = forwardRef2(
1014
- (props, ref) => {
1015
- let { asChild, children, ...rest } = props;
1016
- let closeIcon = /* @__PURE__ */ React4.createElement(StyledCloseIcon, null, /* @__PURE__ */ React4.createElement(Icon, { name: "X" }));
1017
- return /* @__PURE__ */ React4.createElement(Close, { asChild: true, ...rest, ref }, asChild ? children : closeIcon);
1018
- }
1019
- );
1020
-
1021
- // src/components/spinner.tsx
1022
- import React5 from "react";
1023
- function Spinner() {
1024
- return /* @__PURE__ */ React5.createElement("span", { className: "wv-spinner-wrapper" }, /* @__PURE__ */ React5.createElement(Icon, { name: "CircleNotch", className: "wv-spinner" }));
1025
- }
1026
-
1027
- // src/components/tooltip.tsx
1028
- import React6 from "react";
1029
- function Tooltip({ children }) {
1030
- return /* @__PURE__ */ React6.createElement("span", { className: "wv-tooltip" }, children);
1031
- }
1032
-
1033
- // src/components/slider/index.tsx
1034
- import clsx3 from "clsx";
1035
- import { useKeenSlider } from "keen-slider/react";
1036
- import React8, { useState } from "react";
1037
-
1038
- // src/components/slider/arrows.tsx
1039
- import { styled as styled2 } from "@stitches/react";
1040
- import clsx2 from "clsx";
1041
- import React7 from "react";
1042
- function Arrows(props) {
1043
- let { currentSlide, instanceRef, className, icon, offset } = props;
1044
- let isFirst = currentSlide === 0;
1045
- let isLast = false;
1046
- if (instanceRef.current) {
1047
- isLast = currentSlide === instanceRef?.current?.track?.details?.maxIdx;
1048
- }
1049
- let style = {
1050
- "--offset": `${offset}px`
1051
- };
1052
- return /* @__PURE__ */ React7.createElement(StyledArrows, { className, style }, /* @__PURE__ */ React7.createElement(
1053
- "button",
1054
- {
1055
- type: "button",
1056
- className: clsx2("arrow arrow--left", isFirst && "arrow--disabled"),
1057
- onClick: (e) => {
1058
- e.stopPropagation();
1059
- instanceRef?.current?.prev();
1060
- }
1061
- },
1062
- /* @__PURE__ */ React7.createElement(Icon, { name: icon === "caret" ? "CaretLeft" : "ArrowLeft" })
1063
- ), /* @__PURE__ */ React7.createElement(
1064
- "button",
1065
- {
1066
- type: "button",
1067
- className: clsx2("arrow arrow--right", isLast && "arrow--disabled"),
1068
- onClick: (e) => {
1069
- e.stopPropagation();
1070
- instanceRef?.current?.next();
1071
- }
1072
- },
1073
- /* @__PURE__ */ React7.createElement(Icon, { name: icon === "caret" ? "CaretRight" : "ArrowRight" })
1074
- ));
1075
- }
1076
- var StyledArrows = styled2("div", {
1077
- ".arrow": {
1078
- position: "absolute",
1079
- top: "50%",
1080
- transform: "translateY(-50%)",
1081
- width: "44px",
1082
- height: "44px",
1083
- padding: "8px",
1084
- color: "#191919",
1085
- backgroundColor: "#f2f2f2",
1086
- textAlign: "center",
1087
- transition: "all 0.2s ease-in-out",
1088
- borderRadius: "4px",
1089
- border: "none",
1090
- cursor: "pointer",
1091
- "&:hover": {
1092
- backgroundColor: "#191919",
1093
- color: "#f2f2f2"
1094
- },
1095
- svg: {
1096
- verticalAlign: "middle",
1097
- width: "22px",
1098
- height: "22px"
1099
- },
1100
- "&.arrow--left": {
1101
- left: "var(--offset, 0px)"
1102
- },
1103
- "&.arrow--right": {
1104
- right: "var(--offset, 0px)"
1105
- },
1106
- "&.arrow--disabled": {
1107
- opacity: 0.5
1108
- }
1109
- },
1110
- "@media (max-width: 768px)": {
1111
- ".arrow": {
1112
- display: "none"
1113
- }
1114
- }
1115
- });
1116
-
1117
- // src/components/slider/resize-plugin.ts
1118
- var ResizePlugin = (slider) => {
1119
- let observer = new ResizeObserver(() => slider.update());
1120
- slider.on("created", () => {
1121
- observer.observe(slider.container);
1122
- });
1123
- slider.on("destroyed", () => {
1124
- observer.unobserve(slider.container);
1125
- });
1126
- };
1127
-
1128
- // src/components/slider/index.tsx
1129
- function Slider(props) {
1130
- let { children, className, gap, slidesPerView, arrowOffset } = props;
1131
- let [currentSlide, setCurrentSlide] = useState(0);
1132
- let [created, setCreated] = useState(false);
1133
- let [ref, instanceRef] = useKeenSlider(
1134
- {
1135
- slides: { perView: slidesPerView, spacing: gap },
1136
- breakpoints: {
1137
- "(max-width: 1024px)": {
1138
- slides: { perView: 3, spacing: gap }
1139
- },
1140
- "(max-width: 768px)": {
1141
- slides: {
1142
- perView: 1,
1143
- spacing: 32
1144
- }
1145
- }
1146
- },
1147
- created: () => {
1148
- setCreated(true);
1149
- },
1150
- slideChanged: (slider) => {
1151
- setCurrentSlide(slider.track.details.rel);
1152
- }
1153
- },
1154
- [ResizePlugin]
1155
- );
1156
- let _className = clsx3("keen-slider", className);
1157
- let arrowsClass = clsx3(className && `${className}-arrows`);
1158
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("div", { ref, className: _className }, /* @__PURE__ */ React8.createElement(
1159
- "link",
1160
- {
1161
- rel: "stylesheet",
1162
- href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
1163
- }
1164
- ), children), created && instanceRef?.current && /* @__PURE__ */ React8.createElement(
1165
- Arrows,
1166
- {
1167
- currentSlide,
1168
- instanceRef,
1169
- className: arrowsClass,
1170
- offset: arrowOffset,
1171
- icon: "arrow"
1172
- }
1173
- ));
1174
- }
1175
-
1176
- // src/components/background.tsx
1177
- import React9 from "react";
1178
- function Background(props) {
1179
- let {
1180
- backgroundColor,
1181
- backgroundImage,
1182
- backgroundFit,
1183
- backgroundPosition,
1184
- className
1185
- } = props;
1186
- let style = {
1187
- display: "block",
1188
- position: "absolute",
1189
- inset: 0,
1190
- backgroundColor
1191
- };
1192
- if (backgroundImage || backgroundColor) {
1193
- return /* @__PURE__ */ React9.createElement("div", { style, className }, backgroundImage && /* @__PURE__ */ React9.createElement(
1194
- "img",
1195
- {
1196
- width: "100%",
1197
- height: "100%",
1198
- "data-blink-src": backgroundImage,
1199
- alt: "Background",
1200
- style: {
1201
- objectFit: backgroundFit,
1202
- objectPosition: backgroundPosition
1203
- }
1204
- }
1205
- ));
1206
- }
1207
- return null;
1208
- }
1209
-
1210
- // src/components/overlay.tsx
1211
- import React10 from "react";
1212
- function Overlay2(props) {
1213
- let { enableOverlay, overlayOpacity, className } = props;
1214
- if (enableOverlay) {
1215
- return /* @__PURE__ */ React10.createElement(
1216
- "div",
1217
- {
1218
- className,
1219
- style: {
1220
- position: "absolute",
1221
- inset: 0,
1222
- display: "block",
1223
- backgroundColor: `rgba(0, 0, 0, ${overlayOpacity / 100})`
1224
- }
1225
- }
1226
- );
1227
- }
1228
- return null;
1229
- }
1230
-
1231
- // src/components/slider/dots.tsx
1232
- import { styled as styled3 } from "@stitches/react";
1233
- import clsx4 from "clsx";
1234
- import React11 from "react";
1235
- function Dots(props) {
1236
- let { currentSlide, instanceRef, className, absolute, position, color } = props;
1237
- let _className = clsx4(
1238
- className,
1239
- absolute && "dots--absolute",
1240
- position && `dots--${position}`,
1241
- color && `dots--${color}`
1242
- );
1243
- return /* @__PURE__ */ React11.createElement(StyledDots, { className: _className }, [...Array(instanceRef.current?.track.details.slides.length).keys()].map(
1244
- (idx) => {
1245
- let className2 = clsx4("dot", currentSlide === idx && "dot--active");
1246
- return /* @__PURE__ */ React11.createElement(
1247
- "button",
1248
- {
1249
- key: idx,
1250
- type: "button",
1251
- onClick: () => instanceRef.current?.moveToIdx(idx),
1252
- className: className2
1253
- }
1254
- );
1255
- }
1256
- ));
1257
- }
1258
- var StyledDots = styled3("div", {
1259
- padding: "10px 0",
1260
- display: "flex",
1261
- justifyContent: "center",
1262
- alignItems: "center",
1263
- gap: "12px",
1264
- "&.dots--absolute": {
1265
- position: "absolute",
1266
- "&.dots--top, &.dots--bottom": { left: 0, right: 0 },
1267
- "&.dots--top": { top: 10 },
1268
- "&.dots--bottom": { bottom: 10 },
1269
- "&.dots--left, &.dots--right": {
1270
- top: 0,
1271
- bottom: 0,
1272
- flexDirection: "column"
1273
- },
1274
- "&.dots--left": { left: 20 },
1275
- "&.dots--right": { right: 20 }
1276
- },
1277
- "&.dots--light": {
1278
- ".dot": {
1279
- backgroundColor: "#ffffff66",
1280
- "&.dot--active": {
1281
- backgroundColor: "#ffffff"
1282
- }
1283
- }
1284
- },
1285
- "&.dots--dark": {
1286
- ".dot": {
1287
- backgroundColor: "#00000033",
1288
- "&.dot--active": {
1289
- backgroundColor: "#000000"
1290
- }
1291
- }
1292
- },
1293
- ".dot": {
1294
- width: "9px",
1295
- height: "9px",
1296
- padding: "0",
1297
- border: "none",
1298
- borderRadius: "50%",
1299
- transition: "all 0.2s ease-in-out"
1300
- }
1301
- });
1302
-
1303
- // src/components/slider/autoplay-plugin.ts
1304
- function AutoplayPlugin(changeSlidesEvery) {
1305
- return (slider) => {
1306
- let timeout;
1307
- let mouseOver = false;
1308
- function clearNextTimeout() {
1309
- clearTimeout(timeout);
1310
- }
1311
- function nextTimeout() {
1312
- clearTimeout(timeout);
1313
- if (mouseOver)
1314
- return;
1315
- timeout = setTimeout(() => {
1316
- slider.next();
1317
- }, changeSlidesEvery * 1e3);
1318
- }
1319
- slider.on("created", () => {
1320
- slider.container.addEventListener("mouseover", () => {
1321
- mouseOver = true;
1322
- clearNextTimeout();
1323
- });
1324
- slider.container.addEventListener("mouseout", () => {
1325
- mouseOver = false;
1326
- nextTimeout();
1327
- });
1328
- nextTimeout();
1329
- });
1330
- slider.on("dragStarted", clearNextTimeout);
1331
- slider.on("animationEnded", nextTimeout);
1332
- slider.on("updated", nextTimeout);
1333
- };
1334
- }
1335
-
1336
- // src/components/placeholder.tsx
1337
- import React12, { forwardRef as forwardRef3 } from "react";
1338
- var Placeholder = forwardRef3(
1339
- (props, ref) => {
1340
- let { element, className, children, ...rest } = props;
1341
- return /* @__PURE__ */ React12.createElement("div", { "data-wv-placeholder": true, ref, className, ...rest }, /* @__PURE__ */ React12.createElement(
1342
- "div",
1343
- {
1344
- style: { fontWeight: 600, margin: "10px 0 5px", padding: "0 10px" }
1345
- },
1346
- element
1347
- ), /* @__PURE__ */ React12.createElement(
1348
- "div",
1349
- {
1350
- style: {
1351
- margin: "5px 0 10px",
1352
- textAlign: "center",
1353
- padding: "0 10px"
1354
- }
1355
- },
1356
- children
1357
- ));
1358
- }
1359
- );
1360
- var placeholder_default = Placeholder;
1361
-
1362
- // src/components/no-hydrate.tsx
1363
- import React13, { useState as useState2 } from "react";
1364
- function NoHydrate({ id, getHTML, ...rest }) {
1365
- let [html] = useState2(() => {
1366
- if (typeof document === "undefined") {
1367
- return getHTML?.() ?? "";
1368
- }
1369
- let el = document.getElementById(id);
1370
- if (!el)
1371
- return getHTML?.() ?? "";
1372
- return el.innerHTML;
1373
- });
1374
- return /* @__PURE__ */ React13.createElement("div", { ...rest, id, dangerouslySetInnerHTML: { __html: html } });
1375
- }
1376
-
1377
- // src/components/index.ts
1378
- var Components = {
1379
- Background,
1380
- Icon,
1381
- ModalComponents: modal_exports,
1382
- Overlay: Overlay2,
1383
- Placeholder: placeholder_default,
1384
- Spinner,
1385
- Slider,
1386
- Tooltip,
1387
- NoHydrate
1388
- };
1389
- var SliderComponents = {
1390
- Arrows,
1391
- Dots,
1392
- ResizePlugin,
1393
- AutoplayPlugin
1394
- };
1395
-
1396
- // src/elements/container.tsx
1397
- var Container = forwardRef4(
1398
- (props, ref) => {
1399
- let { children, ...rest } = props;
1400
- return /* @__PURE__ */ React14.createElement("div", { ref, ...rest }, Children.count(children) ? children : /* @__PURE__ */ React14.createElement(Components.Placeholder, { element: "Container" }, "Drop element here"));
1401
- }
1402
- );
1403
- var css2 = {
1404
- "@desktop": {
1405
- display: "flex",
1406
- alignItems: "flex-start",
1407
- justifyContent: "flex-start",
1408
- gridArea: "1 / 1 / 3 / 6",
1409
- overflow: "hidden",
1410
- // minWidth: '300px',
1411
- minHeight: "100px"
1412
- },
1413
- "@mobile": {
1414
- minHeight: "100px"
1415
- }
1416
- };
1417
- Container.defaultProps = {};
1418
- var container_default = Container;
1419
-
1420
- // src/elements/countdown/index.tsx
1421
- import React16, { forwardRef as forwardRef5, useContext as useContext3, useEffect as useEffect2 } from "react";
1422
-
1423
- // src/constant/index.ts
1424
- var TIMES = ["days", "hours", "minutes", "seconds"];
1425
- var COUNTDOWN_KEY = "wv-cd-evergreen-start";
1426
- var INSTAGRAM_API = "https://graph.instagram.com";
1427
-
1428
- // src/utils/index.ts
1429
- function getTime(_seconds) {
1430
- let ONE_MINUTE = 60 * 1e3;
1431
- let ONE_HOUR = 60 * ONE_MINUTE;
1432
- let ONE_DAY = 24 * ONE_HOUR;
1433
- let days = Math.floor(_seconds / ONE_DAY);
1434
- let hours = Math.floor((_seconds - days * ONE_DAY) / ONE_HOUR);
1435
- let minutes = Math.floor(
1436
- (_seconds - days * ONE_DAY - hours * ONE_HOUR) / ONE_MINUTE
1437
- );
1438
- let seconds = Math.floor(
1439
- (_seconds - days * ONE_DAY - hours * ONE_HOUR - minutes * ONE_MINUTE) / 1e3
1440
- );
1441
- return { days, hours, minutes, seconds };
1442
- }
1443
- function getYoutubeEmbedId(url) {
1444
- const match = url.match(
1445
- /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/
1446
- );
1447
- return match ? match[1] : null;
1448
- }
1449
- function getVimeoId(url) {
1450
- const match = url.match(/(?:https?:\/\/)?(?:www\.)?vimeo\.com\/(.+)/);
1451
- return match ? match[1] : null;
1452
- }
1453
-
1454
- // src/elements/countdown/timer-block.tsx
1455
- import React15 from "react";
1456
- function TimerBlock({ value, label }) {
1457
- return /* @__PURE__ */ React15.createElement("div", { className: "wv-cd-block" }, /* @__PURE__ */ React15.createElement("div", { className: "wv-cd-number" }, typeof value === "string" ? value : value.toString().padStart(2, "0")), label && /* @__PURE__ */ React15.createElement("div", { className: "wv-cd-label" }, label));
1458
- }
1459
-
1460
- // src/elements/countdown/index.tsx
1461
- var Countdown = forwardRef5(
1462
- (props, ref) => {
1463
- const { isDesignMode } = useContext3(WeaverseContext);
1464
- let {
1465
- timerType,
1466
- startTime: startTimeProp,
1467
- endTime: endTimeProp,
1468
- periods: periodsProp,
1469
- redirectWhenTimerStops,
1470
- redirectUrl,
1471
- openInNewTab,
1472
- showColon,
1473
- showLabel,
1474
- ...rest
1475
- } = props;
1476
- const [remaining, setRemaining] = React16.useState(0);
1477
- let periods = periodsProp * 60 * 1e3;
1478
- const handleEnd = () => {
1479
- if (!isDesignMode && redirectWhenTimerStops && redirectUrl)
1480
- window.open(redirectUrl, openInNewTab ? "_blank" : "_self");
1481
- };
1482
- const getStartTime = () => {
1483
- let startTime = startTimeProp;
1484
- if (timerType === "evergreen") {
1485
- const start = localStorage.getItem(COUNTDOWN_KEY);
1486
- if (start) {
1487
- startTime = Number.parseInt(start);
1488
- if (startTime + periods < Date.now()) {
1489
- startTime = Date.now();
1490
- localStorage.setItem(COUNTDOWN_KEY, startTime.toString());
1491
- }
1492
- } else {
1493
- startTime = Date.now();
1494
- localStorage.setItem(COUNTDOWN_KEY, startTime.toString());
1495
- }
1496
- }
1497
- return startTime;
1498
- };
1499
- const checkActive = (startTime) => startTime < Date.now() && endTimeProp > Date.now();
1500
- const handleRemaining = () => {
1501
- let startTime = getStartTime();
1502
- let endTime = timerType === "fixed-time" ? endTimeProp : startTime + periods;
1503
- let isActive = checkActive(startTime);
1504
- const remainingTime = isActive ? Math.max(endTime - Date.now(), 0) : 0;
1505
- if (remainingTime > 0 && remainingTime < 1e3) {
1506
- handleEnd();
1507
- }
1508
- setRemaining(remainingTime);
1509
- };
1510
- useEffect2(() => {
1511
- let intervalFlag = setInterval(
1512
- handleRemaining,
1513
- 1e3
1514
- );
1515
- return () => {
1516
- clearInterval(intervalFlag);
1517
- };
1518
- }, [startTimeProp, endTimeProp, periods, timerType]);
1519
- const timer = getTime(remaining);
1520
- return /* @__PURE__ */ React16.createElement("div", { ref, ...rest }, TIMES.map((time) => {
1521
- return /* @__PURE__ */ React16.createElement(React16.Fragment, { key: time }, /* @__PURE__ */ React16.createElement(
1522
- TimerBlock,
1523
- {
1524
- label: showLabel ? time : "",
1525
- value: remaining === 0 ? "--" : timer[time]
1526
- }
1527
- ), time !== "seconds" && /* @__PURE__ */ React16.createElement("div", { className: "wv-cd-separator" }, showColon && /* @__PURE__ */ React16.createElement("span", null, ":")));
1528
- }));
1529
- }
1530
- );
1531
- var css3 = {
1532
- "@desktop": {
1533
- fontSize: "36px",
1534
- fontWeight: 500,
1535
- display: "flex",
1536
- alignItems: "center",
1537
- overflow: "hidden",
1538
- justifyContent: "center",
1539
- gap: 10,
1540
- lineHeight: "initial",
1541
- ".wv-cd-block": {
1542
- textAlign: "center",
1543
- ".wv-cd-label": {
1544
- fontSize: 10
1545
- }
1546
- },
1547
- ".wv-cd-separator": {
1548
- span: {
1549
- lineHeight: "100%"
1550
- },
1551
- ".hidden": {
1552
- visibility: "hidden"
1553
- }
1554
- }
1555
- }
1556
- };
1557
- Countdown.defaultProps = {
1558
- timerType: "fixed-time",
1559
- startTime: Date.now(),
1560
- endTime: Date.now() + 1e3 * 60 * 60 * 24,
1561
- periods: 90,
1562
- redirectWhenTimerStops: false,
1563
- redirectUrl: "",
1564
- openInNewTab: false,
1565
- showLabel: true,
1566
- showColon: true
1567
- };
1568
- var countdown_default = Countdown;
1569
-
1570
- // src/elements/image.tsx
1571
- import React17 from "react";
1572
- var Image2 = React17.forwardRef(
1573
- (props, ref) => {
1574
- let {
1575
- src,
1576
- alt,
1577
- objectFit,
1578
- objectPosition,
1579
- clickAction,
1580
- openLinkInNewTab,
1581
- linkTo,
1582
- ...rest
1583
- } = props;
1584
- let style = {
1585
- "--img-object-fit": objectFit,
1586
- "--img-object-position": objectPosition
1587
- };
1588
- let content = /* @__PURE__ */ React17.createElement("img", { alt, "data-blink-src": src });
1589
- if (clickAction === "openLink" && linkTo) {
1590
- content = /* @__PURE__ */ React17.createElement(
1591
- "a",
1592
- {
1593
- href: linkTo,
1594
- target: openLinkInNewTab ? "_blank" : "_self",
1595
- rel: "noreferrer"
1596
- },
1597
- /* @__PURE__ */ React17.createElement("img", { alt, "data-blink-src": src })
1598
- );
1599
- }
1600
- return /* @__PURE__ */ React17.createElement("div", { ref, style, ...rest }, content);
1601
- }
1602
- );
1603
- var css4 = {
1604
- "@desktop": {
1605
- display: "flex",
1606
- overflow: "hidden",
1607
- justifyContent: "center",
1608
- alignItems: "center",
1609
- img: {
1610
- width: "100%",
1611
- height: "100%",
1612
- objectFit: "var(--img-object-fit, cover)",
1613
- objectPosition: "var(--img-object-position, center)"
1614
- }
1615
- }
1616
- };
1617
- Image2.defaultProps = {
1618
- src: "https://ucarecdn.com/dac0f414-2b1f-46df-99ce-41554f0f653a/",
1619
- alt: "Alternative information",
1620
- objectFit: "cover",
1621
- objectPosition: "center center",
1622
- clickAction: "none",
1623
- openLinkInNewTab: false,
1624
- linkTo: ""
1625
- };
1626
- var image_default = Image2;
1627
-
1628
- // src/elements/layout.tsx
1629
- import React18, { forwardRef as forwardRef6 } from "react";
1630
- var Layout = forwardRef6((props, ref) => {
1631
- let {
1632
- children,
1633
- rows,
1634
- gap,
1635
- rowSize,
1636
- columns,
1637
- contentSize,
1638
- gridSize,
1639
- backgroundColor,
1640
- backgroundImage,
1641
- objectFit,
1642
- objectPosition,
1643
- enableOverlay,
1644
- overlayOpacity,
1645
- ...rest
1646
- } = props;
1647
- let style = {
1648
- "--layout-content-width": "100vw",
1649
- "--content-size": contentSize + "px",
1650
- "--grid-size": gridSize + "px",
1651
- "--rows": rows,
1652
- "--columns": columns,
1653
- "--gap": gap + "px",
1654
- "--row-size": rowSize + "px",
1655
- "--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))"
1656
- };
1657
- return /* @__PURE__ */ React18.createElement("div", { ref, ...rest, style }, /* @__PURE__ */ React18.createElement(
1658
- Background,
1659
- {
1660
- backgroundImage,
1661
- backgroundColor,
1662
- backgroundFit: objectFit,
1663
- backgroundPosition: objectPosition
1664
- }
1665
- ), /* @__PURE__ */ React18.createElement(Overlay2, { enableOverlay, overlayOpacity }), /* @__PURE__ */ React18.createElement("div", { "data-layout-content": true }, children));
1666
- });
1667
- var css5 = {
1668
- "@desktop": {
1669
- position: "relative",
1670
- "> [data-layout-content]": {
1671
- // paddingTop: 'var(--gap)',
1672
- // paddingBottom: 'var(--gap)',
1673
- margin: "0 auto",
1674
- display: "grid",
1675
- gridTemplateRows: "repeat(var(--rows), var(--row-size))",
1676
- gridTemplateColumns: "calc((var(--layout-content-width) - var(--content-size)) / 2) 1fr repeat(var(--columns), minmax(0, var(--col-size))) 1fr calc((var(--layout-content-width) - var(--content-size)) / 2)",
1677
- gridAutoRows: "var(--row-size)",
1678
- gap: "var(--gap)",
1679
- maxWidth: "var(--layout-content-width)"
1680
- }
1681
- },
1682
- "@mobile": {
1683
- padding: "0 16px",
1684
- "> [data-layout-content]": {
1685
- display: "flex",
1686
- flexDirection: "column"
1687
- }
1688
- }
1689
- };
1690
- Layout.defaultProps = {
1691
- contentSize: 1600,
1692
- gridSize: 1224,
1693
- rows: 16,
1694
- columns: 12,
1695
- gap: 16,
1696
- rowSize: 48,
1697
- objectFit: "cover",
1698
- objectPosition: "center center",
1699
- enableOverlay: false,
1700
- overlayOpacity: 30
1701
- };
1702
- var layout_default = Layout;
1703
-
1704
- // src/elements/map.tsx
1705
- import React19, { forwardRef as forwardRef7 } from "react";
1706
- var Map = forwardRef7((props, ref) => {
1707
- let { place, zoom, ...rest } = props;
1708
- return /* @__PURE__ */ React19.createElement("div", { ref, ...rest }, /* @__PURE__ */ React19.createElement(
1709
- "iframe",
1710
- {
1711
- loading: "lazy",
1712
- width: "100%",
1713
- height: "100%",
1714
- title: "map",
1715
- src: `https://maps.google.com/maps?z=${zoom}&t=m&q=${place}&ie=UTF8&&output=embed`,
1716
- style: { pointerEvents: "none" }
1717
- }
1718
- ));
1719
- });
1720
- var css6 = {
1721
- "@desktop": {
1722
- iframe: {
1723
- border: "none"
1724
- }
1725
- },
1726
- "@mobile": {
1727
- iframe: {
1728
- border: "none"
1729
- }
1730
- }
1731
- };
1732
- Map.defaultProps = {
1733
- place: "Hanoi",
1734
- zoom: 14
1735
- };
1736
- var map_default = Map;
1737
-
1738
- // src/elements/text.tsx
1739
- import * as React20 from "react";
1740
- var Text = React20.forwardRef(
1741
- (props, ref) => {
1742
- let { children, value, ...rest } = props;
1743
- return /* @__PURE__ */ React20.createElement("div", { ref, ...rest }, /* @__PURE__ */ React20.createElement(
1744
- "div",
1745
- {
1746
- className: "wv-text-content",
1747
- dangerouslySetInnerHTML: { __html: value }
1748
- }
1749
- ));
1750
- }
1751
- );
1752
- var css7 = {
1753
- "@desktop": {
1754
- display: "flex",
1755
- padding: "10px",
1756
- overflow: "hidden",
1757
- ".wv-text-content": {
1758
- width: "100%",
1759
- height: "fit-content",
1760
- "> p, > h1, > h2, > h3, > h4, > h5, > h6": {
1761
- all: "inherit",
1762
- margin: "0",
1763
- wordBreak: "break-word",
1764
- overflowWrap: "break-word",
1765
- width: "auto",
1766
- height: "auto"
1767
- }
1768
- }
1769
- }
1770
- };
1771
- Text.defaultProps = {
1772
- value: "<p>The quick brown fox jumps over the lazy dog</p>"
1773
- };
1774
- var text_default = Text;
1775
-
1776
- // src/elements/scrolling-text.tsx
1777
- import React21 from "react";
1778
- import { useState as useState3 } from "react";
1779
- var ScrollingText = React21.forwardRef((props, ref) => {
1780
- let { children, value, gap, speed, pauseOnHover, ...rest } = props;
1781
- let [playState, setPlayState] = useState3("running");
1782
- let style = {
1783
- "--gap": `${gap}px`,
1784
- "--speed": `${speed}s`,
1785
- "--play-state": playState
1786
- };
1787
- let events = {};
1788
- if (pauseOnHover) {
1789
- events = {
1790
- onMouseEnter: () => setPlayState("paused"),
1791
- onMouseLeave: () => setPlayState("running")
1792
- };
1793
- }
1794
- return /* @__PURE__ */ React21.createElement("div", { ref, ...rest }, /* @__PURE__ */ React21.createElement("div", { className: "wv-scrolling-text__container", style, ...events }, Array.from({ length: 30 }).map((_, i) => /* @__PURE__ */ React21.createElement(
1795
- "div",
1796
- {
1797
- key: i,
1798
- className: "wv-text-content",
1799
- dangerouslySetInnerHTML: { __html: value }
1800
- }
1801
- ))));
1802
- });
1803
- var css8 = {
1804
- "@desktop": {
1805
- display: "flex",
1806
- padding: "10px",
1807
- overflow: "hidden",
1808
- ".wv-scrolling-text__container": {
1809
- visibility: "visible",
1810
- whiteSpace: "nowrap",
1811
- display: "flex",
1812
- gap: "var(--gap, 40px)",
1813
- animation: "wv-scrolling-text var(--speed, 100s) linear infinite",
1814
- animationPlayState: "var(--play-state, running)",
1815
- ".wv-text-content": {
1816
- width: "100%",
1817
- height: "fit-content",
1818
- "> p, > h1, > h2, > h3, > h4, > h5, > h6": {
1819
- all: "inherit",
1820
- margin: "0",
1821
- wordBreak: "break-word",
1822
- overflowWrap: "break-word",
1823
- width: "auto",
1824
- height: "auto"
1825
- }
1826
- }
1827
- }
1828
- }
1829
- };
1830
- ScrollingText.defaultProps = {
1831
- value: "<p>The quick brown fox jumps over the lazy dog</p>",
1832
- gap: 40,
1833
- speed: 200,
1834
- pauseOnHover: true
1835
- };
1836
- var scrolling_text_default = ScrollingText;
1837
-
1838
- // src/elements/video/index.tsx
1839
- import React25, { forwardRef as forwardRef9, useContext as useContext4 } from "react";
1840
-
1841
- // src/elements/video/html-video.tsx
1842
- import React22 from "react";
1843
- function HTMLVideo(props) {
1844
- let { src, type, controls, autoPlay, loop, muted } = props;
1845
- return /* @__PURE__ */ React22.createElement(
1846
- "video",
1847
- {
1848
- controls,
1849
- autoPlay,
1850
- loop,
1851
- muted,
1852
- controlsList: "nodownload",
1853
- disablePictureInPicture: true
1854
- },
1855
- /* @__PURE__ */ React22.createElement("source", { src, type: type || "video/mp4" }),
1856
- /* @__PURE__ */ React22.createElement("source", { src, type: "video/ogg" }),
1857
- "Your browser does not support the video tag."
1858
- );
1859
- }
1860
-
1861
- // src/elements/video/vimeo.tsx
1862
- import React23 from "react";
1863
- function Vimeo(props) {
1864
- let { vimeoId, controls, autoPlay, loop, muted } = props;
1865
- let params = `autoplay=${autoPlay}&loop=${loop}&controls=${controls}&muted=${muted}`;
1866
- let vimeoSrc = `https://player.vimeo.com/video/${vimeoId}?${params}`;
1867
- return /* @__PURE__ */ React23.createElement("iframe", { src: vimeoSrc, width: "100%", height: "100%", allowFullScreen: true });
1868
- }
1869
-
1870
- // src/elements/video/youtube.tsx
1871
- import React24 from "react";
1872
- function Youtube(props) {
1873
- let { youtubeId, controls, autoPlay, loop, muted } = props;
1874
- let params = new URLSearchParams({
1875
- autoplay: autoPlay ? "1" : "0",
1876
- controls: controls ? "1" : "0",
1877
- loop: loop ? "1" : "0",
1878
- mute: muted ? "1" : "0"
1879
- });
1880
- let youtubeSrc = `https://www.youtube.com/embed/${youtubeId}?playlist=${youtubeId}&${params.toString()}`;
1881
- let allow = `accelerometer;${autoPlay ? "autoplay;" : ""} clipboard-write; encrypted-media; gyroscope; picture-in-picture`;
1882
- return /* @__PURE__ */ React24.createElement("iframe", { src: youtubeSrc, width: "100%", height: "100%", allow });
1883
- }
1884
-
1885
- // src/elements/video/index.tsx
1886
- var Video = forwardRef9((props, ref) => {
1887
- let { isDesignMode } = useContext4(WeaverseContext);
1888
- let {
1889
- src,
1890
- controls,
1891
- poster,
1892
- autoPlay: originAutoPlay,
1893
- loop,
1894
- muted,
1895
- ...rest
1896
- } = props;
1897
- let autoPlay = !isDesignMode && originAutoPlay;
1898
- let videoProps = { src, controls, poster, autoPlay, loop, muted };
1899
- let content;
1900
- let youtubeId = getYoutubeEmbedId(src);
1901
- let vimeoId = getVimeoId(src);
1902
- if (youtubeId) {
1903
- content = /* @__PURE__ */ React25.createElement(Youtube, { ...videoProps, youtubeId });
1904
- } else if (vimeoId) {
1905
- content = /* @__PURE__ */ React25.createElement(Vimeo, { ...videoProps, vimeoId });
1906
- } else {
1907
- content = /* @__PURE__ */ React25.createElement(HTMLVideo, { ...videoProps });
1908
- }
1909
- return /* @__PURE__ */ React25.createElement("div", { ref, ...rest }, content);
1910
- });
1911
- var css9 = {
1912
- "@desktop": {
1913
- video: {
1914
- height: "100%",
1915
- width: "100%",
1916
- aspectRatio: "16 / 9"
1917
- },
1918
- iframe: {
1919
- border: "none"
1920
- }
1921
- },
1922
- "@mobile": {
1923
- iframe: {
1924
- border: "none"
1925
- }
1926
- }
1927
- };
1928
- Video.defaultProps = {
1929
- src: "https://youtu.be/wM-NT6hcw48",
1930
- poster: "https://ucarecdn.com/c413b8fe-ceec-4948-9c42-a0434c4ca920/-/preview/-/quality/smart/-/format/auto/",
1931
- loop: false,
1932
- controls: false,
1933
- autoPlay: true,
1934
- muted: true
1935
- };
1936
- var video_default = Video;
1937
-
1938
- // src/elements/instagram.tsx
1939
- import React26, { forwardRef as forwardRef10, useEffect as useEffect3, useState as useState4 } from "react";
1940
- var Instagram = forwardRef10(
1941
- (props, ref) => {
1942
- let { token, username, numberOfImages, imagesPerRow, gap, ...rest } = props;
1943
- let [media, setMedia] = useState4([]);
1944
- let [error, setError] = useState4(null);
1945
- useEffect3(() => {
1946
- if (token) {
1947
- let params = new URLSearchParams({
1948
- access_token: token,
1949
- fields: "id,media_type,caption,media_url,permalink,thumbnail_url"
1950
- });
1951
- fetch(`${INSTAGRAM_API}/me/media?${params.toString()}`).then((res) => res.json()).then((res) => {
1952
- if (res.error) {
1953
- setError(res);
1954
- } else {
1955
- setError(null);
1956
- setMedia([...res.data]);
1957
- }
1958
- }).catch(setError);
1959
- }
1960
- }, [token]);
1961
- if (!token || error) {
1962
- 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!"));
1963
- }
1964
- let style = {
1965
- "--wv-ig-images-per-row": imagesPerRow,
1966
- "--wv-ig-images-gap": gap + "px"
1967
- };
1968
- return /* @__PURE__ */ React26.createElement("div", { ref, ...rest, style }, /* @__PURE__ */ React26.createElement("div", { className: "wv-ig-media-container" }, media.slice(0, numberOfImages).map((item) => {
1969
- let {
1970
- id,
1971
- permalink,
1972
- caption,
1973
- media_url,
1974
- media_type,
1975
- thumbnail_url
1976
- } = item;
1977
- if (media_type === "VIDEO") {
1978
- return /* @__PURE__ */ React26.createElement("video", { key: id, controls: true, poster: thumbnail_url }, /* @__PURE__ */ React26.createElement("source", { src: media_url, type: "video/mp4" }));
1979
- }
1980
- return /* @__PURE__ */ React26.createElement("a", { key: id, href: permalink, target: "_blank", rel: "noreferrer" }, /* @__PURE__ */ React26.createElement("img", { alt: caption, src: media_url }));
1981
- })));
1982
- }
1983
- );
1984
- var css10 = {
1985
- // '@desktop': {
1986
- // '.wv-ig-media-container': {
1987
- // overflow: 'hidden',
1988
- // maxWidth: '100%',
1989
- // maxHeight: '100%',
1990
- // display: 'grid',
1991
- // gridTemplateColumns: 'repeat(var(--wv-ig-images-per-row, 4), 1fr)',
1992
- // gap: 'var(--wv-ig-images-gap, 0px)',
1993
- // img: {
1994
- // // aspectRatio: '1 / 1',
1995
- // maxWidth: '100%',
1996
- // maxHeight: '100%',
1997
- // objectFit: 'cover',
1998
- // },
1999
- // },
2000
- // },
2001
- };
2002
- var permanentCss = {
2003
- "@desktop": {
2004
- ".wv-ig-media-container": {
2005
- overflow: "hidden",
2006
- maxWidth: "100%",
2007
- maxHeight: "100%",
2008
- display: "grid",
2009
- gridTemplateColumns: "repeat(var(--wv-ig-images-per-row, 4), 1fr)",
2010
- gap: "var(--wv-ig-images-gap, 0px)",
2011
- img: {
2012
- // aspectRatio: '1 / 1',
2013
- maxWidth: "100%",
2014
- maxHeight: "100%",
2015
- objectFit: "cover"
2016
- },
2017
- video: {
2018
- width: "100%",
2019
- height: "100%"
2020
- }
2021
- }
2022
- },
2023
- "@mobile": {
2024
- ".wv-ig-media-container": {
2025
- overflowX: "auto",
2026
- display: "flex",
2027
- scrollSnapType: "x mandatory"
2028
- },
2029
- ".wv-ig-media-container a": {
2030
- scrollSnapAlign: "start",
2031
- flexGrow: 0,
2032
- flexShrink: 0,
2033
- flexBasis: "100%"
2034
- }
2035
- }
2036
- };
2037
- Instagram.defaultProps = {
2038
- token: "",
2039
- username: "",
2040
- numberOfImages: 8,
2041
- imagesPerRow: 4,
2042
- gap: 0
2043
- };
2044
- var instagram_default = Instagram;
2045
-
2046
- // src/elements/slideshow/index.tsx
2047
- import { css as stitchesCss } from "@stitches/react";
2048
- import clsx6 from "clsx";
2049
- import React28, { forwardRef as forwardRef11 } from "react";
2050
-
2051
- // src/elements/slideshow/use-slideshow-configs.ts
2052
- import { useKeenSlider as useKeenSlider2 } from "keen-slider/react";
2053
- import React27, { useContext as useContext5, useEffect as useEffect4, useState as useState5 } from "react";
10
+ // src/renderer.tsx
11
+ import { isBrowser } from "@weaverse/core";
12
+ import React, { memo, useContext, useEffect, useRef, useState } from "react";
13
+
14
+ // ../../node_modules/clsx/dist/clsx.m.js
15
+ function r(e) {
16
+ var t, f, n = "";
17
+ if ("string" == typeof e || "number" == typeof e)
18
+ n += e;
19
+ else if ("object" == typeof e)
20
+ if (Array.isArray(e))
21
+ for (t = 0; t < e.length; t++)
22
+ e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
23
+ else
24
+ for (t in e)
25
+ e[t] && (n && (n += " "), n += t);
26
+ return n;
27
+ }
28
+ function clsx() {
29
+ for (var e, t, f = 0, n = ""; f < arguments.length; )
30
+ (e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
31
+ return n;
32
+ }
33
+ var clsx_m_default = clsx;
2054
34
 
2055
35
  // src/utils/css.ts
2056
- import clsx5 from "clsx";
2057
- function formatCSS(css13) {
36
+ function formatCSS(css) {
2058
37
  return {
2059
- "@desktop": css13["@desktop"],
2060
- "@mobile": css13["@mobile"]
38
+ "@desktop": css["@desktop"],
39
+ "@mobile": css["@mobile"]
2061
40
  };
2062
41
  }
2063
42
  var permanentClasses = {};
2064
43
  function generateItemClassName(instance, stitchesInstance) {
2065
- let { css: css13, type, className: cls = "", tailwindClasses } = instance.data;
44
+ let { css, type, className: cls = "" } = instance.data;
2066
45
  let className = "";
2067
46
  let permanentClass = "";
2068
47
  let perCss = instance.Element?.permanentCss;
@@ -2076,459 +55,25 @@ function generateItemClassName(instance, stitchesInstance) {
2076
55
  }
2077
56
  }
2078
57
  className = permanentClass;
2079
- if (css13) {
2080
- let formattedCss = formatCSS(css13);
58
+ if (css) {
59
+ let formattedCss = formatCSS(css);
2081
60
  let newStitchesClass = stitchesInstance.css(formattedCss)().className || "";
2082
61
  let { stitchesClass } = instance;
2083
62
  let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
2084
- className = clsx5(
2085
- permanentClass,
2086
- cls,
2087
- tailwindClasses,
2088
- newStitchesClass,
2089
- otherClass
2090
- );
63
+ className = clsx_m_default(permanentClass, cls, newStitchesClass, otherClass);
2091
64
  instance.stitchesClass = newStitchesClass;
2092
65
  }
2093
66
  return className;
2094
67
  }
2095
- function loadCSS(attrs) {
2096
- return new Promise((resolve, reject) => {
2097
- let found = document.querySelector(`link[href="${attrs.href}"]`);
2098
- if (found) {
2099
- return resolve(true);
2100
- }
2101
- let link = document.createElement("link");
2102
- Object.assign(link, attrs);
2103
- link.addEventListener("load", () => resolve(true));
2104
- link.onerror = reject;
2105
- document.head.appendChild(link);
2106
- });
2107
- }
2108
-
2109
- // src/elements/slideshow/use-slideshow-configs.ts
2110
- function useSlideshowConfigs(props) {
2111
- let {
2112
- animation,
2113
- slidesPerView,
2114
- loop,
2115
- autoRotate,
2116
- changeSlidesEvery,
2117
- children
2118
- } = props;
2119
- let { isDesignMode, isPreviewMode } = useContext5(WeaverseContext);
2120
- let [opacities, setOpacities] = React27.useState([]);
2121
- let [cssLoaded, setCssLoaded] = useState5(false);
2122
- let [created, setCreated] = useState5(false);
2123
- let [ready, setReady] = useState5(false);
2124
- let [currentSlide, setCurrentSlide] = useState5(0);
2125
- let sliderPlugins = [ResizePlugin];
2126
- if (autoRotate && (isPreviewMode || !isDesignMode)) {
2127
- sliderPlugins.push(AutoplayPlugin(changeSlidesEvery));
2128
- }
2129
- let [sliderRef, instanceRef] = useKeenSlider2(
2130
- {
2131
- slides: animation === "fade" ? React27.Children.count(children) : { perView: slidesPerView, number: React27.Children.count(children) },
2132
- drag: isPreviewMode || !isDesignMode,
2133
- loop,
2134
- selector: animation === "fade" ? null : ".keen-slider__slide",
2135
- created: (slider) => {
2136
- setCreated(true);
2137
- if (isDesignMode) {
2138
- let slideshowElement = slider.container.closest(
2139
- '[data-wv-type="slideshow"]'
2140
- );
2141
- let elementId = slideshowElement?.getAttribute("data-wv-id");
2142
- if (elementId) {
2143
- window.weaverseSlideshowInstances = {
2144
- [elementId]: slider
2145
- };
2146
- }
2147
- }
2148
- },
2149
- slideChanged: (slider) => {
2150
- setCurrentSlide(slider.track.details.rel);
2151
- },
2152
- detailsChanged: (slider) => {
2153
- let newOpacities = slider.track?.details?.slides?.map(
2154
- (slide) => slide.portion
2155
- );
2156
- setOpacities(newOpacities);
2157
- }
2158
- },
2159
- sliderPlugins
2160
- );
2161
- useEffect4(() => {
2162
- loadCSS({
2163
- rel: "stylesheet",
2164
- href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
2165
- }).then(() => setCssLoaded(true));
2166
- }, []);
2167
- useEffect4(() => {
2168
- if (created && cssLoaded) {
2169
- setReady(true);
2170
- }
2171
- }, [created, cssLoaded]);
2172
- return {
2173
- sliderRef,
2174
- instanceRef,
2175
- currentSlide,
2176
- opacities,
2177
- ready,
2178
- created
2179
- };
2180
- }
2181
-
2182
- // src/elements/slideshow/index.tsx
2183
- var Slideshow = forwardRef11((props, ref) => {
2184
- let {
2185
- animation,
2186
- showArrows,
2187
- showArrowsOnHover,
2188
- arrowIcon,
2189
- arrowsColor,
2190
- showDots,
2191
- dotsPosition,
2192
- dotsColor,
2193
- children,
2194
- ...rest
2195
- } = props;
2196
- let { sliderRef, instanceRef, currentSlide, opacities, ready, created } = useSlideshowConfigs(props);
2197
- let style = {
2198
- "--slider-opacity": ready ? 1 : 0
2199
- };
2200
- let faderClass = "";
2201
- if (animation === "fade") {
2202
- faderClass = stitchesCss({
2203
- ".keen-slider__slide": opacities.reduce((acc, opacity, index) => {
2204
- acc[`&:nth-child(${index + 1})`] = {
2205
- opacity
2206
- };
2207
- return acc;
2208
- }, {})
2209
- })().className;
2210
- }
2211
- let _className = clsx6(
2212
- faderClass,
2213
- animation === "slide" ? "keen-slider" : "keen-fader"
2214
- );
2215
- let arrowsClass = clsx6(
2216
- "wv-slideshow--arrows",
2217
- showArrowsOnHover && "show-on-hover",
2218
- `arrows--${arrowsColor}`
2219
- );
2220
- return /* @__PURE__ */ React28.createElement("div", { ref, style, ...rest }, /* @__PURE__ */ React28.createElement("div", { ref: sliderRef, className: _className }, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
2221
- Arrows,
2222
- {
2223
- instanceRef,
2224
- currentSlide,
2225
- className: arrowsClass,
2226
- icon: arrowIcon,
2227
- offset: 20
2228
- }
2229
- ), showDots && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
2230
- Dots,
2231
- {
2232
- instanceRef,
2233
- currentSlide,
2234
- className: "wv-slideshow--dots",
2235
- position: dotsPosition,
2236
- color: dotsColor,
2237
- absolute: true
2238
- }
2239
- ));
2240
- });
2241
- var css11 = {
2242
- "@desktop": {
2243
- opacity: "var(--slider-opacity, 0)",
2244
- padding: "32px 0",
2245
- position: "relative",
2246
- ".keen-slider": {
2247
- height: "100%"
2248
- },
2249
- ".keen-fader": {
2250
- position: "relative",
2251
- height: "100%",
2252
- ".keen-slider__slide": {
2253
- position: "absolute",
2254
- inset: 0
2255
- }
2256
- },
2257
- ".wv-slideshow--arrows": {
2258
- ".arrow": {
2259
- borderRadius: "100%",
2260
- backgroundColor: "transparent",
2261
- padding: "6px",
2262
- "&:hover": {
2263
- backgroundColor: "#fff"
2264
- },
2265
- svg: {
2266
- width: "28px",
2267
- height: "28px"
2268
- }
2269
- },
2270
- "&.show-on-hover": {
2271
- opacity: 0,
2272
- transition: "opacity 0.3s ease"
2273
- },
2274
- "&.arrows--dark": {
2275
- ".arrow": {
2276
- color: "#000"
2277
- }
2278
- },
2279
- "&.arrows--light": {
2280
- ".arrow": {
2281
- color: "#fff"
2282
- }
2283
- }
2284
- },
2285
- "&:hover": {
2286
- ".wv-slideshow--arrows": {
2287
- opacity: 1
2288
- }
2289
- }
2290
- }
2291
- };
2292
- Slideshow.defaultProps = {
2293
- animation: "slide",
2294
- slidesPerView: 1,
2295
- spacing: 0,
2296
- showArrows: true,
2297
- showArrowsOnHover: false,
2298
- arrowIcon: "caret",
2299
- arrowsColor: "dark",
2300
- showDots: true,
2301
- dotsPosition: "bottom",
2302
- dotsColor: "dark",
2303
- loop: true,
2304
- autoRotate: false,
2305
- changeSlidesEvery: 5
2306
- };
2307
- var slideshow_default = Slideshow;
2308
-
2309
- // src/elements/slideshow/slide.tsx
2310
- import React29, { forwardRef as forwardRef12 } from "react";
2311
-
2312
- // src/elements/slideshow/position.ts
2313
- var slidePositionMap = {
2314
- "top left": {
2315
- justifyContent: "flex-start",
2316
- alignItems: "flex-start"
2317
- },
2318
- "top center": {
2319
- justifyContent: "flex-start",
2320
- alignItems: "center"
2321
- },
2322
- "top right": {
2323
- justifyContent: "flex-start",
2324
- alignItems: "flex-end"
2325
- },
2326
- "center left": {
2327
- justifyContent: "center",
2328
- alignItems: "flex-start"
2329
- },
2330
- "center center": {
2331
- justifyContent: "center",
2332
- alignItems: "center"
2333
- },
2334
- "center right": {
2335
- justifyContent: "center",
2336
- alignItems: "flex-end"
2337
- },
2338
- "bottom left": {
2339
- justifyContent: "flex-end",
2340
- alignItems: "flex-start"
2341
- },
2342
- "bottom center": {
2343
- justifyContent: "flex-end",
2344
- alignItems: "center"
2345
- },
2346
- "bottom right": {
2347
- justifyContent: "flex-end",
2348
- alignItems: "flex-end"
2349
- }
2350
- };
2351
-
2352
- // src/elements/slideshow/slide.tsx
2353
- var Slide = forwardRef12((props, ref) => {
2354
- let {
2355
- contentPosition,
2356
- backgroundColor,
2357
- backgroundImage,
2358
- objectFit,
2359
- objectPosition,
2360
- enableOverlay,
2361
- overlayOpacity,
2362
- backgroundFit,
2363
- backgroundPosition,
2364
- children,
2365
- ...rest
2366
- } = props;
2367
- return /* @__PURE__ */ React29.createElement("div", { className: "keen-slider__slide" }, /* @__PURE__ */ React29.createElement(
2368
- Background,
2369
- {
2370
- backgroundColor,
2371
- backgroundImage,
2372
- backgroundFit: objectFit,
2373
- backgroundPosition: objectPosition,
2374
- className: "slide-background"
2375
- }
2376
- ), /* @__PURE__ */ React29.createElement(
2377
- Overlay2,
2378
- {
2379
- enableOverlay,
2380
- overlayOpacity,
2381
- className: "slide-overlay"
2382
- }
2383
- ), /* @__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")));
2384
- });
2385
- var css12 = {
2386
- "@desktop": {
2387
- position: "relative",
2388
- height: "100%",
2389
- width: "1224px",
2390
- maxWidth: "100%",
2391
- margin: "0 auto",
2392
- display: "flex",
2393
- flexDirection: "column",
2394
- padding: "100px 20px",
2395
- ".wv-slide-placeholder": {
2396
- height: "200px",
2397
- zIndex: 1
2398
- }
2399
- }
2400
- };
2401
- Slide.defaultProps = {
2402
- contentPosition: "center center",
2403
- objectFit: "cover",
2404
- objectPosition: "center center",
2405
- enableOverlay: false,
2406
- overlayOpacity: 30
2407
- };
2408
- var slide_default = Slide;
2409
-
2410
- // src/elements/index.ts
2411
- var Elements = {
2412
- Countdown: {
2413
- Component: countdown_default,
2414
- type: "countdown",
2415
- defaultCss: css3
2416
- },
2417
- Button: {
2418
- Component: button_default,
2419
- type: "button",
2420
- defaultCss: css
2421
- },
2422
- Container: {
2423
- Component: container_default,
2424
- type: "container",
2425
- defaultCss: css2
2426
- },
2427
- Image: {
2428
- Component: image_default,
2429
- type: "image",
2430
- defaultCss: css4
2431
- },
2432
- Instagram: {
2433
- Component: instagram_default,
2434
- type: "instagram",
2435
- defaultCss: css10,
2436
- permanentCss
2437
- },
2438
- Layout: {
2439
- Component: layout_default,
2440
- type: "layout",
2441
- defaultCss: css5
2442
- },
2443
- Map: {
2444
- Component: map_default,
2445
- type: "map",
2446
- defaultCss: css6
2447
- },
2448
- Text: {
2449
- Component: text_default,
2450
- type: "text",
2451
- defaultCss: css7
2452
- },
2453
- ScrollingText: {
2454
- Component: scrolling_text_default,
2455
- type: "scrolling-text",
2456
- defaultCss: css8
2457
- },
2458
- Video: {
2459
- Component: video_default,
2460
- type: "video",
2461
- defaultCss: css9
2462
- },
2463
- Slideshow: {
2464
- Component: slideshow_default,
2465
- type: "slideshow",
2466
- defaultCss: css11
2467
- },
2468
- Slide: {
2469
- Component: slide_default,
2470
- type: "slide",
2471
- defaultCss: css12
2472
- }
2473
- };
2474
-
2475
- // src/context.ts
2476
- var createRootContext = (configs) => {
2477
- let rootContext = new Weaverse(configs);
2478
- Object.keys(Elements).forEach((key) => {
2479
- rootContext.registerElement(Elements[key]);
2480
- });
2481
- return rootContext;
2482
- };
2483
- var WeaverseContext = createContext({});
2484
- var WeaverseContextProvider = WeaverseContext.Provider;
2485
- var WeaverseContextConsumer = WeaverseContext.Consumer;
2486
-
2487
- // src/renderer.tsx
2488
- import { isBrowser as isBrowser2 } from "@weaverse/core";
2489
- import React30, { memo, useContext as useContext6, useEffect as useEffect5, useRef, useState as useState6 } from "react";
2490
-
2491
- // src/utils/uploadcare.ts
2492
- import { isBrowser } from "@weaverse/core";
2493
- var initialized = false;
2494
- function initUploadCareAdaptiveDelivery(baseUrl) {
2495
- try {
2496
- Promise.resolve().then(() => {
2497
- if (!initialized && isBrowser && !window.Blinkloader) {
2498
- initialized = true;
2499
- (function(src, cb) {
2500
- let s = document.createElement("script");
2501
- s.setAttribute("src", src);
2502
- s.onload = cb;
2503
- (document.head || document.body).appendChild(s);
2504
- })(baseUrl + "/static/blinkloader.min.js", function() {
2505
- window.Blinkloader.optimize({
2506
- pubkey: "1a22133d1a1bdc089d4c",
2507
- fadeIn: true,
2508
- lazyload: true,
2509
- smartCompression: true,
2510
- responsive: true,
2511
- retina: true,
2512
- webp: true
2513
- });
2514
- });
2515
- }
2516
- });
2517
- } catch (e) {
2518
- console.error(e);
2519
- }
2520
- }
2521
68
 
2522
69
  // src/renderer.tsx
2523
- import clsx7 from "clsx";
2524
70
  var WeaverseRoot = memo(({ context }) => {
2525
- let [, setData] = useState6(context.data);
71
+ let [, setData] = useState(context.data);
2526
72
  let rootRef = useRef();
2527
73
  let renderRoot = () => setData({});
2528
- useEffect5(() => {
74
+ useEffect(() => {
2529
75
  context.subscribe(renderRoot);
2530
76
  context.contentRootElement = rootRef.current;
2531
- initUploadCareAdaptiveDelivery(context.weaverseHost);
2532
77
  return () => {
2533
78
  context.unsubscribe(renderRoot);
2534
79
  };
@@ -2536,22 +81,22 @@ var WeaverseRoot = memo(({ context }) => {
2536
81
  let eventHandlers = context?.studioBridge?.eventHandlers || {};
2537
82
  let themeClass = context.stitchesInstance.theme.className;
2538
83
  if (context.data?.rootId) {
2539
- return /* @__PURE__ */ React30.createElement(
84
+ return /* @__PURE__ */ React.createElement(
2540
85
  "div",
2541
86
  {
2542
87
  className: `weaverse-content-root ${themeClass}`,
2543
88
  ...eventHandlers,
2544
89
  ref: rootRef
2545
90
  },
2546
- /* @__PURE__ */ React30.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ React30.createElement(ItemInstance, { id: context.data.rootId }))
91
+ /* @__PURE__ */ React.createElement(WeaverseContextProvider, { value: context }, /* @__PURE__ */ React.createElement(ItemInstance, { id: context.data.rootId }))
2547
92
  );
2548
93
  }
2549
94
  return null;
2550
95
  });
2551
96
  var ItemComponent = memo(({ instance }) => {
2552
- let context = useContext6(WeaverseContext);
97
+ let context = useContext(WeaverseContext);
2553
98
  let { stitchesInstance, elementInstances } = context;
2554
- let [data, setData] = useState6(instance.data);
99
+ let [data, setData] = useState(instance.data);
2555
100
  let {
2556
101
  id,
2557
102
  type,
@@ -2561,14 +106,13 @@ var ItemComponent = memo(({ instance }) => {
2561
106
  createdAt,
2562
107
  updatedAt,
2563
108
  deletedAt,
2564
- tailwindClasses,
2565
- css: css13,
109
+ css,
2566
110
  ...rest
2567
111
  } = data;
2568
- useEffect5(() => {
112
+ useEffect(() => {
2569
113
  let render = (data2) => setData({ ...data2 });
2570
114
  instance.subscribe(render);
2571
- if (isBrowser2 && !instance.ref.current) {
115
+ if (isBrowser && !instance.ref.current) {
2572
116
  Object.assign(instance.ref, {
2573
117
  current: document.querySelector(`[data-wv-id="${id}"]`)
2574
118
  });
@@ -2581,20 +125,20 @@ var ItemComponent = memo(({ instance }) => {
2581
125
  if (Component.$$typeof === Symbol.for("react.forward_ref")) {
2582
126
  rest.ref = instance.ref;
2583
127
  }
2584
- return /* @__PURE__ */ React30.createElement(
128
+ return /* @__PURE__ */ React.createElement(
2585
129
  Component,
2586
130
  {
2587
131
  key: id,
2588
132
  "data-wv-type": type,
2589
133
  "data-wv-id": id,
2590
- className: clsx7(
134
+ className: clsx_m_default(
2591
135
  generateItemClassName(instance, stitchesInstance),
2592
136
  rest?.data?.className
2593
137
  ),
2594
138
  ...rest
2595
139
  },
2596
- childIds.map((cid) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: cid, id: cid })),
2597
- children.map((item) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: item.id, id: item.id }))
140
+ childIds.map((cid) => /* @__PURE__ */ React.createElement(ItemInstance, { key: cid, id: cid })),
141
+ children.map((item) => /* @__PURE__ */ React.createElement(ItemInstance, { key: item.id, id: item.id }))
2598
142
  );
2599
143
  } else {
2600
144
  console.log(`\u274C Unknown element: ${type}`);
@@ -2602,22 +146,18 @@ var ItemComponent = memo(({ instance }) => {
2602
146
  }
2603
147
  });
2604
148
  var ItemInstance = memo(({ id }) => {
2605
- let context = useContext6(WeaverseContext);
149
+ let context = useContext(WeaverseContext);
2606
150
  let { itemInstances } = context;
2607
151
  let instance = itemInstances.get(id);
2608
152
  if (!instance) {
2609
153
  console.warn(`Item instance ${id} not found`);
2610
- return /* @__PURE__ */ React30.createElement("div", { style: { display: "none" } }, "Item instance ", id, " not found");
154
+ return /* @__PURE__ */ React.createElement("div", { style: { display: "none" } }, "Item instance ", id, " not found");
2611
155
  }
2612
- return /* @__PURE__ */ React30.createElement(ItemComponent, { key: id, instance });
156
+ return /* @__PURE__ */ React.createElement(ItemComponent, { key: id, instance });
2613
157
  });
2614
158
  export {
2615
- Components,
2616
- Elements,
2617
- SliderComponents,
2618
159
  WeaverseContext,
2619
160
  WeaverseContextConsumer,
2620
161
  WeaverseContextProvider,
2621
- WeaverseRoot,
2622
- createRootContext
162
+ WeaverseRoot
2623
163
  };