@weaverse/react 1.0.46 → 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,2069 +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
- width: 48,
1543
- textAlign: "center",
1544
- ".wv-cd-label": {
1545
- fontSize: 10
1546
- }
1547
- },
1548
- ".wv-cd-separator": {
1549
- span: {
1550
- lineHeight: "100%"
1551
- },
1552
- ".hidden": {
1553
- visibility: "hidden"
1554
- }
1555
- }
1556
- }
1557
- };
1558
- Countdown.defaultProps = {
1559
- timerType: "fixed-time",
1560
- startTime: Date.now(),
1561
- endTime: Date.now() + 1e3 * 60 * 60 * 24,
1562
- periods: 90,
1563
- redirectWhenTimerStops: false,
1564
- redirectUrl: "",
1565
- openInNewTab: false,
1566
- showLabel: true,
1567
- showColon: true
1568
- };
1569
- var countdown_default = Countdown;
1570
-
1571
- // src/elements/image.tsx
1572
- import React17 from "react";
1573
- var Image2 = React17.forwardRef(
1574
- (props, ref) => {
1575
- let {
1576
- src,
1577
- alt,
1578
- objectFit,
1579
- objectPosition,
1580
- clickAction,
1581
- openLinkInNewTab,
1582
- linkTo,
1583
- ...rest
1584
- } = props;
1585
- let style = {
1586
- "--img-object-fit": objectFit,
1587
- "--img-object-position": objectPosition
1588
- };
1589
- let content = /* @__PURE__ */ React17.createElement("img", { alt, "data-blink-src": src });
1590
- if (clickAction === "openLink" && linkTo) {
1591
- content = /* @__PURE__ */ React17.createElement(
1592
- "a",
1593
- {
1594
- href: linkTo,
1595
- target: openLinkInNewTab ? "_blank" : "_self",
1596
- rel: "noreferrer"
1597
- },
1598
- /* @__PURE__ */ React17.createElement("img", { alt, "data-blink-src": src })
1599
- );
1600
- }
1601
- return /* @__PURE__ */ React17.createElement("div", { ref, style, ...rest }, content);
1602
- }
1603
- );
1604
- var css4 = {
1605
- "@desktop": {
1606
- display: "flex",
1607
- overflow: "hidden",
1608
- justifyContent: "center",
1609
- alignItems: "center",
1610
- img: {
1611
- width: "100%",
1612
- height: "100%",
1613
- objectFit: "var(--img-object-fit, cover)",
1614
- objectPosition: "var(--img-object-position, center)"
1615
- }
1616
- }
1617
- };
1618
- Image2.defaultProps = {
1619
- src: "https://ucarecdn.com/dac0f414-2b1f-46df-99ce-41554f0f653a/",
1620
- alt: "Alternative information",
1621
- objectFit: "cover",
1622
- objectPosition: "center center",
1623
- clickAction: "none",
1624
- openLinkInNewTab: false,
1625
- linkTo: ""
1626
- };
1627
- var image_default = Image2;
1628
-
1629
- // src/elements/layout.tsx
1630
- import React18, { forwardRef as forwardRef6 } from "react";
1631
- var Layout = forwardRef6((props, ref) => {
1632
- let {
1633
- children,
1634
- rows,
1635
- gap,
1636
- rowSize,
1637
- columns,
1638
- contentSize,
1639
- gridSize,
1640
- backgroundColor,
1641
- backgroundImage,
1642
- objectFit,
1643
- objectPosition,
1644
- enableOverlay,
1645
- overlayOpacity,
1646
- ...rest
1647
- } = props;
1648
- let style = {
1649
- "--layout-content-width": "100vw",
1650
- "--content-size": contentSize + "px",
1651
- "--grid-size": gridSize + "px",
1652
- "--rows": rows,
1653
- "--columns": columns,
1654
- "--gap": gap + "px",
1655
- "--row-size": rowSize + "px",
1656
- "--col-size": "calc((var(--grid-size) - calc(var(--columns) - 1) * var(--gap)) / var(--columns))"
1657
- };
1658
- return /* @__PURE__ */ React18.createElement("div", { ref, ...rest, style }, /* @__PURE__ */ React18.createElement(
1659
- Background,
1660
- {
1661
- backgroundImage,
1662
- backgroundColor,
1663
- backgroundFit: objectFit,
1664
- backgroundPosition: objectPosition
1665
- }
1666
- ), /* @__PURE__ */ React18.createElement(Overlay2, { enableOverlay, overlayOpacity }), /* @__PURE__ */ React18.createElement("div", { "data-layout-content": true }, children));
1667
- });
1668
- var css5 = {
1669
- "@desktop": {
1670
- position: "relative",
1671
- "> [data-layout-content]": {
1672
- // paddingTop: 'var(--gap)',
1673
- // paddingBottom: 'var(--gap)',
1674
- margin: "0 auto",
1675
- display: "grid",
1676
- gridTemplateRows: "repeat(var(--rows), var(--row-size))",
1677
- 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)",
1678
- gridAutoRows: "var(--row-size)",
1679
- gap: "var(--gap)",
1680
- maxWidth: "var(--layout-content-width)"
1681
- }
1682
- },
1683
- "@mobile": {
1684
- padding: "0 16px",
1685
- "> [data-layout-content]": {
1686
- display: "flex",
1687
- flexDirection: "column"
1688
- }
1689
- }
1690
- };
1691
- Layout.defaultProps = {
1692
- contentSize: 1600,
1693
- gridSize: 1224,
1694
- rows: 16,
1695
- columns: 12,
1696
- gap: 16,
1697
- rowSize: 48,
1698
- objectFit: "cover",
1699
- objectPosition: "center center",
1700
- enableOverlay: false,
1701
- overlayOpacity: 30
1702
- };
1703
- var layout_default = Layout;
1704
-
1705
- // src/elements/map.tsx
1706
- import React19, { forwardRef as forwardRef7 } from "react";
1707
- var Map = forwardRef7((props, ref) => {
1708
- let { place, zoom, ...rest } = props;
1709
- return /* @__PURE__ */ React19.createElement("div", { ref, ...rest }, /* @__PURE__ */ React19.createElement(
1710
- "iframe",
1711
- {
1712
- loading: "lazy",
1713
- width: "100%",
1714
- height: "100%",
1715
- title: "map",
1716
- src: `https://maps.google.com/maps?z=${zoom}&t=m&q=${place}&ie=UTF8&&output=embed`,
1717
- style: { pointerEvents: "none" }
1718
- }
1719
- ));
1720
- });
1721
- var css6 = {
1722
- "@desktop": {
1723
- iframe: {
1724
- border: "none"
1725
- }
1726
- },
1727
- "@mobile": {
1728
- iframe: {
1729
- border: "none"
1730
- }
1731
- }
1732
- };
1733
- Map.defaultProps = {
1734
- place: "Hanoi",
1735
- zoom: 14
1736
- };
1737
- var map_default = Map;
1738
-
1739
- // src/elements/text.tsx
1740
- import * as React20 from "react";
1741
- var Text = React20.forwardRef(
1742
- (props, ref) => {
1743
- let { children, value, ...rest } = props;
1744
- return /* @__PURE__ */ React20.createElement("div", { ref, ...rest }, /* @__PURE__ */ React20.createElement(
1745
- "div",
1746
- {
1747
- className: "wv-text-content",
1748
- dangerouslySetInnerHTML: { __html: value }
1749
- }
1750
- ));
1751
- }
1752
- );
1753
- var css7 = {
1754
- "@desktop": {
1755
- display: "flex",
1756
- padding: "10px",
1757
- overflow: "hidden",
1758
- ".wv-text-content": {
1759
- width: "100%",
1760
- height: "fit-content",
1761
- "> p, > h1, > h2, > h3, > h4, > h5, > h6": {
1762
- all: "inherit",
1763
- margin: "0",
1764
- wordBreak: "break-word",
1765
- overflowWrap: "break-word",
1766
- width: "auto",
1767
- height: "auto"
1768
- }
1769
- }
1770
- }
1771
- };
1772
- Text.defaultProps = {
1773
- value: "<p>The quick brown fox jumps over the lazy dog</p>"
1774
- };
1775
- var text_default = Text;
1776
-
1777
- // src/elements/scrolling-text.tsx
1778
- import React21 from "react";
1779
- import { useState as useState3 } from "react";
1780
- var ScrollingText = React21.forwardRef((props, ref) => {
1781
- let { children, value, gap, speed, pauseOnHover, ...rest } = props;
1782
- let [playState, setPlayState] = useState3("running");
1783
- let style = {
1784
- "--gap": `${gap}px`,
1785
- "--speed": `${speed}s`,
1786
- "--play-state": playState
1787
- };
1788
- let events = {};
1789
- if (pauseOnHover) {
1790
- events = {
1791
- onMouseEnter: () => setPlayState("paused"),
1792
- onMouseLeave: () => setPlayState("running")
1793
- };
1794
- }
1795
- 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(
1796
- "div",
1797
- {
1798
- key: i,
1799
- className: "wv-text-content",
1800
- dangerouslySetInnerHTML: { __html: value }
1801
- }
1802
- ))));
1803
- });
1804
- var css8 = {
1805
- "@desktop": {
1806
- display: "flex",
1807
- padding: "10px",
1808
- overflow: "hidden",
1809
- ".wv-scrolling-text__container": {
1810
- visibility: "visible",
1811
- whiteSpace: "nowrap",
1812
- display: "flex",
1813
- gap: "var(--gap, 40px)",
1814
- animation: "wv-scrolling-text var(--speed, 100s) linear infinite",
1815
- animationPlayState: "var(--play-state, running)",
1816
- ".wv-text-content": {
1817
- width: "100%",
1818
- height: "fit-content",
1819
- "> p, > h1, > h2, > h3, > h4, > h5, > h6": {
1820
- all: "inherit",
1821
- margin: "0",
1822
- wordBreak: "break-word",
1823
- overflowWrap: "break-word",
1824
- width: "auto",
1825
- height: "auto"
1826
- }
1827
- }
1828
- }
1829
- }
1830
- };
1831
- ScrollingText.defaultProps = {
1832
- value: "<p>The quick brown fox jumps over the lazy dog</p>",
1833
- gap: 40,
1834
- speed: 200,
1835
- pauseOnHover: true
1836
- };
1837
- var scrolling_text_default = ScrollingText;
1838
-
1839
- // src/elements/video/index.tsx
1840
- import React25, { forwardRef as forwardRef9, useContext as useContext4 } from "react";
1841
-
1842
- // src/elements/video/html-video.tsx
1843
- import React22 from "react";
1844
- function HTMLVideo(props) {
1845
- let { src, type, controls, autoPlay, loop, muted } = props;
1846
- return /* @__PURE__ */ React22.createElement(
1847
- "video",
1848
- {
1849
- controls,
1850
- autoPlay,
1851
- loop,
1852
- muted,
1853
- controlsList: "nodownload",
1854
- disablePictureInPicture: true
1855
- },
1856
- /* @__PURE__ */ React22.createElement("source", { src, type: type || "video/mp4" }),
1857
- /* @__PURE__ */ React22.createElement("source", { src, type: "video/ogg" }),
1858
- "Your browser does not support the video tag."
1859
- );
1860
- }
1861
-
1862
- // src/elements/video/vimeo.tsx
1863
- import React23 from "react";
1864
- function Vimeo(props) {
1865
- let { vimeoId, controls, autoPlay, loop, muted } = props;
1866
- let params = `autoplay=${autoPlay}&loop=${loop}&controls=${controls}&muted=${muted}`;
1867
- let vimeoSrc = `https://player.vimeo.com/video/${vimeoId}?${params}`;
1868
- return /* @__PURE__ */ React23.createElement("iframe", { src: vimeoSrc, width: "100%", height: "100%", allowFullScreen: true });
1869
- }
1870
-
1871
- // src/elements/video/youtube.tsx
1872
- import React24 from "react";
1873
- function Youtube(props) {
1874
- let { youtubeId, controls, autoPlay, loop, muted } = props;
1875
- let params = new URLSearchParams({
1876
- autoplay: autoPlay ? "1" : "0",
1877
- controls: controls ? "1" : "0",
1878
- loop: loop ? "1" : "0",
1879
- mute: muted ? "1" : "0"
1880
- });
1881
- let youtubeSrc = `https://www.youtube.com/embed/${youtubeId}?playlist=${youtubeId}&${params.toString()}`;
1882
- let allow = `accelerometer;${autoPlay ? "autoplay;" : ""} clipboard-write; encrypted-media; gyroscope; picture-in-picture`;
1883
- return /* @__PURE__ */ React24.createElement("iframe", { src: youtubeSrc, width: "100%", height: "100%", allow });
1884
- }
1885
-
1886
- // src/elements/video/index.tsx
1887
- var Video = forwardRef9((props, ref) => {
1888
- let { isDesignMode } = useContext4(WeaverseContext);
1889
- let {
1890
- src,
1891
- controls,
1892
- poster,
1893
- autoPlay: originAutoPlay,
1894
- loop,
1895
- muted,
1896
- ...rest
1897
- } = props;
1898
- let autoPlay = !isDesignMode && originAutoPlay;
1899
- let videoProps = { src, controls, poster, autoPlay, loop, muted };
1900
- let content;
1901
- let youtubeId = getYoutubeEmbedId(src);
1902
- let vimeoId = getVimeoId(src);
1903
- if (youtubeId) {
1904
- content = /* @__PURE__ */ React25.createElement(Youtube, { ...videoProps, youtubeId });
1905
- } else if (vimeoId) {
1906
- content = /* @__PURE__ */ React25.createElement(Vimeo, { ...videoProps, vimeoId });
1907
- } else {
1908
- content = /* @__PURE__ */ React25.createElement(HTMLVideo, { ...videoProps });
1909
- }
1910
- return /* @__PURE__ */ React25.createElement("div", { ref, ...rest }, content);
1911
- });
1912
- var css9 = {
1913
- "@desktop": {
1914
- video: {
1915
- height: "100%",
1916
- width: "100%",
1917
- aspectRatio: "16 / 9"
1918
- },
1919
- iframe: {
1920
- border: "none"
1921
- }
1922
- },
1923
- "@mobile": {
1924
- iframe: {
1925
- border: "none"
1926
- }
1927
- }
1928
- };
1929
- Video.defaultProps = {
1930
- src: "https://youtu.be/wM-NT6hcw48",
1931
- poster: "https://ucarecdn.com/c413b8fe-ceec-4948-9c42-a0434c4ca920/-/preview/-/quality/smart/-/format/auto/",
1932
- loop: false,
1933
- controls: false,
1934
- autoPlay: true,
1935
- muted: true
1936
- };
1937
- var video_default = Video;
1938
-
1939
- // src/elements/instagram.tsx
1940
- import React26, { forwardRef as forwardRef10, useEffect as useEffect3, useState as useState4 } from "react";
1941
- var Instagram = forwardRef10(
1942
- (props, ref) => {
1943
- let { token, username, numberOfImages, imagesPerRow, gap, ...rest } = props;
1944
- let [media, setMedia] = useState4([]);
1945
- let [error, setError] = useState4(null);
1946
- useEffect3(() => {
1947
- if (token) {
1948
- let params = new URLSearchParams({
1949
- access_token: token,
1950
- fields: "id,media_type,caption,media_url,permalink,thumbnail_url"
1951
- });
1952
- fetch(`${INSTAGRAM_API}/me/media?${params.toString()}`).then((res) => res.json()).then((res) => {
1953
- if (res.error) {
1954
- setError(res);
1955
- } else {
1956
- setError(null);
1957
- setMedia([...res.data]);
1958
- }
1959
- }).catch(setError);
1960
- }
1961
- }, [token]);
1962
- if (!token || error) {
1963
- 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!"));
1964
- }
1965
- let style = {
1966
- "--wv-ig-images-per-row": imagesPerRow,
1967
- "--wv-ig-images-gap": gap + "px"
1968
- };
1969
- return /* @__PURE__ */ React26.createElement("div", { ref, ...rest, style }, /* @__PURE__ */ React26.createElement("div", { className: "wv-ig-media-container" }, media.slice(0, numberOfImages).map((item) => {
1970
- let {
1971
- id,
1972
- permalink,
1973
- caption,
1974
- media_url,
1975
- media_type,
1976
- thumbnail_url
1977
- } = item;
1978
- if (media_type === "VIDEO") {
1979
- return /* @__PURE__ */ React26.createElement("video", { key: id, controls: true, poster: thumbnail_url }, /* @__PURE__ */ React26.createElement("source", { src: media_url, type: "video/mp4" }));
1980
- }
1981
- return /* @__PURE__ */ React26.createElement("a", { key: id, href: permalink, target: "_blank", rel: "noreferrer" }, /* @__PURE__ */ React26.createElement("img", { alt: caption, src: media_url }));
1982
- })));
1983
- }
1984
- );
1985
- var css10 = {
1986
- // '@desktop': {
1987
- // '.wv-ig-media-container': {
1988
- // overflow: 'hidden',
1989
- // maxWidth: '100%',
1990
- // maxHeight: '100%',
1991
- // display: 'grid',
1992
- // gridTemplateColumns: 'repeat(var(--wv-ig-images-per-row, 4), 1fr)',
1993
- // gap: 'var(--wv-ig-images-gap, 0px)',
1994
- // img: {
1995
- // // aspectRatio: '1 / 1',
1996
- // maxWidth: '100%',
1997
- // maxHeight: '100%',
1998
- // objectFit: 'cover',
1999
- // },
2000
- // },
2001
- // },
2002
- };
2003
- var permanentCss = {
2004
- "@desktop": {
2005
- ".wv-ig-media-container": {
2006
- overflow: "hidden",
2007
- maxWidth: "100%",
2008
- maxHeight: "100%",
2009
- display: "grid",
2010
- gridTemplateColumns: "repeat(var(--wv-ig-images-per-row, 4), 1fr)",
2011
- gap: "var(--wv-ig-images-gap, 0px)",
2012
- img: {
2013
- // aspectRatio: '1 / 1',
2014
- maxWidth: "100%",
2015
- maxHeight: "100%",
2016
- objectFit: "cover"
2017
- },
2018
- video: {
2019
- width: "100%",
2020
- height: "100%"
2021
- }
2022
- }
2023
- },
2024
- "@mobile": {
2025
- ".wv-ig-media-container": {
2026
- overflowX: "auto",
2027
- display: "flex",
2028
- scrollSnapType: "x mandatory"
2029
- },
2030
- ".wv-ig-media-container a": {
2031
- scrollSnapAlign: "start",
2032
- flexGrow: 0,
2033
- flexShrink: 0,
2034
- flexBasis: "100%"
2035
- }
2036
- }
2037
- };
2038
- Instagram.defaultProps = {
2039
- token: "",
2040
- username: "",
2041
- numberOfImages: 8,
2042
- imagesPerRow: 4,
2043
- gap: 0
2044
- };
2045
- var instagram_default = Instagram;
2046
-
2047
- // src/elements/slideshow/index.tsx
2048
- import { css as stitchesCss } from "@stitches/react";
2049
- import clsx6 from "clsx";
2050
- import React28, { forwardRef as forwardRef11 } from "react";
2051
-
2052
- // src/elements/slideshow/use-slideshow-configs.ts
2053
- import { useKeenSlider as useKeenSlider2 } from "keen-slider/react";
2054
- 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;
2055
34
 
