@trade-it/react 0.1.1 → 0.3.0

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.cjs CHANGED
@@ -26,54 +26,1267 @@ const react = __toESM(require("react"));
26
26
  const react_dom = __toESM(require("react-dom"));
27
27
  const react_jsx_runtime = __toESM(require("react/jsx-runtime"));
28
28
 
29
- //#region src/LoaderCircleSpinner.tsx
30
- const SPINNER_WRAPPER_SIZE = 44;
31
- const SPINNER_ICON_SIZE = 32;
32
- const SPINNER_WRAPPER_STYLE = {
33
- width: SPINNER_WRAPPER_SIZE,
34
- height: SPINNER_WRAPPER_SIZE,
35
- display: "flex",
36
- alignItems: "center",
37
- justifyContent: "center",
38
- animation: "tradeItSdkSpin 0.9s linear infinite",
39
- transformOrigin: "50% 50%"
29
+ //#region src/TradeItLogoLoader.tsx
30
+ function fibDir(i, n) {
31
+ const golden = Math.PI * (3 - Math.sqrt(5));
32
+ const y = 1 - 2 * (i + .5) / n;
33
+ const rad = Math.sqrt(1 - y * y);
34
+ const a = i * golden;
35
+ return [
36
+ rad * Math.cos(a),
37
+ y,
38
+ rad * Math.sin(a)
39
+ ];
40
+ }
41
+ function makeProj(yaw, tilt, cx, cy, scale) {
42
+ const st = Math.sin(tilt);
43
+ const ct = Math.cos(tilt);
44
+ const sy = Math.sin(yaw);
45
+ const cyw = Math.cos(yaw);
46
+ return (x, y, z) => {
47
+ const x1 = x * cyw + z * sy;
48
+ const z1 = -x * sy + z * cyw;
49
+ const y1 = y * ct - z1 * st;
50
+ const z2 = y * st + z1 * ct;
51
+ return [
52
+ cx + x1 * scale,
53
+ cy - y1 * scale,
54
+ z2
55
+ ];
56
+ };
57
+ }
58
+ function paint(ctx, dots) {
59
+ for (const dot of dots) {
60
+ const alpha = dot.a ?? 1;
61
+ ctx.fillStyle = `rgba(11,12,14,${alpha})`;
62
+ ctx.beginPath();
63
+ ctx.arc(dot.x, dot.y, dot.r, 0, Math.PI * 2);
64
+ ctx.fill();
65
+ }
66
+ }
67
+ function paintLines(ctx, lines) {
68
+ for (const line of lines) {
69
+ const alpha = line.a ?? 1;
70
+ ctx.strokeStyle = `rgba(11,12,14,${alpha})`;
71
+ ctx.lineWidth = line.w;
72
+ ctx.beginPath();
73
+ ctx.moveTo(line.x1, line.y1);
74
+ ctx.lineTo(line.x2, line.y2);
75
+ ctx.stroke();
76
+ }
77
+ }
78
+ function finalizeFrame(dots, lines, rMin = .3) {
79
+ const visible = [];
80
+ for (const d of dots) {
81
+ if ((d.a ?? 1) < .02) continue;
82
+ d.r = Math.max(rMin, d.r);
83
+ visible.push(d);
84
+ }
85
+ visible.sort((a, b) => a.z - b.z);
86
+ return {
87
+ dots: visible,
88
+ lines: lines.filter((l) => (l.a ?? 1) >= .02)
89
+ };
90
+ }
91
+ function paintFrame(ctx, frame) {
92
+ if (frame.lines.length) paintLines(ctx, frame.lines);
93
+ paint(ctx, frame.dots);
94
+ }
95
+ function radiusScale(size, pow) {
96
+ return (size / 300) ** pow;
97
+ }
98
+ const TURN = Math.PI * 2;
99
+ function clamp01(x) {
100
+ return x < 0 ? 0 : x > 1 ? 1 : x;
101
+ }
102
+ function empty() {
103
+ return {
104
+ dots: [],
105
+ lines: []
106
+ };
107
+ }
108
+ function inkOf(o, zx, edge) {
109
+ const far = o.inkFar ?? .6;
110
+ const span = o.inkSpan ?? .5;
111
+ const rim = o.inkRim ?? .16;
112
+ return far - span * zx - rim * (1 - edge);
113
+ }
114
+ function expoInOut(x) {
115
+ if (x <= 0) return 0;
116
+ if (x >= 1) return 1;
117
+ return x < .5 ? 2 ** (20 * x - 10) / 2 : (2 - 2 ** (-20 * x + 10)) / 2;
118
+ }
119
+ function morphEase(x, expo) {
120
+ const smooth = x * x * x * (x * (x * 6 - 15) + 10);
121
+ return smooth + (expoInOut(x) - smooth) * expo;
122
+ }
123
+ function cruise(x, edge) {
124
+ const a = Math.min(.49, Math.max(.001, edge));
125
+ const v = 1 / (1 - a);
126
+ if (x <= 0) return 0;
127
+ if (x >= 1) return 1;
128
+ if (x < a) {
129
+ const u = x / a;
130
+ return v * a * (u * u * u - u * u * u * u / 2);
131
+ }
132
+ if (x > 1 - a) {
133
+ const u = (1 - x) / a;
134
+ return 1 - v * a * (u * u * u - u * u * u * u / 2);
135
+ }
136
+ return v * (a * .5 + (x - a));
137
+ }
138
+ function beatAt(t, dwell, morph, turns, settle, expo = .3) {
139
+ const cycle = dwell + morph * 2;
140
+ const local = t % cycle;
141
+ const spinSpan = dwell + morph * settle;
142
+ const spun = turns * cruise(Math.min(1, local / spinSpan), .22);
143
+ if (local < dwell) return {
144
+ m: 0,
145
+ turns: spun,
146
+ workT: local,
147
+ local,
148
+ cycle
149
+ };
150
+ const intoMorph = local - dwell;
151
+ if (intoMorph < morph) return {
152
+ m: morphEase(intoMorph / morph, expo),
153
+ turns: spun,
154
+ workT: -1,
155
+ local,
156
+ cycle
157
+ };
158
+ return {
159
+ m: morphEase(1 - (intoMorph - morph) / morph, expo),
160
+ turns: spun,
161
+ workT: -1,
162
+ local,
163
+ cycle
164
+ };
165
+ }
166
+ const frameLogoWait = (size, t, o, logo) => {
167
+ if (!logo) return empty();
168
+ const { p, e, n } = logo.points;
169
+ const seats = logo.seats;
170
+ const cx = size / 2;
171
+ const R = size / 2 * .82;
172
+ const rs = radiusScale(size, o.rsPow ?? .6);
173
+ const b = beatAt(t, o.dwell ?? 5.5, o.morph ?? 1.9, o.turns ?? 0, o.settle ?? .1, o.expo ?? .3);
174
+ const m = b.m;
175
+ const c = 1 - m;
176
+ const pt = makeProj((o.yawAmp ?? .22) * Math.sin(t * (o.yawRate ?? .3)) * c, (o.tilt ?? .42) * c, cx, cx, R);
177
+ const rings = Math.max(3, Math.round(o.rings ?? 9));
178
+ const perRing = Math.ceil(n / rings);
179
+ const breath = Math.sin(t * (o.breatheRate ?? .75));
180
+ const amp = o.breatheAmp ?? .2;
181
+ const height = (o.height ?? 1.5) * (1 + amp * breath);
182
+ const wide = (o.wide ?? .82) * (1 - amp * .72 * breath);
183
+ const spin = t * (o.spin ?? .16);
184
+ const dots = [];
185
+ for (let i = 0; i < n; i++) {
186
+ const seat = seats[i];
187
+ const ring = seat % rings;
188
+ const u = rings > 1 ? ring / (rings - 1) - .5 : 0;
189
+ const taper = Math.cos(u * Math.PI * (o.taper ?? .78));
190
+ const rad = wide * taper;
191
+ const ang = Math.floor(seat / rings) / perRing * Math.PI * 2 + spin;
192
+ const bx = Math.cos(ang) * rad;
193
+ const by = u * height;
194
+ const bz = Math.sin(ang) * rad;
195
+ const lx = p[i * 3];
196
+ const ly = p[i * 3 + 1];
197
+ const lz = p[i * 3 + 2];
198
+ const x = lx + (bx - lx) * c;
199
+ const y = ly + (by - ly) * c;
200
+ const z3 = lz + (bz - lz) * c;
201
+ const [px, py, z] = pt(x, y, z3);
202
+ const zx = clamp01((z + 1) / 2);
203
+ const loud = clamp01(taper);
204
+ dots.push({
205
+ x: px,
206
+ y: py,
207
+ z,
208
+ r: ((o.rBase ?? .55) + (o.rDepth ?? 1.4) * zx + (o.loudR ?? .25) * loud * c) * rs,
209
+ white: inkOf(o, zx, e[i] * m + (1 - m)) - (o.loudInk ?? .12) * loud * c
210
+ });
211
+ }
212
+ return finalizeFrame(dots, [], o.rMin);
40
213
  };
41
- const SPINNER_SVG_STYLE = {
42
- display: "block",
43
- width: SPINNER_ICON_SIZE,
44
- height: SPINNER_ICON_SIZE,
45
- color: "#111827"
214
+ const POINTS = {
215
+ n: 239,
216
+ p: Float32Array.from([
217
+ -.012,
218
+ .809,
219
+ .108,
220
+ -.03,
221
+ .718,
222
+ .23,
223
+ -.132,
224
+ .666,
225
+ .237,
226
+ -.095,
227
+ .713,
228
+ .199,
229
+ -.029,
230
+ .651,
231
+ .168,
232
+ -.11,
233
+ .61,
234
+ .163,
235
+ -.147,
236
+ .748,
237
+ .07,
238
+ -.171,
239
+ .567,
240
+ .152,
241
+ .082,
242
+ .724,
243
+ .177,
244
+ -.243,
245
+ .587,
246
+ .226,
247
+ .041,
248
+ .622,
249
+ .135,
250
+ -.307,
251
+ .658,
252
+ .1,
253
+ -.231,
254
+ .689,
255
+ .115,
256
+ .107,
257
+ .6,
258
+ .157,
259
+ -.281,
260
+ .514,
261
+ .152,
262
+ .217,
263
+ .591,
264
+ .226,
265
+ -.349,
266
+ .618,
267
+ .141,
268
+ -.095,
269
+ .778,
270
+ 0,
271
+ .037,
272
+ .77,
273
+ .135,
274
+ .179,
275
+ .673,
276
+ .191,
277
+ -.344,
278
+ .561,
279
+ .226,
280
+ .119,
281
+ .667,
282
+ .237,
283
+ .242,
284
+ .648,
285
+ .172,
286
+ .267,
287
+ .536,
288
+ .182,
289
+ -.186,
290
+ .638,
291
+ .23,
292
+ .174,
293
+ .733,
294
+ 0,
295
+ -.204,
296
+ .519,
297
+ 0,
298
+ -.417,
299
+ .603,
300
+ .1,
301
+ .294,
302
+ .589,
303
+ .223,
304
+ -.407,
305
+ .543,
306
+ .207,
307
+ .154,
308
+ .55,
309
+ .081,
310
+ .343,
311
+ .633,
312
+ .1,
313
+ .347,
314
+ .528,
315
+ .226,
316
+ .379,
317
+ .581,
318
+ .177,
319
+ .447,
320
+ .595,
321
+ .07,
322
+ .315,
323
+ .471,
324
+ .081,
325
+ .452,
326
+ .498,
327
+ .23,
328
+ -.435,
329
+ .456,
330
+ .177,
331
+ -.337,
332
+ .488,
333
+ .141,
334
+ .397,
335
+ .447,
336
+ .135,
337
+ -.519,
338
+ .556,
339
+ .081,
340
+ -.529,
341
+ .414,
342
+ .233,
343
+ .462,
344
+ .399,
345
+ .199,
346
+ -.481,
347
+ .498,
348
+ .215,
349
+ -.569,
350
+ .462,
351
+ .172,
352
+ -.482,
353
+ .377,
354
+ .223,
355
+ -.568,
356
+ .523,
357
+ .1,
358
+ -.57,
359
+ .365,
360
+ .172,
361
+ .565,
362
+ .501,
363
+ .152,
364
+ .559,
365
+ .424,
366
+ .172,
367
+ .494,
368
+ .451,
369
+ .26,
370
+ .559,
371
+ .357,
372
+ .177,
373
+ .443,
374
+ .34,
375
+ .172,
376
+ -.529,
377
+ .303,
378
+ .233,
379
+ .489,
380
+ .299,
381
+ .07,
382
+ .409,
383
+ .293,
384
+ .07,
385
+ .502,
386
+ .542,
387
+ .135,
388
+ -.58,
389
+ .26,
390
+ .157,
391
+ -.461,
392
+ .239,
393
+ .07,
394
+ .404,
395
+ .388,
396
+ .07,
397
+ -.431,
398
+ .305,
399
+ .122,
400
+ -.593,
401
+ .203,
402
+ .122,
403
+ -.612,
404
+ .308,
405
+ .07,
406
+ -.534,
407
+ .204,
408
+ .07,
409
+ -.035,
410
+ .316,
411
+ .108,
412
+ -.02,
413
+ .251,
414
+ .195,
415
+ .023,
416
+ .163,
417
+ .195,
418
+ -.104,
419
+ .232,
420
+ .191,
421
+ -.054,
422
+ .149,
423
+ .29,
424
+ -.133,
425
+ .131,
426
+ .287,
427
+ -.098,
428
+ .289,
429
+ .07,
430
+ -.16,
431
+ .219,
432
+ .163,
433
+ .054,
434
+ .219,
435
+ .07,
436
+ .025,
437
+ .077,
438
+ .244,
439
+ -.001,
440
+ 0,
441
+ .312,
442
+ -.046,
443
+ .089,
444
+ .315,
445
+ -.243,
446
+ .159,
447
+ .195,
448
+ .092,
449
+ .116,
450
+ .108,
451
+ -.05,
452
+ .03,
453
+ .29,
454
+ -.298,
455
+ .06,
456
+ .276,
457
+ -.127,
458
+ .044,
459
+ .279,
460
+ .029,
461
+ -.062,
462
+ .312,
463
+ -.101,
464
+ -.026,
465
+ .195,
466
+ .103,
467
+ .038,
468
+ .191,
469
+ -.061,
470
+ -.124,
471
+ .168,
472
+ .086,
473
+ -.03,
474
+ .29,
475
+ -.182,
476
+ .096,
477
+ .301,
478
+ .199,
479
+ .08,
480
+ .115,
481
+ -.174,
482
+ -.024,
483
+ .186,
484
+ .264,
485
+ .022,
486
+ .244,
487
+ .134,
488
+ -.082,
489
+ .312,
490
+ -.236,
491
+ .056,
492
+ .307,
493
+ -.352,
494
+ .034,
495
+ .279,
496
+ -.045,
497
+ -.045,
498
+ .244,
499
+ .214,
500
+ -.112,
501
+ .251,
502
+ -.183,
503
+ .16,
504
+ .226,
505
+ .223,
506
+ -.026,
507
+ .287,
508
+ .146,
509
+ -.164,
510
+ .223,
511
+ .327,
512
+ -.051,
513
+ .244,
514
+ .129,
515
+ -.225,
516
+ .135,
517
+ -.021,
518
+ -.173,
519
+ .191,
520
+ .16,
521
+ -.021,
522
+ .266,
523
+ .042,
524
+ -.131,
525
+ .287,
526
+ .056,
527
+ -.198,
528
+ .24,
529
+ .244,
530
+ -.184,
531
+ .1,
532
+ .006,
533
+ -.246,
534
+ .177,
535
+ -.282,
536
+ .202,
537
+ 0,
538
+ .286,
539
+ .115,
540
+ .07,
541
+ -.299,
542
+ .121,
543
+ .199,
544
+ .286,
545
+ -.129,
546
+ .163,
547
+ .347,
548
+ .031,
549
+ .263,
550
+ -.316,
551
+ -.018,
552
+ .254,
553
+ -.242,
554
+ -.093,
555
+ .07,
556
+ -.253,
557
+ -.007,
558
+ .24,
559
+ -.366,
560
+ .126,
561
+ .141,
562
+ .352,
563
+ .092,
564
+ .177,
565
+ -.217,
566
+ .227,
567
+ .07,
568
+ -.405,
569
+ .072,
570
+ .199,
571
+ -.113,
572
+ -.086,
573
+ .115,
574
+ .344,
575
+ -.131,
576
+ .108,
577
+ -.307,
578
+ -.077,
579
+ .152,
580
+ -.429,
581
+ .013,
582
+ .254,
583
+ .061,
584
+ -.29,
585
+ .07,
586
+ -.003,
587
+ -.306,
588
+ .108,
589
+ .458,
590
+ .091,
591
+ .223,
592
+ -.484,
593
+ -.028,
594
+ .276,
595
+ .263,
596
+ -.075,
597
+ .254,
598
+ .401,
599
+ .136,
600
+ .122,
601
+ .431,
602
+ -.09,
603
+ .1,
604
+ .413,
605
+ .051,
606
+ .26,
607
+ .421,
608
+ -.023,
609
+ .226,
610
+ .512,
611
+ .027,
612
+ .226,
613
+ -.481,
614
+ .06,
615
+ .152,
616
+ -.054,
617
+ -.22,
618
+ .07,
619
+ .505,
620
+ -.041,
621
+ .135,
622
+ .579,
623
+ .045,
624
+ .215,
625
+ .517,
626
+ .09,
627
+ .247,
628
+ .602,
629
+ .142,
630
+ .219,
631
+ .575,
632
+ -.032,
633
+ .07,
634
+ -.38,
635
+ -.04,
636
+ .251,
637
+ -.471,
638
+ -.091,
639
+ .203,
640
+ -.572,
641
+ .021,
642
+ .141,
643
+ -.549,
644
+ -.038,
645
+ .251,
646
+ -.38,
647
+ -.128,
648
+ .1,
649
+ .479,
650
+ .169,
651
+ .07,
652
+ -.671,
653
+ -.021,
654
+ .135,
655
+ .66,
656
+ .029,
657
+ .129,
658
+ -.433,
659
+ .126,
660
+ .07,
661
+ .692,
662
+ .087,
663
+ .191,
664
+ -.64,
665
+ -.096,
666
+ .257,
667
+ .626,
668
+ .079,
669
+ .226,
670
+ .73,
671
+ .194,
672
+ .172,
673
+ -.711,
674
+ -.176,
675
+ .172,
676
+ -.529,
677
+ -.109,
678
+ .207,
679
+ .742,
680
+ .115,
681
+ .199,
682
+ .664,
683
+ .165,
684
+ .207,
685
+ .587,
686
+ .206,
687
+ .07,
688
+ .801,
689
+ .106,
690
+ .141,
691
+ -.742,
692
+ -.055,
693
+ .129,
694
+ -.563,
695
+ -.165,
696
+ .122,
697
+ -.783,
698
+ -.161,
699
+ .135,
700
+ .54,
701
+ .143,
702
+ .186,
703
+ -.7,
704
+ -.119,
705
+ .251,
706
+ -.613,
707
+ -.039,
708
+ .211,
709
+ .761,
710
+ .059,
711
+ .07,
712
+ -.633,
713
+ -.162,
714
+ .168,
715
+ -.478,
716
+ -.153,
717
+ .07,
718
+ .806,
719
+ .173,
720
+ .081,
721
+ .861,
722
+ .131,
723
+ .07,
724
+ -.827,
725
+ -.099,
726
+ .135,
727
+ .645,
728
+ .223,
729
+ .07,
730
+ .574,
731
+ -.176,
732
+ .081,
733
+ .493,
734
+ -.215,
735
+ .07,
736
+ .565,
737
+ -.281,
738
+ .172,
739
+ .519,
740
+ -.338,
741
+ .244,
742
+ .42,
743
+ -.269,
744
+ .108,
745
+ .442,
746
+ -.356,
747
+ .172,
748
+ .502,
749
+ -.277,
750
+ .195,
751
+ .552,
752
+ -.39,
753
+ .186,
754
+ .495,
755
+ -.416,
756
+ .251,
757
+ .415,
758
+ -.422,
759
+ .135,
760
+ .601,
761
+ -.339,
762
+ .07,
763
+ .395,
764
+ -.493,
765
+ .226,
766
+ .483,
767
+ -.53,
768
+ .157,
769
+ .357,
770
+ -.59,
771
+ .157,
772
+ .531,
773
+ -.486,
774
+ .191,
775
+ .316,
776
+ -.495,
777
+ .163,
778
+ .226,
779
+ -.494,
780
+ .07,
781
+ .415,
782
+ -.55,
783
+ .186,
784
+ .358,
785
+ -.427,
786
+ .07,
787
+ .577,
788
+ -.443,
789
+ .141,
790
+ .272,
791
+ -.554,
792
+ .226,
793
+ .198,
794
+ -.593,
795
+ .23,
796
+ .104,
797
+ -.581,
798
+ .129,
799
+ .184,
800
+ -.703,
801
+ .1,
802
+ .135,
803
+ -.64,
804
+ .244,
805
+ .162,
806
+ -.532,
807
+ .081,
808
+ .119,
809
+ -.726,
810
+ .129,
811
+ .035,
812
+ -.595,
813
+ .07,
814
+ .218,
815
+ -.648,
816
+ .182,
817
+ .585,
818
+ -.519,
819
+ .07,
820
+ .015,
821
+ -.683,
822
+ .23,
823
+ .081,
824
+ -.671,
825
+ .244,
826
+ .33,
827
+ -.648,
828
+ .07,
829
+ .039,
830
+ -.75,
831
+ .157,
832
+ -.089,
833
+ -.662,
834
+ .24,
835
+ -.019,
836
+ -.757,
837
+ .177,
838
+ -.064,
839
+ -.721,
840
+ .199,
841
+ -.133,
842
+ -.701,
843
+ .172,
844
+ -.043,
845
+ -.619,
846
+ .141,
847
+ -.125,
848
+ -.575,
849
+ .141,
850
+ -.148,
851
+ -.644,
852
+ .244,
853
+ -.252,
854
+ -.662,
855
+ .135,
856
+ -.192,
857
+ -.569,
858
+ .191,
859
+ -.189,
860
+ -.715,
861
+ .1,
862
+ -.27,
863
+ -.589,
864
+ .237,
865
+ -.29,
866
+ -.512,
867
+ .177,
868
+ -.211,
869
+ -.504,
870
+ 0,
871
+ -.325,
872
+ -.608,
873
+ .163,
874
+ -.372,
875
+ -.563,
876
+ .199,
877
+ -.365,
878
+ -.491,
879
+ .199,
880
+ -.454,
881
+ -.547,
882
+ .163,
883
+ -.431,
884
+ -.48,
885
+ .223,
886
+ -.489,
887
+ -.484,
888
+ .226,
889
+ -.514,
890
+ -.407,
891
+ .254,
892
+ -.538,
893
+ -.302,
894
+ .1,
895
+ -.378,
896
+ -.429,
897
+ .081,
898
+ -.391,
899
+ -.621,
900
+ .07,
901
+ -.457,
902
+ -.301,
903
+ .141,
904
+ -.321,
905
+ -.451,
906
+ .07,
907
+ -.457,
908
+ -.426,
909
+ .191,
910
+ -.578,
911
+ -.491,
912
+ .152,
913
+ -.582,
914
+ -.37,
915
+ .141,
916
+ -.413,
917
+ -.373,
918
+ .07,
919
+ -.494,
920
+ -.353,
921
+ .219,
922
+ -.598,
923
+ -.427,
924
+ .1,
925
+ -.514,
926
+ -.542,
927
+ .115,
928
+ .27,
929
+ -.621,
930
+ .172,
931
+ -.105,
932
+ -.762,
933
+ .07
934
+ ]),
935
+ e: Float32Array.from([
936
+ .1,
937
+ .457,
938
+ .486,
939
+ .343,
940
+ .243,
941
+ .229,
942
+ .043,
943
+ .2,
944
+ .271,
945
+ .443,
946
+ .157,
947
+ .086,
948
+ .114,
949
+ .214,
950
+ .2,
951
+ .443,
952
+ .171,
953
+ 0,
954
+ .157,
955
+ .314,
956
+ .443,
957
+ .486,
958
+ .257,
959
+ .286,
960
+ .457,
961
+ 0,
962
+ 0,
963
+ .086,
964
+ .429,
965
+ .371,
966
+ .057,
967
+ .086,
968
+ .443,
969
+ .271,
970
+ .043,
971
+ .057,
972
+ .457,
973
+ .271,
974
+ .171,
975
+ .157,
976
+ .057,
977
+ .471,
978
+ .343,
979
+ .4,
980
+ .257,
981
+ .429,
982
+ .086,
983
+ .257,
984
+ .2,
985
+ .257,
986
+ .586,
987
+ .271,
988
+ .257,
989
+ .471,
990
+ .043,
991
+ .043,
992
+ .157,
993
+ .214,
994
+ .043,
995
+ .043,
996
+ .129,
997
+ .129,
998
+ .043,
999
+ .043,
1000
+ .1,
1001
+ .329,
1002
+ .329,
1003
+ .314,
1004
+ .729,
1005
+ .714,
1006
+ .043,
1007
+ .229,
1008
+ .043,
1009
+ .514,
1010
+ .843,
1011
+ .857,
1012
+ .329,
1013
+ .1,
1014
+ .729,
1015
+ .657,
1016
+ .671,
1017
+ .843,
1018
+ .329,
1019
+ .314,
1020
+ .243,
1021
+ .729,
1022
+ .786,
1023
+ .114,
1024
+ .3,
1025
+ .514,
1026
+ .843,
1027
+ .814,
1028
+ .671,
1029
+ .514,
1030
+ .543,
1031
+ .443,
1032
+ .714,
1033
+ .429,
1034
+ .514,
1035
+ .157,
1036
+ .314,
1037
+ .614,
1038
+ .714,
1039
+ .5,
1040
+ .086,
1041
+ .271,
1042
+ 0,
1043
+ .043,
1044
+ .343,
1045
+ .229,
1046
+ .6,
1047
+ .557,
1048
+ .043,
1049
+ .5,
1050
+ .171,
1051
+ .271,
1052
+ .043,
1053
+ .343,
1054
+ .114,
1055
+ .1,
1056
+ .2,
1057
+ .557,
1058
+ .043,
1059
+ .1,
1060
+ .429,
1061
+ .657,
1062
+ .557,
1063
+ .129,
1064
+ .086,
1065
+ .586,
1066
+ .443,
1067
+ .443,
1068
+ .2,
1069
+ .043,
1070
+ .157,
1071
+ .4,
1072
+ .529,
1073
+ .414,
1074
+ .043,
1075
+ .543,
1076
+ .357,
1077
+ .171,
1078
+ .543,
1079
+ .086,
1080
+ .043,
1081
+ .157,
1082
+ .143,
1083
+ .043,
1084
+ .314,
1085
+ .571,
1086
+ .443,
1087
+ .257,
1088
+ .257,
1089
+ .371,
1090
+ .343,
1091
+ .371,
1092
+ .043,
1093
+ .171,
1094
+ .143,
1095
+ .129,
1096
+ .157,
1097
+ .3,
1098
+ .543,
1099
+ .386,
1100
+ .043,
1101
+ .243,
1102
+ .043,
1103
+ .057,
1104
+ .043,
1105
+ .157,
1106
+ .043,
1107
+ .057,
1108
+ .043,
1109
+ .257,
1110
+ .514,
1111
+ .1,
1112
+ .257,
1113
+ .329,
1114
+ .3,
1115
+ .543,
1116
+ .157,
1117
+ .043,
1118
+ .443,
1119
+ .214,
1120
+ .214,
1121
+ .314,
1122
+ .229,
1123
+ .043,
1124
+ .3,
1125
+ .043,
1126
+ .171,
1127
+ .443,
1128
+ .457,
1129
+ .143,
1130
+ .086,
1131
+ .514,
1132
+ .057,
1133
+ .143,
1134
+ .043,
1135
+ .286,
1136
+ .043,
1137
+ .457,
1138
+ .514,
1139
+ .043,
1140
+ .214,
1141
+ .5,
1142
+ .271,
1143
+ .343,
1144
+ .257,
1145
+ .171,
1146
+ .171,
1147
+ .514,
1148
+ .157,
1149
+ .314,
1150
+ .086,
1151
+ .486,
1152
+ .271,
1153
+ 0,
1154
+ .229,
1155
+ .343,
1156
+ .343,
1157
+ .229,
1158
+ .429,
1159
+ .443,
1160
+ .557,
1161
+ .086,
1162
+ .057,
1163
+ .043,
1164
+ .171,
1165
+ .043,
1166
+ .314,
1167
+ .2,
1168
+ .171,
1169
+ .043,
1170
+ .414,
1171
+ .086,
1172
+ .114,
1173
+ .257,
1174
+ .043
1175
+ ])
46
1176
  };
47
- const SPINNER_KEYFRAMES_CSS = `
48
- @keyframes tradeItSdkSpin {
49
- from { transform: rotate(0deg); }
50
- to { transform: rotate(360deg); }
51
- }
52
- @media (prefers-reduced-motion: reduce) {
53
- .tradeit-sdk-spinner {
54
- animation: none !important;
55
- }
1177
+ const OPTS = {
1178
+ dwell: 1,
1179
+ morph: 1.7,
1180
+ expo: .3,
1181
+ settle: .1,
1182
+ turns: 0,
1183
+ yawAmp: .22,
1184
+ yawRate: .3,
1185
+ tilt: .42,
1186
+ rings: 9,
1187
+ height: 1.5,
1188
+ wide: .82,
1189
+ taper: .78,
1190
+ breatheRate: .75,
1191
+ breatheAmp: .2,
1192
+ spin: .16,
1193
+ loudR: .25,
1194
+ loudInk: .12,
1195
+ rBase: .55,
1196
+ rDepth: 1.4,
1197
+ inkFar: .6,
1198
+ inkSpan: .5,
1199
+ inkRim: .16,
1200
+ rsPow: .6,
1201
+ rMin: .3
1202
+ };
1203
+ function seatMap(points) {
1204
+ const n = points.n;
1205
+ const byLogo = new Uint32Array(n);
1206
+ const bySeat = new Uint32Array(n);
1207
+ const logoAng = new Float32Array(n);
1208
+ const seatAng = new Float32Array(n);
1209
+ for (let i = 0; i < n; i++) {
1210
+ byLogo[i] = i;
1211
+ bySeat[i] = i;
1212
+ logoAng[i] = Math.atan2(points.p[i * 3 + 1], points.p[i * 3]);
1213
+ const [sx, sy] = fibDir(i, n);
1214
+ seatAng[i] = Math.atan2(sy, sx);
1215
+ }
1216
+ byLogo.sort((a, b) => logoAng[a] - logoAng[b]);
1217
+ bySeat.sort((a, b) => seatAng[a] - seatAng[b]);
1218
+ const seats = new Uint32Array(n);
1219
+ for (let k = 0; k < n; k++) seats[byLogo[k]] = bySeat[k];
1220
+ return seats;
56
1221
  }
57
- `;
58
- function LoaderCircleSpinner() {
59
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("style", { children: SPINNER_KEYFRAMES_CSS }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
60
- className: "tradeit-sdk-spinner",
61
- style: SPINNER_WRAPPER_STYLE,
1222
+ const BINDING = {
1223
+ points: POINTS,
1224
+ seats: seatMap(POINTS)
1225
+ };
1226
+ function TradeItLogoLoader({ size = 120 }) {
1227
+ const ref = (0, react.useRef)(null);
1228
+ (0, react.useEffect)(() => {
1229
+ const canvas = ref.current;
1230
+ if (!canvas) return;
1231
+ const dpr = Math.min(2, devicePixelRatio || 1);
1232
+ canvas.width = Math.round(size * dpr);
1233
+ canvas.height = Math.round(size * dpr);
1234
+ const ctx = canvas.getContext("2d");
1235
+ if (!ctx) return;
1236
+ const render = (t) => {
1237
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
1238
+ ctx.clearRect(0, 0, size, size);
1239
+ const frame = frameLogoWait(size, t, OPTS, BINDING);
1240
+ paintFrame(ctx, frame);
1241
+ };
1242
+ if (matchMedia("(prefers-reduced-motion: reduce)").matches) {
1243
+ render(2.7);
1244
+ return;
1245
+ }
1246
+ let raf = 0;
1247
+ let running = false;
1248
+ const startedAt = performance.now();
1249
+ const loop = (now) => {
1250
+ render((now - startedAt) / 1e3);
1251
+ if (running) raf = requestAnimationFrame(loop);
1252
+ };
1253
+ const start = () => {
1254
+ if (running) return;
1255
+ running = true;
1256
+ raf = requestAnimationFrame(loop);
1257
+ };
1258
+ const stop = () => {
1259
+ running = false;
1260
+ cancelAnimationFrame(raf);
1261
+ };
1262
+ render(0);
1263
+ let visible = true;
1264
+ const io = new IntersectionObserver(([entry]) => {
1265
+ visible = entry.isIntersecting;
1266
+ if (visible && document.visibilityState !== "hidden") start();
1267
+ else stop();
1268
+ });
1269
+ io.observe(canvas);
1270
+ const onVis = () => {
1271
+ if (document.visibilityState === "hidden") stop();
1272
+ else if (visible) start();
1273
+ };
1274
+ document.addEventListener("visibilitychange", onVis);
1275
+ return () => {
1276
+ stop();
1277
+ io.disconnect();
1278
+ document.removeEventListener("visibilitychange", onVis);
1279
+ };
1280
+ }, [size]);
1281
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("canvas", {
1282
+ ref,
62
1283
  "aria-hidden": "true",
63
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
64
- xmlns: "http://www.w3.org/2000/svg",
65
- width: SPINNER_ICON_SIZE,
66
- height: SPINNER_ICON_SIZE,
67
- viewBox: "0 0 24 24",
68
- fill: "none",
69
- stroke: "currentColor",
70
- strokeWidth: "2",
71
- strokeLinecap: "round",
72
- strokeLinejoin: "round",
73
- style: SPINNER_SVG_STYLE,
74
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
75
- })
76
- })] });
1284
+ style: {
1285
+ width: size,
1286
+ height: size,
1287
+ display: "block"
1288
+ }
1289
+ });
77
1290
  }