2056
35
  // src/utils/css.ts
2057
- import clsx5 from "clsx";
2058
- function formatCSS(css13) {
36
+ function formatCSS(css) {
2059
37
  return {
2060
- "@desktop": css13["@desktop"],
2061
- "@mobile": css13["@mobile"]
38
+ "@desktop": css["@desktop"],
39
+ "@mobile": css["@mobile"]
2062
40
  };
2063
41
  }
2064
42
  var permanentClasses = {};
2065
43
  function generateItemClassName(instance, stitchesInstance) {
2066
- let { css: css13, type, className: cls = "", tailwindClasses } = instance.data;
44
+ let { css, type, className: cls = "" } = instance.data;
2067
45
  let className = "";
2068
46
  let permanentClass = "";
2069
47
  let perCss = instance.Element?.permanentCss;
@@ -2077,459 +55,25 @@ function generateItemClassName(instance, stitchesInstance) {
2077
55
  }
2078
56
  }
2079
57
  className = permanentClass;
2080
- if (css13) {
2081
- let formattedCss = formatCSS(css13);
58
+ if (css) {
59
+ let formattedCss = formatCSS(css);
2082
60
  let newStitchesClass = stitchesInstance.css(formattedCss)().className || "";
2083
61
  let { stitchesClass } = instance;
2084
62
  let otherClass = (instance.ref.current?.className || "").replace(stitchesClass, "").replace(cls, "").replace(permanentClass, "").trim();
2085
- className = clsx5(
2086
- permanentClass,
2087
- cls,
2088
- tailwindClasses,
2089
- newStitchesClass,
2090
- otherClass
2091
- );
63
+ className = clsx_m_default(permanentClass, cls, newStitchesClass, otherClass);
2092
64
  instance.stitchesClass = newStitchesClass;
2093
65
  }
2094
66
  return className;
2095
67
  }
2096
- function loadCSS(attrs) {
2097
- return new Promise((resolve, reject) => {
2098
- let found = document.querySelector(`link[href="${attrs.href}"]`);
2099
- if (found) {
2100
- return resolve(true);
2101
- }
2102
- let link = document.createElement("link");
2103
- Object.assign(link, attrs);
2104
- link.addEventListener("load", () => resolve(true));
2105
- link.onerror = reject;
2106
- document.head.appendChild(link);
2107
- });
2108
- }
2109
-
2110
- // src/elements/slideshow/use-slideshow-configs.ts
2111
- function useSlideshowConfigs(props) {
2112
- let {
2113
- animation,
2114
- slidesPerView,
2115
- loop,
2116
- autoRotate,
2117
- changeSlidesEvery,
2118
- children
2119
- } = props;
2120
- let { isDesignMode, isPreviewMode } = useContext5(WeaverseContext);
2121
- let [opacities, setOpacities] = React27.useState([]);
2122
- let [cssLoaded, setCssLoaded] = useState5(false);
2123
- let [created, setCreated] = useState5(false);
2124
- let [ready, setReady] = useState5(false);
2125
- let [currentSlide, setCurrentSlide] = useState5(0);
2126
- let sliderPlugins = [ResizePlugin];
2127
- if (autoRotate && (isPreviewMode || !isDesignMode)) {
2128
- sliderPlugins.push(AutoplayPlugin(changeSlidesEvery));
2129
- }
2130
- let [sliderRef, instanceRef] = useKeenSlider2(
2131
- {
2132
- slides: animation === "fade" ? React27.Children.count(children) : { perView: slidesPerView, number: React27.Children.count(children) },
2133
- drag: isPreviewMode || !isDesignMode,
2134
- loop,
2135
- selector: animation === "fade" ? null : ".keen-slider__slide",
2136
- created: (slider) => {
2137
- setCreated(true);
2138
- if (isDesignMode) {
2139
- let slideshowElement = slider.container.closest(
2140
- '[data-wv-type="slideshow"]'
2141
- );
2142
- let elementId = slideshowElement?.getAttribute("data-wv-id");
2143
- if (elementId) {
2144
- window.weaverseSlideshowInstances = {
2145
- [elementId]: slider
2146
- };
2147
- }
2148
- }
2149
- },
2150
- slideChanged: (slider) => {
2151
- setCurrentSlide(slider.track.details.rel);
2152
- },
2153
- detailsChanged: (slider) => {
2154
- let newOpacities = slider.track?.details?.slides?.map(
2155
- (slide) => slide.portion
2156
- );
2157
- setOpacities(newOpacities);
2158
- }
2159
- },
2160
- sliderPlugins
2161
- );
2162
- useEffect4(() => {
2163
- loadCSS({
2164
- rel: "stylesheet",
2165
- href: "https://cdn.jsdelivr.net/npm/keen-slider@latest/keen-slider.min.css"
2166
- }).then(() => setCssLoaded(true));
2167
- }, []);
2168
- useEffect4(() => {
2169
- if (created && cssLoaded) {
2170
- setReady(true);
2171
- }
2172
- }, [created, cssLoaded]);
2173
- return {
2174
- sliderRef,
2175
- instanceRef,
2176
- currentSlide,
2177
- opacities,
2178
- ready,
2179
- created
2180
- };
2181
- }
2182
-
2183
- // src/elements/slideshow/index.tsx
2184
- var Slideshow = forwardRef11((props, ref) => {
2185
- let {
2186
- animation,
2187
- showArrows,
2188
- showArrowsOnHover,
2189
- arrowIcon,
2190
- arrowsColor,
2191
- showDots,
2192
- dotsPosition,
2193
- dotsColor,
2194
- children,
2195
- ...rest
2196
- } = props;
2197
- let { sliderRef, instanceRef, currentSlide, opacities, ready, created } = useSlideshowConfigs(props);
2198
- let style = {
2199
- "--slider-opacity": ready ? 1 : 0
2200
- };
2201
- let faderClass = "";
2202
- if (animation === "fade") {
2203
- faderClass = stitchesCss({
2204
- ".keen-slider__slide": opacities.reduce((acc, opacity, index) => {
2205
- acc[`&:nth-child(${index + 1})`] = {
2206
- opacity
2207
- };
2208
- return acc;
2209
- }, {})
2210
- })().className;
2211
- }
2212
- let _className = clsx6(
2213
- faderClass,
2214
- animation === "slide" ? "keen-slider" : "keen-fader"
2215
- );
2216
- let arrowsClass = clsx6(
2217
- "wv-slideshow--arrows",
2218
- showArrowsOnHover && "show-on-hover",
2219
- `arrows--${arrowsColor}`
2220
- );
2221
- return /* @__PURE__ */ React28.createElement("div", { ref, style, ...rest }, /* @__PURE__ */ React28.createElement("div", { ref: sliderRef, className: _className }, children), showArrows && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
2222
- Arrows,
2223
- {
2224
- instanceRef,
2225
- currentSlide,
2226
- className: arrowsClass,
2227
- icon: arrowIcon,
2228
- offset: 20
2229
- }
2230
- ), showDots && created && instanceRef?.current && /* @__PURE__ */ React28.createElement(
2231
- Dots,
2232
- {
2233
- instanceRef,
2234
- currentSlide,
2235
- className: "wv-slideshow--dots",
2236
- position: dotsPosition,
2237
- color: dotsColor,
2238
- absolute: true
2239
- }
2240
- ));
2241
- });
2242
- var css11 = {
2243
- "@desktop": {
2244
- opacity: "var(--slider-opacity, 0)",
2245
- padding: "32px 0",
2246
- position: "relative",
2247
- ".keen-slider": {
2248
- height: "100%"
2249
- },
2250
- ".keen-fader": {
2251
- position: "relative",
2252
- height: "100%",
2253
- ".keen-slider__slide": {
2254
- position: "absolute",
2255
- inset: 0
2256
- }
2257
- },
2258
- ".wv-slideshow--arrows": {
2259
- ".arrow": {
2260
- borderRadius: "100%",
2261
- backgroundColor: "transparent",
2262
- padding: "6px",
2263
- "&:hover": {
2264
- backgroundColor: "#fff"
2265
- },
2266
- svg: {
2267
- width: "28px",
2268
- height: "28px"
2269
- }
2270
- },
2271
- "&.show-on-hover": {
2272
- opacity: 0,
2273
- transition: "opacity 0.3s ease"
2274
- },
2275
- "&.arrows--dark": {
2276
- ".arrow": {
2277
- color: "#000"
2278
- }
2279
- },
2280
- "&.arrows--light": {
2281
- ".arrow": {
2282
- color: "#fff"
2283
- }
2284
- }
2285
- },
2286
- "&:hover": {
2287
- ".wv-slideshow--arrows": {
2288
- opacity: 1
2289
- }
2290
- }
2291
- }
2292
- };
2293
- Slideshow.defaultProps = {
2294
- animation: "slide",
2295
- slidesPerView: 1,
2296
- spacing: 0,
2297
- showArrows: true,
2298
- showArrowsOnHover: false,
2299
- arrowIcon: "caret",
2300
- arrowsColor: "dark",
2301
- showDots: true,
2302
- dotsPosition: "bottom",
2303
- dotsColor: "dark",
2304
- loop: true,
2305
- autoRotate: false,
2306
- changeSlidesEvery: 5
2307
- };
2308
- var slideshow_default = Slideshow;
2309
-
2310
- // src/elements/slideshow/slide.tsx
2311
- import React29, { forwardRef as forwardRef12 } from "react";
2312
-
2313
- // src/elements/slideshow/position.ts
2314
- var slidePositionMap = {
2315
- "top left": {
2316
- justifyContent: "flex-start",
2317
- alignItems: "flex-start"
2318
- },
2319
- "top center": {
2320
- justifyContent: "flex-start",
2321
- alignItems: "center"
2322
- },
2323
- "top right": {
2324
- justifyContent: "flex-start",
2325
- alignItems: "flex-end"
2326
- },
2327
- "center left": {
2328
- justifyContent: "center",
2329
- alignItems: "flex-start"
2330
- },
2331
- "center center": {
2332
- justifyContent: "center",
2333
- alignItems: "center"
2334
- },
2335
- "center right": {
2336
- justifyContent: "center",
2337
- alignItems: "flex-end"
2338
- },
2339
- "bottom left": {
2340
- justifyContent: "flex-end",
2341
- alignItems: "flex-start"
2342
- },
2343
- "bottom center": {
2344
- justifyContent: "flex-end",
2345
- alignItems: "center"
2346
- },
2347
- "bottom right": {
2348
- justifyContent: "flex-end",
2349
- alignItems: "flex-end"
2350
- }
2351
- };
2352
-
2353
- // src/elements/slideshow/slide.tsx
2354
- var Slide = forwardRef12((props, ref) => {
2355
- let {
2356
- contentPosition,
2357
- backgroundColor,
2358
- backgroundImage,
2359
- objectFit,
2360
- objectPosition,
2361
- enableOverlay,
2362
- overlayOpacity,
2363
- backgroundFit,
2364
- backgroundPosition,
2365
- children,
2366
- ...rest
2367
- } = props;
2368
- return /* @__PURE__ */ React29.createElement("div", { className: "keen-slider__slide" }, /* @__PURE__ */ React29.createElement(
2369
- Background,
2370
- {
2371
- backgroundColor,
2372
- backgroundImage,
2373
- backgroundFit: objectFit,
2374
- backgroundPosition: objectPosition,
2375
- className: "slide-background"
2376
- }
2377
- ), /* @__PURE__ */ React29.createElement(
2378
- Overlay2,
2379
- {
2380
- enableOverlay,
2381
- overlayOpacity,
2382
- className: "slide-overlay"
2383
- }
2384
- ), /* @__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")));
2385
- });
2386
- var css12 = {
2387
- "@desktop": {
2388
- position: "relative",
2389
- height: "100%",
2390
- width: "1224px",
2391
- maxWidth: "100%",
2392
- margin: "0 auto",
2393
- display: "flex",
2394
- flexDirection: "column",
2395
- padding: "100px 20px",
2396
- ".wv-slide-placeholder": {
2397
- height: "200px",
2398
- zIndex: 1
2399
- }
2400
- }
2401
- };
2402
- Slide.defaultProps = {
2403
- contentPosition: "center center",
2404
- objectFit: "cover",
2405
- objectPosition: "center center",
2406
- enableOverlay: false,
2407
- overlayOpacity: 30
2408
- };
2409
- var slide_default = Slide;
2410
-
2411
- // src/elements/index.ts
2412
- var Elements = {
2413
- Countdown: {
2414
- Component: countdown_default,
2415
- type: "countdown",
2416
- defaultCss: css3
2417
- },
2418
- Button: {
2419
- Component: button_default,
2420
- type: "button",
2421
- defaultCss: css
2422
- },
2423
- Container: {
2424
- Component: container_default,
2425
- type: "container",
2426
- defaultCss: css2
2427
- },
2428
- Image: {
2429
- Component: image_default,
2430
- type: "image",
2431
- defaultCss: css4
2432
- },
2433
- Instagram: {
2434
- Component: instagram_default,
2435
- type: "instagram",
2436
- defaultCss: css10,
2437
- permanentCss
2438
- },
2439
- Layout: {
2440
- Component: layout_default,
2441
- type: "layout",
2442
- defaultCss: css5
2443
- },
2444
- Map: {
2445
- Component: map_default,
2446
- type: "map",
2447
- defaultCss: css6
2448
- },
2449
- Text: {
2450
- Component: text_default,
2451
- type: "text",
2452
- defaultCss: css7
2453
- },
2454
- ScrollingText: {
2455
- Component: scrolling_text_default,
2456
- type: "scrolling-text",
2457
- defaultCss: css8
2458
- },
2459
- Video: {
2460
- Component: video_default,
2461
- type: "video",
2462
- defaultCss: css9
2463
- },
2464
- Slideshow: {
2465
- Component: slideshow_default,
2466
- type: "slideshow",
2467
- defaultCss: css11
2468
- },
2469
- Slide: {
2470
- Component: slide_default,
2471
- type: "slide",
2472
- defaultCss: css12
2473
- }
2474
- };
2475
-
2476
- // src/context.ts
2477
- var createRootContext = (configs) => {
2478
- let rootContext = new Weaverse(configs);
2479
- Object.keys(Elements).forEach((key) => {
2480
- rootContext.registerElement(Elements[key]);
2481
- });
2482
- return rootContext;
2483
- };
2484
- var WeaverseContext = createContext({});
2485
- var WeaverseContextProvider = WeaverseContext.Provider;
2486
- var WeaverseContextConsumer = WeaverseContext.Consumer;
2487
-
2488
- // src/renderer.tsx
2489
- import { isBrowser as isBrowser2 } from "@weaverse/core";
2490
- import React30, { memo, useContext as useContext6, useEffect as useEffect5, useRef, useState as useState6 } from "react";
2491
-
2492
- // src/utils/uploadcare.ts
2493
- import { isBrowser } from "@weaverse/core";
2494
- var initialized = false;
2495
- function initUploadCareAdaptiveDelivery(baseUrl) {
2496
- try {
2497
- Promise.resolve().then(() => {
2498
- if (!initialized && isBrowser && !window.Blinkloader) {
2499
- initialized = true;
2500
- (function(src, cb) {
2501
- let s = document.createElement("script");
2502
- s.setAttribute("src", src);
2503
- s.onload = cb;
2504
- (document.head || document.body).appendChild(s);
2505
- })(baseUrl + "/static/blinkloader.min.js", function() {
2506
- window.Blinkloader.optimize({
2507
- pubkey: "1a22133d1a1bdc089d4c",
2508
- fadeIn: true,
2509
- lazyload: true,
2510
- smartCompression: true,
2511
- responsive: true,
2512
- retina: true,
2513
- webp: true
2514
- });
2515
- });
2516
- }
2517
- });
2518
- } catch (e) {
2519
- console.error(e);
2520
- }
2521
- }
2522
68
 
2523
69
  // src/renderer.tsx
2524
- import clsx7 from "clsx";
2525
70
  var WeaverseRoot = memo(({ context }) => {
2526
- let [, setData] = useState6(context.data);
71
+ let [, setData] = useState(context.data);
2527
72
  let rootRef = useRef();
2528
73
  let renderRoot = () => setData({});
2529
- useEffect5(() => {
74
+ useEffect(() => {
2530
75
  context.subscribe(renderRoot);
2531
76
  context.contentRootElement = rootRef.current;
2532
- initUploadCareAdaptiveDelivery(context.weaverseHost);
2533
77
  return () => {
2534
78
  context.unsubscribe(renderRoot);
2535
79
  };
@@ -2537,22 +81,22 @@ var WeaverseRoot = memo(({ context }) => {
2537
81
  let eventHandlers = context?.studioBridge?.eventHandlers || {};
2538
82
  let themeClass = context.stitchesInstance.theme.className;
2539
83
  if (context.data?.rootId) {
2540
- return /* @__PURE__ */ React30.createElement(
84
+ return /* @__PURE__ */ React.createElement(
2541
85
  "div",
2542
86
  {
2543
87
  className: `weaverse-content-root ${themeClass}`,
2544
88
  ...eventHandlers,
2545
89
  ref: rootRef
2546
90
  },
2547
- /* @__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 }))
2548
92
  );
2549
93
  }
2550
94
  return null;
2551
95
  });
2552
96
  var ItemComponent = memo(({ instance }) => {
2553
- let context = useContext6(WeaverseContext);
97
+ let context = useContext(WeaverseContext);
2554
98
  let { stitchesInstance, elementInstances } = context;
2555
- let [data, setData] = useState6(instance.data);
99
+ let [data, setData] = useState(instance.data);
2556
100
  let {
2557
101
  id,
2558
102
  type,
@@ -2562,14 +106,13 @@ var ItemComponent = memo(({ instance }) => {
2562
106
  createdAt,
2563
107
  updatedAt,
2564
108
  deletedAt,
2565
- tailwindClasses,
2566
- css: css13,
109
+ css,
2567
110
  ...rest
2568
111
  } = data;
2569
- useEffect5(() => {
112
+ useEffect(() => {
2570
113
  let render = (data2) => setData({ ...data2 });
2571
114
  instance.subscribe(render);
2572
- if (isBrowser2 && !instance.ref.current) {
115
+ if (isBrowser && !instance.ref.current) {
2573
116
  Object.assign(instance.ref, {
2574
117
  current: document.querySelector(`[data-wv-id="${id}"]`)
2575
118
  });
@@ -2582,20 +125,20 @@ var ItemComponent = memo(({ instance }) => {
2582
125
  if (Component.$$typeof === Symbol.for("react.forward_ref")) {
2583
126
  rest.ref = instance.ref;
2584
127
  }
2585
- return /* @__PURE__ */ React30.createElement(
128
+ return /* @__PURE__ */ React.createElement(
2586
129
  Component,
2587
130
  {
2588
131
  key: id,
2589
132
  "data-wv-type": type,
2590
133
  "data-wv-id": id,
2591
- className: clsx7(
134
+ className: clsx_m_default(
2592
135
  generateItemClassName(instance, stitchesInstance),
2593
136
  rest?.data?.className
2594
137
  ),
2595
138
  ...rest
2596
139
  },
2597
- childIds.map((cid) => /* @__PURE__ */ React30.createElement(ItemInstance, { key: cid, id: cid })),
2598
- 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 }))
2599
142
  );
2600
143
  } else {
2601
144
  console.log(`\u274C Unknown element: ${type}`);
@@ -2603,22 +146,18 @@ var ItemComponent = memo(({ instance }) => {
2603
146
  }
2604
147
  });
2605
148
  var ItemInstance = memo(({ id }) => {
2606
- let context = useContext6(WeaverseContext);
149
+ let context = useContext(WeaverseContext);
2607
150
  let { itemInstances } = context;
2608
151
  let instance = itemInstances.get(id);
2609
152
  if (!instance) {
2610
153
  console.warn(`Item instance ${id} not found`);
2611
- 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");
2612
155
  }
2613
- return /* @__PURE__ */ React30.createElement(ItemComponent, { key: id, instance });
156
+ return /* @__PURE__ */ React.createElement(ItemComponent, { key: id, instance });
2614
157
  });
2615
158
  export {
2616
- Components,
2617
- Elements,
2618
- SliderComponents,
2619
159
  WeaverseContext,
2620
160
  WeaverseContextConsumer,
2621
161
  WeaverseContextProvider,
2622
- WeaverseRoot,
2623
- createRootContext
162
+ WeaverseRoot
2624
163
  };