78
1291
 
79
1292
  //#endregion
@@ -100,7 +1313,7 @@ function TradeItModalLoader() {
100
1313
  "aria-busy": "true",
101
1314
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
102
1315
  style: LOADING_CONTENT_STYLE,
103
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LoaderCircleSpinner, {})
1316
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TradeItLogoLoader, {})
104
1317
  })
105
1318
  });
106
1319
  }
@@ -121,16 +1334,22 @@ const DIALOG_DESKTOP_STYLE = {
121
1334
  position: "relative",
122
1335
  width: "min(960px, calc(100vw - 24px))",
123
1336
  height: "min(760px, calc(100vh - 24px))",
1337
+ boxSizing: "border-box",
124
1338
  background: "#fff",
125
1339
  borderRadius: 18,
126
1340
  boxShadow: "0 24px 80px rgba(2, 6, 23, 0.28)",
127
1341
  border: "1px solid rgba(148, 163, 184, 0.35)",
128
1342
  overflow: "hidden"
129
1343
  };
1344
+ const CONNECT_DIALOG_DESKTOP_STYLE = {
1345
+ ...DIALOG_DESKTOP_STYLE,
1346
+ width: "min(736px, 100%)",
1347
+ height: "min(835px, 100%)"
1348
+ };
130
1349
  const DIALOG_MOBILE_STYLE = {
131
1350
  ...DIALOG_DESKTOP_STYLE,
132
- width: "100vw",
133
- height: "100vh",
1351
+ width: "100%",
1352
+ height: "100%",
134
1353
  borderRadius: 0,
135
1354
  border: 0
136
1355
  };
@@ -142,9 +1361,12 @@ const CLOSE_BUTTON_STYLE = {
142
1361
  width: 34,
143
1362
  height: 34,
144
1363
  borderRadius: 999,
145
- border: "1px solid rgba(148,163,184,0.45)",
146
- background: "rgba(255,255,255,0.92)",
147
- color: "#0f172a",
1364
+ border: "1px solid rgba(255, 255, 255, 0.22)",
1365
+ background: "rgba(9, 11, 12, 0.64)",
1366
+ color: "#f0f0f2",
1367
+ backdropFilter: "blur(16px)",
1368
+ WebkitBackdropFilter: "blur(16px)",
1369
+ boxShadow: "0 8px 24px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12)",
148
1370
  cursor: "pointer",
149
1371
  fontSize: 18,
150
1372
  lineHeight: "32px",
@@ -246,9 +1468,16 @@ function TradeItModal(props) {
246
1468
  if (!isMounted) return null;
247
1469
  if (!open && !keepMounted) return null;
248
1470
  if (!resolved.url) return null;
249
- const dialogStyle = isMobile ? DIALOG_MOBILE_STYLE : DIALOG_DESKTOP_STYLE;
1471
+ const isConnectFlow = props.launch.mode === "connect";
1472
+ let dialogStyle = DIALOG_DESKTOP_STYLE;
1473
+ if (isMobile) dialogStyle = DIALOG_MOBILE_STYLE;
1474
+ else if (isConnectFlow) dialogStyle = CONNECT_DIALOG_DESKTOP_STYLE;
1475
+ let overlayPadding = 12;
1476
+ if (isMobile) overlayPadding = 0;
1477
+ else if (isConnectFlow) overlayPadding = "0 4px";
250
1478
  const overlayStyle = {
251
1479
  ...OVERLAY_STYLE,
1480
+ padding: overlayPadding,
252
1481
  zIndex
253
1482
  };
254
1483
  const dialogLabel = title ?? iframeTitle ?? "Trade It";
@@ -372,6 +1601,7 @@ let OrderType = /* @__PURE__ */ function(OrderType$1) {
372
1601
  let OrderDirection = /* @__PURE__ */ function(OrderDirection$1) {
373
1602
  OrderDirection$1["Debit"] = "debit";
374
1603
  OrderDirection$1["Credit"] = "credit";
1604
+ OrderDirection$1["Even"] = "even";
375
1605
  return OrderDirection$1;
376
1606
  }({});
377
1607
  let TimeInForce = /* @__PURE__ */ function(TimeInForce$1) {
@@ -386,6 +1616,14 @@ let TradeUnit = /* @__PURE__ */ function(TradeUnit$1) {
386
1616
  TradeUnit$1["Shares"] = "shares";
387
1617
  return TradeUnit$1;
388
1618
  }({});
1619
+ /** How an exit trigger (take-profit / stop-loss) value is expressed */
1620
+ let TriggerUnit = /* @__PURE__ */ function(TriggerUnit$1) {
1621
+ /** An absolute price level */
1622
+ TriggerUnit$1["Price"] = "$";
1623
+ /** A percentage offset from the entry price */
1624
+ TriggerUnit$1["Percent"] = "%";
1625
+ return TriggerUnit$1;
1626
+ }({});
389
1627
  let LegType = /* @__PURE__ */ function(LegType$1) {
390
1628
  LegType$1["Option"] = "option";
391
1629
  LegType$1["Equity"] = "equity";
@@ -397,25 +1635,6 @@ let TradeType = /* @__PURE__ */ function(TradeType$1) {
397
1635
  return TradeType$1;
398
1636
  }({});
399
1637
 
400
- //#endregion
401
- //#region ../../lib/types/src/types/trade-link.types.ts
402
- /**
403
- * Short query parameter keys for trade link URLs
404
- */
405
- let TradeLinkParam = /* @__PURE__ */ function(TradeLinkParam$1) {
406
- TradeLinkParam$1["TradeType"] = "tt";
407
- TradeLinkParam$1["Action"] = "t";
408
- TradeLinkParam$1["OrderType"] = "ot";
409
- TradeLinkParam$1["Amount"] = "a";
410
- TradeLinkParam$1["Unit"] = "u";
411
- TradeLinkParam$1["LimitPrice"] = "lp";
412
- TradeLinkParam$1["StopPrice"] = "sp";
413
- TradeLinkParam$1["TimeInForce"] = "tif";
414
- TradeLinkParam$1["UtmReferred"] = "ref";
415
- TradeLinkParam$1["Legs"] = "legs";
416
- return TradeLinkParam$1;
417
- }({});
418
-
419
1638
  //#endregion
420
1639
  exports.LegType = LegType;
421
1640
  exports.OrderDirection = OrderDirection;
@@ -424,9 +1643,15 @@ exports.PositionEffect = PositionEffect;
424
1643
  exports.TimeInForce = TimeInForce;
425
1644
  exports.TradeAction = TradeAction;
426
1645
  exports.TradeItModal = TradeItModal;
427
- exports.TradeLinkParam = TradeLinkParam;
1646
+ Object.defineProperty(exports, 'TradeLinkParam', {
1647
+ enumerable: true,
1648
+ get: function () {
1649
+ return __trade_it_core.TradeLinkParam;
1650
+ }
1651
+ });
428
1652
  exports.TradeType = TradeType;
429
1653
  exports.TradeUnit = TradeUnit;
1654
+ exports.TriggerUnit = TriggerUnit;
430
1655
  Object.defineProperty(exports, 'getTradeItErrorMessage', {
431
1656
  enumerable: true,
432
1657
  get: function () {