@dstackai/sqircle 0.1.0 → 0.1.2
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/README.md +174 -17
- package/dist/SquircleEditor.d.ts +5 -2
- package/dist/codeExport.d.ts +4 -2
- package/dist/index.d.ts +3 -2
- package/dist/palettes.d.ts +1 -0
- package/dist/sqircle.js +1295 -374
- package/dist/sqircle.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +2 -0
- package/docs/README.md +12 -7
- package/docs/design/README.md +2 -1
- package/docs/design/colors.md +23 -33
- package/docs/design/geometry.md +14 -13
- package/docs/design/rendering.md +72 -19
- package/docs/design/single-squircle-states.md +47 -109
- package/docs/examples/README.md +33 -0
- package/docs/react/README.md +106 -62
- package/docs/react/editor.md +162 -0
- package/package.json +3 -2
package/dist/sqircle.js
CHANGED
|
@@ -14,7 +14,7 @@ function c(e = {}) {
|
|
|
14
14
|
let t = e.exponent ?? s.exponent, n = e.samples ?? s.samples, r = e.width ?? s.width, i = e.viewBoxHeight ?? s.viewBoxHeight, a = e.prismHeight ?? s.prismHeight, o = e.angleDegrees ?? s.angleDegrees, c = e.inlayScale ?? s.inlayScale, l = o * Math.PI / 180, u = Math.cos(l), d = Math.sin(l), p = f(1, t, n).map((e) => (e.x - e.y) * u), b = Math.max(...p) - Math.min(...p), x = e.halfSize ?? r / b, S = f(x, t, n), C = S.map((e) => (e.x - e.y) * u), w = S.map((e) => (e.x + e.y) * d), T = e.center ?? {
|
|
15
15
|
x: -Math.min(...C),
|
|
16
16
|
y: a - Math.min(...w)
|
|
17
|
-
}, E = S.map((e) => m(e, a, T, u, d)), D = S.map((e) => m(e, 0, T, u, d)), O = h(S.map((e) => e.nx + e.ny >= 0)),
|
|
17
|
+
}, E = S.map((e) => m(e, a, T, u, d)), D = S.map((e) => m(e, 0, T, u, d)), O = h(S.map((e) => e.nx + e.ny >= 0)), ee = g(O, n), te = _(E, O), ne = _(D, O).reverse(), k = [...te, ...ne], A = _(D, ee), j = f(x * c, t, n).map((e) => m(e, a, T, u, d)), re = v(E), M = v([...E, ...k]);
|
|
18
18
|
return {
|
|
19
19
|
config: {
|
|
20
20
|
width: r,
|
|
@@ -31,12 +31,12 @@ function c(e = {}) {
|
|
|
31
31
|
sinA: d,
|
|
32
32
|
topPoints: E,
|
|
33
33
|
bottomPoints: D,
|
|
34
|
-
wallPoints:
|
|
35
|
-
hiddenPoints:
|
|
36
|
-
inlayPoints:
|
|
34
|
+
wallPoints: k,
|
|
35
|
+
hiddenPoints: A,
|
|
36
|
+
inlayPoints: j,
|
|
37
37
|
labelTransform: `matrix(${y(u)},${y(d)},${y(-u)},${y(d)},${y(T.x)},${y(T.y - a)})`,
|
|
38
|
-
topBounds:
|
|
39
|
-
sideBounds:
|
|
38
|
+
topBounds: re,
|
|
39
|
+
sideBounds: M,
|
|
40
40
|
viewBox: `0 0 ${y(r)} ${y(i)}`
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -550,9 +550,12 @@ var b = {
|
|
|
550
550
|
function C(e) {
|
|
551
551
|
return b[e] ?? b[15];
|
|
552
552
|
}
|
|
553
|
+
function w(e) {
|
|
554
|
+
return !!(e && e in b);
|
|
555
|
+
}
|
|
553
556
|
//#endregion
|
|
554
557
|
//#region src/squircle/SquircleScene.tsx
|
|
555
|
-
var
|
|
558
|
+
var T = {
|
|
556
559
|
face: .35,
|
|
557
560
|
faceOpacity: .72,
|
|
558
561
|
wire: 1.6,
|
|
@@ -562,16 +565,239 @@ var w = {
|
|
|
562
565
|
dash: 2.2,
|
|
563
566
|
wireDash: 1.6,
|
|
564
567
|
labelWire: 1.1
|
|
565
|
-
},
|
|
568
|
+
}, E = {
|
|
566
569
|
transparentFace: .38,
|
|
567
570
|
transparentAnnotation: .62,
|
|
568
571
|
solidAnnotation: .88
|
|
569
|
-
},
|
|
570
|
-
|
|
572
|
+
}, D = "GPU", O = 62, ee = "Arial, Helvetica, sans-serif", te = 400, ne = "off", k = [
|
|
573
|
+
{
|
|
574
|
+
x: -1.12,
|
|
575
|
+
y: -1.04,
|
|
576
|
+
r: .48,
|
|
577
|
+
slot: 0,
|
|
578
|
+
i: 0,
|
|
579
|
+
sp: .95,
|
|
580
|
+
ax: .23,
|
|
581
|
+
ay: .21,
|
|
582
|
+
ar: .018
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
x: -.58,
|
|
586
|
+
y: -.7,
|
|
587
|
+
r: .49,
|
|
588
|
+
slot: 1,
|
|
589
|
+
i: 1,
|
|
590
|
+
sp: 1.1,
|
|
591
|
+
ax: .24,
|
|
592
|
+
ay: .2,
|
|
593
|
+
ar: .018
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
x: -.1,
|
|
597
|
+
y: -.16,
|
|
598
|
+
r: .47,
|
|
599
|
+
slot: 2,
|
|
600
|
+
i: 2,
|
|
601
|
+
sp: .9,
|
|
602
|
+
ax: .22,
|
|
603
|
+
ay: .23,
|
|
604
|
+
ar: .016
|
|
605
|
+
},
|
|
606
|
+
{
|
|
607
|
+
x: .46,
|
|
608
|
+
y: -.72,
|
|
609
|
+
r: .48,
|
|
610
|
+
slot: 3,
|
|
611
|
+
i: 3,
|
|
612
|
+
sp: 1.2,
|
|
613
|
+
ax: .23,
|
|
614
|
+
ay: .21,
|
|
615
|
+
ar: .018
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
x: 1.02,
|
|
619
|
+
y: -.18,
|
|
620
|
+
r: .46,
|
|
621
|
+
slot: 4,
|
|
622
|
+
i: 4,
|
|
623
|
+
sp: 1.05,
|
|
624
|
+
ax: .22,
|
|
625
|
+
ay: .23,
|
|
626
|
+
ar: .016
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
x: 1.18,
|
|
630
|
+
y: .58,
|
|
631
|
+
r: .48,
|
|
632
|
+
slot: 2,
|
|
633
|
+
i: 5,
|
|
634
|
+
sp: .85,
|
|
635
|
+
ax: .24,
|
|
636
|
+
ay: .21,
|
|
637
|
+
ar: .018
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
x: .42,
|
|
641
|
+
y: 1.08,
|
|
642
|
+
r: .47,
|
|
643
|
+
slot: 1,
|
|
644
|
+
i: 6,
|
|
645
|
+
sp: 1.3,
|
|
646
|
+
ax: .23,
|
|
647
|
+
ay: .24,
|
|
648
|
+
ar: .016
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
x: -.54,
|
|
652
|
+
y: 1.14,
|
|
653
|
+
r: .48,
|
|
654
|
+
slot: 3,
|
|
655
|
+
i: 7,
|
|
656
|
+
sp: 1,
|
|
657
|
+
ax: .24,
|
|
658
|
+
ay: .22,
|
|
659
|
+
ar: .018
|
|
660
|
+
}
|
|
661
|
+
], A = [
|
|
662
|
+
{
|
|
663
|
+
x: -.82,
|
|
664
|
+
y: -.44,
|
|
665
|
+
r: .48,
|
|
666
|
+
slot: 0,
|
|
667
|
+
i: 8,
|
|
668
|
+
sp: 1.7,
|
|
669
|
+
ax: .25,
|
|
670
|
+
ay: .23,
|
|
671
|
+
ar: .016
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
x: -.2,
|
|
675
|
+
y: -1.08,
|
|
676
|
+
r: .47,
|
|
677
|
+
slot: 1,
|
|
678
|
+
i: 9,
|
|
679
|
+
sp: 1.45,
|
|
680
|
+
ax: .24,
|
|
681
|
+
ay: .22,
|
|
682
|
+
ar: .016
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
x: .66,
|
|
686
|
+
y: 0,
|
|
687
|
+
r: .49,
|
|
688
|
+
slot: 0,
|
|
689
|
+
i: 10,
|
|
690
|
+
sp: 2,
|
|
691
|
+
ax: .23,
|
|
692
|
+
ay: .25,
|
|
693
|
+
ar: .016
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
x: 1.12,
|
|
697
|
+
y: .94,
|
|
698
|
+
r: .47,
|
|
699
|
+
slot: 1,
|
|
700
|
+
i: 11,
|
|
701
|
+
sp: 1.6,
|
|
702
|
+
ax: .25,
|
|
703
|
+
ay: .23,
|
|
704
|
+
ar: .016
|
|
705
|
+
}
|
|
706
|
+
], j = [
|
|
707
|
+
{
|
|
708
|
+
x: -1.08,
|
|
709
|
+
y: -.96,
|
|
710
|
+
r: .47,
|
|
711
|
+
slot: 0,
|
|
712
|
+
i: 12,
|
|
713
|
+
sp: .75,
|
|
714
|
+
ax: .2,
|
|
715
|
+
ay: .19,
|
|
716
|
+
ar: .016
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
x: -.56,
|
|
720
|
+
y: -.46,
|
|
721
|
+
r: .49,
|
|
722
|
+
slot: 1,
|
|
723
|
+
i: 13,
|
|
724
|
+
sp: .9,
|
|
725
|
+
ax: .21,
|
|
726
|
+
ay: .2,
|
|
727
|
+
ar: .016
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
x: .02,
|
|
731
|
+
y: .02,
|
|
732
|
+
r: .47,
|
|
733
|
+
slot: 2,
|
|
734
|
+
i: 14,
|
|
735
|
+
sp: .8,
|
|
736
|
+
ax: .2,
|
|
737
|
+
ay: .21,
|
|
738
|
+
ar: .016
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
x: .64,
|
|
742
|
+
y: -.6,
|
|
743
|
+
r: .48,
|
|
744
|
+
slot: 3,
|
|
745
|
+
i: 15,
|
|
746
|
+
sp: 1,
|
|
747
|
+
ax: .21,
|
|
748
|
+
ay: .19,
|
|
749
|
+
ar: .016
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
x: 1.12,
|
|
753
|
+
y: .2,
|
|
754
|
+
r: .46,
|
|
755
|
+
slot: 1,
|
|
756
|
+
i: 16,
|
|
757
|
+
sp: .85,
|
|
758
|
+
ax: .2,
|
|
759
|
+
ay: .21,
|
|
760
|
+
ar: .016
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
x: .74,
|
|
764
|
+
y: 1.08,
|
|
765
|
+
r: .49,
|
|
766
|
+
slot: 2,
|
|
767
|
+
i: 17,
|
|
768
|
+
sp: .95,
|
|
769
|
+
ax: .21,
|
|
770
|
+
ay: .2,
|
|
771
|
+
ar: .016
|
|
772
|
+
},
|
|
773
|
+
{
|
|
774
|
+
x: -.14,
|
|
775
|
+
y: 1.16,
|
|
776
|
+
r: .47,
|
|
777
|
+
slot: 0,
|
|
778
|
+
i: 18,
|
|
779
|
+
sp: .82,
|
|
780
|
+
ax: .2,
|
|
781
|
+
ay: .21,
|
|
782
|
+
ar: .016
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
x: -1.04,
|
|
786
|
+
y: .58,
|
|
787
|
+
r: .48,
|
|
788
|
+
slot: 3,
|
|
789
|
+
i: 19,
|
|
790
|
+
sp: 1.05,
|
|
791
|
+
ax: .21,
|
|
792
|
+
ay: .2,
|
|
793
|
+
ar: .016
|
|
794
|
+
}
|
|
795
|
+
];
|
|
796
|
+
function re({ layers: e, geometry: r, selectedLayerId: i, theme: s = "light", idPrefix: l, className: u, ariaLabel: d = "Squircle scene", fitToLayers: f = !0, transitionMs: p = 220, onLayerSelect: m }) {
|
|
571
797
|
let h = t().replace(/[^a-zA-Z0-9_-]/g, ""), g = l ?? `sq-${h}`, _ = n(() => c(r), [JSON.stringify(r ?? {})]), v = e.filter((e) => e.visible !== !1), y = Math.max(0, ...v.map((e) => e.offset?.y ?? 0)), b = r?.viewBoxHeight ?? (f ? Math.max(_.config.viewBoxHeight, y + _.sideBounds.maxY + 18) : _.config.viewBoxHeight), x = r?.viewBoxHeight === b ? _ : c({
|
|
572
798
|
...r,
|
|
573
799
|
viewBoxHeight: b
|
|
574
|
-
}), S = { "--sq-transition-ms": `${p}ms` };
|
|
800
|
+
}), S = { "--sq-transition-ms": `${p}ms` }, C = se(v.some(ce));
|
|
575
801
|
return /* @__PURE__ */ o("svg", {
|
|
576
802
|
className: [
|
|
577
803
|
"squircle-scene",
|
|
@@ -583,55 +809,94 @@ function A({ layers: e, geometry: r, selectedLayerId: i, theme: s = "light", idP
|
|
|
583
809
|
role: "img",
|
|
584
810
|
"aria-label": d,
|
|
585
811
|
style: S,
|
|
586
|
-
children: [/* @__PURE__ */ a(
|
|
812
|
+
children: [/* @__PURE__ */ a(M, {
|
|
587
813
|
prefix: g,
|
|
588
814
|
geometry: x
|
|
589
|
-
}), v.map((e) => /* @__PURE__ */ a(
|
|
815
|
+
}), v.map((e) => /* @__PURE__ */ a(ie, {
|
|
590
816
|
layer: e,
|
|
591
817
|
geometry: x,
|
|
592
818
|
prefix: g,
|
|
819
|
+
motionTime: C,
|
|
593
820
|
selected: i === e.id,
|
|
594
821
|
onSelect: m
|
|
595
822
|
}, e.id))]
|
|
596
823
|
});
|
|
597
824
|
}
|
|
598
|
-
function
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
y2: t.topBounds.maxY,
|
|
606
|
-
stops: n.top
|
|
825
|
+
function M({ prefix: e, geometry: t }) {
|
|
826
|
+
let n = l(t.topPoints), r = J(t.config.halfSize * 2 * .13), i = J(t.config.halfSize * 3.6), s = i * 2;
|
|
827
|
+
return /* @__PURE__ */ o("defs", { children: [
|
|
828
|
+
/* @__PURE__ */ a("clipPath", {
|
|
829
|
+
id: `${e}-top-clip`,
|
|
830
|
+
clipPathUnits: "userSpaceOnUse",
|
|
831
|
+
children: /* @__PURE__ */ a("polygon", { points: n })
|
|
607
832
|
}),
|
|
608
|
-
/* @__PURE__ */ a(
|
|
609
|
-
id: `${e}-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
833
|
+
/* @__PURE__ */ a("filter", {
|
|
834
|
+
id: `${e}-fluid-main-blur`,
|
|
835
|
+
filterUnits: "userSpaceOnUse",
|
|
836
|
+
primitiveUnits: "userSpaceOnUse",
|
|
837
|
+
x: -i,
|
|
838
|
+
y: -i,
|
|
839
|
+
width: s,
|
|
840
|
+
height: s,
|
|
841
|
+
children: /* @__PURE__ */ a("feGaussianBlur", { stdDeviation: r })
|
|
615
842
|
}),
|
|
616
|
-
/* @__PURE__ */ a(
|
|
617
|
-
id: `${e}-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
843
|
+
/* @__PURE__ */ a("filter", {
|
|
844
|
+
id: `${e}-fluid-light-blur`,
|
|
845
|
+
filterUnits: "userSpaceOnUse",
|
|
846
|
+
primitiveUnits: "userSpaceOnUse",
|
|
847
|
+
x: -i,
|
|
848
|
+
y: -i,
|
|
849
|
+
width: s,
|
|
850
|
+
height: s,
|
|
851
|
+
children: /* @__PURE__ */ a("feGaussianBlur", { stdDeviation: r })
|
|
623
852
|
}),
|
|
624
|
-
/* @__PURE__ */ a(
|
|
625
|
-
id: `${e}-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
853
|
+
/* @__PURE__ */ a("filter", {
|
|
854
|
+
id: `${e}-frosted-blur`,
|
|
855
|
+
filterUnits: "userSpaceOnUse",
|
|
856
|
+
primitiveUnits: "userSpaceOnUse",
|
|
857
|
+
x: -i,
|
|
858
|
+
y: -i,
|
|
859
|
+
width: s,
|
|
860
|
+
height: s,
|
|
861
|
+
children: /* @__PURE__ */ a("feGaussianBlur", { stdDeviation: r })
|
|
862
|
+
}),
|
|
863
|
+
Object.values(b).map((n) => /* @__PURE__ */ o("g", { children: [
|
|
864
|
+
/* @__PURE__ */ a(N, {
|
|
865
|
+
id: `${e}-top-${n.id}`,
|
|
866
|
+
x1: t.topBounds.minX,
|
|
867
|
+
y1: t.topBounds.minY,
|
|
868
|
+
x2: t.topBounds.maxX,
|
|
869
|
+
y2: t.topBounds.maxY,
|
|
870
|
+
stops: n.top
|
|
871
|
+
}),
|
|
872
|
+
/* @__PURE__ */ a(N, {
|
|
873
|
+
id: `${e}-side-${n.id}`,
|
|
874
|
+
x1: t.sideBounds.minX,
|
|
875
|
+
y1: t.sideBounds.minY,
|
|
876
|
+
x2: t.sideBounds.maxX,
|
|
877
|
+
y2: t.sideBounds.maxY,
|
|
878
|
+
stops: n.side
|
|
879
|
+
}),
|
|
880
|
+
/* @__PURE__ */ a(N, {
|
|
881
|
+
id: `${e}-text-surface-${n.id}`,
|
|
882
|
+
x1: -425.63,
|
|
883
|
+
y1: -.1,
|
|
884
|
+
x2: 425.6,
|
|
885
|
+
y2: .07,
|
|
886
|
+
stops: n.top
|
|
887
|
+
}),
|
|
888
|
+
/* @__PURE__ */ a(N, {
|
|
889
|
+
id: `${e}-text-wire-${n.id}`,
|
|
890
|
+
x1: -64,
|
|
891
|
+
y1: -24,
|
|
892
|
+
x2: 64,
|
|
893
|
+
y2: 24,
|
|
894
|
+
stops: n.textWire
|
|
895
|
+
})
|
|
896
|
+
] }, n.id))
|
|
897
|
+
] });
|
|
633
898
|
}
|
|
634
|
-
function
|
|
899
|
+
function N({ id: e, x1: t, y1: n, x2: r, y2: i, stops: o }) {
|
|
635
900
|
return /* @__PURE__ */ a("linearGradient", {
|
|
636
901
|
id: e,
|
|
637
902
|
x1: t,
|
|
@@ -645,37 +910,39 @@ function M({ id: e, x1: t, y1: n, x2: r, y2: i, stops: o }) {
|
|
|
645
910
|
}, `${e.offset}-${e.color}`))
|
|
646
911
|
});
|
|
647
912
|
}
|
|
648
|
-
function
|
|
649
|
-
let
|
|
913
|
+
function ie({ layer: e, geometry: t, prefix: n, motionTime: r, selected: i, onSelect: s }) {
|
|
914
|
+
let c = L(e.base, e.stroke, e.opacity), l = e.hover ? L({
|
|
650
915
|
...e.base,
|
|
651
916
|
...e.hover
|
|
652
|
-
}, e.stroke, e.opacity) : null,
|
|
917
|
+
}, e.stroke, e.opacity) : null, u = !!(l && K(l) !== K(c)), d = e.offset?.x ?? 0, f = e.offset?.y ?? 0;
|
|
653
918
|
return /* @__PURE__ */ o("g", {
|
|
654
919
|
className: [
|
|
655
920
|
"sq-layer",
|
|
656
|
-
|
|
657
|
-
|
|
921
|
+
u ? "sq-has-hover" : "",
|
|
922
|
+
i ? "is-selected" : "",
|
|
658
923
|
e.className
|
|
659
924
|
].filter(Boolean).join(" "),
|
|
660
925
|
"data-layer-id": e.id,
|
|
661
|
-
"data-hover-enabled": String(
|
|
662
|
-
transform: `translate(${
|
|
663
|
-
onClick:
|
|
926
|
+
"data-hover-enabled": String(u),
|
|
927
|
+
transform: `translate(${d} ${f})`,
|
|
928
|
+
onClick: s ? () => s(e.id) : void 0,
|
|
664
929
|
children: [/* @__PURE__ */ a(P, {
|
|
665
930
|
className: "sq-base",
|
|
666
|
-
variant:
|
|
931
|
+
variant: c,
|
|
667
932
|
geometry: t,
|
|
668
|
-
prefix: n
|
|
669
|
-
|
|
933
|
+
prefix: n,
|
|
934
|
+
motionTime: r
|
|
935
|
+
}), u && l ? /* @__PURE__ */ a(P, {
|
|
670
936
|
className: "sq-hover",
|
|
671
|
-
variant:
|
|
937
|
+
variant: l,
|
|
672
938
|
geometry: t,
|
|
673
|
-
prefix: n
|
|
939
|
+
prefix: n,
|
|
940
|
+
motionTime: r
|
|
674
941
|
}) : null]
|
|
675
942
|
});
|
|
676
943
|
}
|
|
677
|
-
function P({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
678
|
-
let
|
|
944
|
+
function P({ className: e, variant: t, geometry: n, prefix: r, motionTime: s }) {
|
|
945
|
+
let c = le(t.paletteId), u = `url(#${r}-top-${c.id})`, d = `url(#${r}-side-${c.id})`, f = `url(#${r}-text-surface-${c.id})`, p = `url(#${r}-text-wire-${c.id})`, m = l(n.wallPoints), h = l(n.topPoints), g = l(n.hiddenPoints), _ = l(n.inlayPoints), v = `${r}-top-clip`;
|
|
679
946
|
return /* @__PURE__ */ o("g", {
|
|
680
947
|
className: [
|
|
681
948
|
"sq-variant",
|
|
@@ -686,50 +953,51 @@ function P({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
|
686
953
|
t.material === "wireframe" ? /* @__PURE__ */ o(i, { children: [
|
|
687
954
|
/* @__PURE__ */ a("polyline", {
|
|
688
955
|
className: "sq-hidden",
|
|
689
|
-
points:
|
|
690
|
-
stroke:
|
|
956
|
+
points: g,
|
|
957
|
+
stroke: u,
|
|
691
958
|
strokeWidth: t.stroke.hidden,
|
|
692
959
|
opacity: t.stroke.hiddenOpacity
|
|
693
960
|
}),
|
|
694
961
|
/* @__PURE__ */ a("polygon", {
|
|
695
962
|
className: "sq-face sq-wire-side",
|
|
696
|
-
points:
|
|
963
|
+
points: m,
|
|
697
964
|
fill: "none",
|
|
698
|
-
stroke:
|
|
965
|
+
stroke: u,
|
|
699
966
|
strokeWidth: t.stroke.wire,
|
|
700
967
|
strokeOpacity: t.stroke.wireOpacity
|
|
701
968
|
}),
|
|
702
969
|
/* @__PURE__ */ a("polygon", {
|
|
703
970
|
className: "sq-face sq-wire-top",
|
|
704
|
-
points:
|
|
971
|
+
points: h,
|
|
705
972
|
fill: "none",
|
|
706
|
-
stroke:
|
|
973
|
+
stroke: u,
|
|
707
974
|
strokeWidth: t.stroke.wire,
|
|
708
975
|
strokeOpacity: t.stroke.wireOpacity
|
|
709
976
|
})
|
|
710
977
|
] }) : /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("polygon", {
|
|
711
978
|
className: "sq-face sq-solid-side",
|
|
712
|
-
points: p,
|
|
713
|
-
fill: u,
|
|
714
|
-
fillOpacity: t.material === "transparent" ? t.opacity.transparentFace : 1,
|
|
715
|
-
stroke: s.sideEdge,
|
|
716
|
-
strokeWidth: t.stroke.face,
|
|
717
|
-
strokeOpacity: t.stroke.faceOpacity
|
|
718
|
-
}), /* @__PURE__ */ a("polygon", {
|
|
719
|
-
className: "sq-face sq-solid-top",
|
|
720
979
|
points: m,
|
|
721
|
-
fill:
|
|
980
|
+
fill: d,
|
|
722
981
|
fillOpacity: t.material === "transparent" ? t.opacity.transparentFace : 1,
|
|
723
|
-
stroke:
|
|
982
|
+
stroke: c.sideEdge,
|
|
724
983
|
strokeWidth: t.stroke.face,
|
|
725
984
|
strokeOpacity: t.stroke.faceOpacity
|
|
985
|
+
}), /* @__PURE__ */ a(F, {
|
|
986
|
+
variant: t,
|
|
987
|
+
palette: c,
|
|
988
|
+
geometry: n,
|
|
989
|
+
prefix: r,
|
|
990
|
+
topClipId: v,
|
|
991
|
+
topFill: u,
|
|
992
|
+
topPoints: h,
|
|
993
|
+
motionTime: s
|
|
726
994
|
})] }),
|
|
727
995
|
t.dash ? /* @__PURE__ */ a("polygon", {
|
|
728
996
|
className: "sq-inlay",
|
|
729
|
-
points:
|
|
730
|
-
stroke:
|
|
997
|
+
points: _,
|
|
998
|
+
stroke: U(t, c, u),
|
|
731
999
|
strokeWidth: t.material === "wireframe" ? t.stroke.wireDash : t.stroke.dash,
|
|
732
|
-
opacity:
|
|
1000
|
+
opacity: W(t)
|
|
733
1001
|
}) : null,
|
|
734
1002
|
t.text ? /* @__PURE__ */ a("text", {
|
|
735
1003
|
className: "sq-label",
|
|
@@ -739,60 +1007,177 @@ function P({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
|
739
1007
|
fontFamily: t.textFontFamily,
|
|
740
1008
|
fontSize: t.textSize,
|
|
741
1009
|
fontWeight: t.textFontWeight,
|
|
742
|
-
...
|
|
1010
|
+
...G(t, c, f, p),
|
|
743
1011
|
children: t.text
|
|
744
1012
|
}) : null
|
|
745
1013
|
]
|
|
746
1014
|
});
|
|
747
1015
|
}
|
|
748
|
-
function F(e, t
|
|
1016
|
+
function F({ variant: e, palette: t, geometry: n, prefix: r, topClipId: s, topFill: c, topPoints: l, motionTime: u }) {
|
|
1017
|
+
let d = e.material === "transparent" ? e.opacity.transparentFace : 1, f = e.material === "solid" ? e.effect : "off", p = n.config.halfSize, m = {
|
|
1018
|
+
x: -p * 1.3,
|
|
1019
|
+
y: -p * 1.3,
|
|
1020
|
+
size: p * 2.6
|
|
1021
|
+
};
|
|
1022
|
+
return f === "fluid" ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("g", {
|
|
1023
|
+
className: "sq-top-effect sq-top-effect-fluid",
|
|
1024
|
+
clipPath: `url(#${s})`,
|
|
1025
|
+
children: /* @__PURE__ */ o("g", {
|
|
1026
|
+
transform: n.labelTransform,
|
|
1027
|
+
children: [
|
|
1028
|
+
/* @__PURE__ */ a("rect", {
|
|
1029
|
+
x: m.x,
|
|
1030
|
+
y: m.y,
|
|
1031
|
+
width: m.size,
|
|
1032
|
+
height: m.size,
|
|
1033
|
+
fill: t.effectColors[3]
|
|
1034
|
+
}),
|
|
1035
|
+
/* @__PURE__ */ a("g", {
|
|
1036
|
+
filter: `url(#${r}-fluid-main-blur)`,
|
|
1037
|
+
children: k.map((e) => /* @__PURE__ */ a(I, {
|
|
1038
|
+
blob: e,
|
|
1039
|
+
palette: t,
|
|
1040
|
+
geometry: n,
|
|
1041
|
+
motionTime: u
|
|
1042
|
+
}, e.i))
|
|
1043
|
+
}),
|
|
1044
|
+
/* @__PURE__ */ a("g", {
|
|
1045
|
+
filter: `url(#${r}-fluid-light-blur)`,
|
|
1046
|
+
opacity: .6,
|
|
1047
|
+
style: { mixBlendMode: "screen" },
|
|
1048
|
+
children: A.map((e) => /* @__PURE__ */ a(I, {
|
|
1049
|
+
blob: e,
|
|
1050
|
+
palette: t,
|
|
1051
|
+
geometry: n,
|
|
1052
|
+
motionTime: u
|
|
1053
|
+
}, e.i))
|
|
1054
|
+
})
|
|
1055
|
+
]
|
|
1056
|
+
})
|
|
1057
|
+
}), /* @__PURE__ */ a("polygon", {
|
|
1058
|
+
className: "sq-face sq-solid-top sq-effect-outline",
|
|
1059
|
+
points: l,
|
|
1060
|
+
fill: "none",
|
|
1061
|
+
stroke: t.topEdge,
|
|
1062
|
+
strokeWidth: e.stroke.face,
|
|
1063
|
+
strokeOpacity: e.stroke.faceOpacity
|
|
1064
|
+
})] }) : f === "frosted" ? /* @__PURE__ */ o(i, { children: [
|
|
1065
|
+
/* @__PURE__ */ o("g", {
|
|
1066
|
+
className: "sq-top-effect sq-top-effect-frosted",
|
|
1067
|
+
clipPath: `url(#${s})`,
|
|
1068
|
+
children: [/* @__PURE__ */ o("g", {
|
|
1069
|
+
transform: n.labelTransform,
|
|
1070
|
+
children: [/* @__PURE__ */ a("rect", {
|
|
1071
|
+
x: m.x,
|
|
1072
|
+
y: m.y,
|
|
1073
|
+
width: m.size,
|
|
1074
|
+
height: m.size,
|
|
1075
|
+
fill: t.effectColors[6]
|
|
1076
|
+
}), /* @__PURE__ */ a("g", {
|
|
1077
|
+
filter: `url(#${r}-frosted-blur)`,
|
|
1078
|
+
children: j.map((e) => /* @__PURE__ */ a(I, {
|
|
1079
|
+
blob: e,
|
|
1080
|
+
palette: t,
|
|
1081
|
+
geometry: n,
|
|
1082
|
+
motionTime: u
|
|
1083
|
+
}, e.i))
|
|
1084
|
+
})]
|
|
1085
|
+
}), /* @__PURE__ */ a("polygon", {
|
|
1086
|
+
points: l,
|
|
1087
|
+
fill: "#eef2ff",
|
|
1088
|
+
opacity: .16
|
|
1089
|
+
})]
|
|
1090
|
+
}),
|
|
1091
|
+
/* @__PURE__ */ a("polygon", {
|
|
1092
|
+
className: "sq-face sq-solid-top sq-effect-outline",
|
|
1093
|
+
points: l,
|
|
1094
|
+
fill: "none",
|
|
1095
|
+
stroke: t.topEdge,
|
|
1096
|
+
strokeWidth: e.stroke.face,
|
|
1097
|
+
strokeOpacity: e.stroke.faceOpacity
|
|
1098
|
+
}),
|
|
1099
|
+
/* @__PURE__ */ a("polygon", {
|
|
1100
|
+
className: "sq-face sq-frosted-rim",
|
|
1101
|
+
points: l,
|
|
1102
|
+
fill: "none",
|
|
1103
|
+
stroke: "#ffffff",
|
|
1104
|
+
strokeWidth: Math.max(.7, e.stroke.face * 1.8),
|
|
1105
|
+
strokeOpacity: .52
|
|
1106
|
+
})
|
|
1107
|
+
] }) : /* @__PURE__ */ a("polygon", {
|
|
1108
|
+
className: "sq-face sq-solid-top",
|
|
1109
|
+
points: l,
|
|
1110
|
+
fill: c,
|
|
1111
|
+
fillOpacity: d,
|
|
1112
|
+
stroke: t.topEdge,
|
|
1113
|
+
strokeWidth: e.stroke.face,
|
|
1114
|
+
strokeOpacity: e.stroke.faceOpacity
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
function I({ blob: e, palette: t, geometry: n, motionTime: r }) {
|
|
1118
|
+
let i = n.config.halfSize, o = i * 2, s = i * e.x, c = i * e.y, l = o * e.r, u = o * e.ax, d = o * e.ay, f = o * e.ar, p = s + u * Math.sin(r * .62 * e.sp + e.i * 1.7) + .5 * u * Math.cos(r * .4 * e.sp + e.i * .6), m = c + d * Math.cos(r * .55 * e.sp + e.i * 2.1) + .55 * d * Math.sin(r * .34 * e.sp + e.i), h = Math.max(4, l + f * Math.sin(r * .8 + e.i * 1.2));
|
|
1119
|
+
return /* @__PURE__ */ a("circle", {
|
|
1120
|
+
cx: J(p),
|
|
1121
|
+
cy: J(m),
|
|
1122
|
+
r: J(h),
|
|
1123
|
+
fill: t.effectColors[e.slot] ?? t.effectColors[3]
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
function L(e, t = {}, n = {}) {
|
|
749
1127
|
return {
|
|
750
1128
|
material: e.material ?? "wireframe",
|
|
751
|
-
paletteId: e.paletteId
|
|
752
|
-
|
|
1129
|
+
paletteId: oe(e.paletteId),
|
|
1130
|
+
effect: ae(e.effect ?? ne),
|
|
1131
|
+
text: z(e.text, R(e).gpu),
|
|
753
1132
|
dash: e.dash ?? !1,
|
|
754
|
-
textStyle:
|
|
755
|
-
textColor:
|
|
756
|
-
textSize: e.textSize ??
|
|
757
|
-
textFontFamily: e.textFontFamily ??
|
|
758
|
-
textFontWeight: e.textFontWeight ??
|
|
759
|
-
dashColor:
|
|
1133
|
+
textStyle: B(e.textStyle ?? R(e).gpuStyle ?? "solid"),
|
|
1134
|
+
textColor: V(e.textColor ?? R(e).gpuColor ?? "contrast"),
|
|
1135
|
+
textSize: e.textSize ?? O,
|
|
1136
|
+
textFontFamily: e.textFontFamily ?? ee,
|
|
1137
|
+
textFontWeight: e.textFontWeight ?? te,
|
|
1138
|
+
dashColor: V(e.dashColor ?? "contrast"),
|
|
760
1139
|
stroke: {
|
|
761
|
-
...
|
|
1140
|
+
...T,
|
|
762
1141
|
...t,
|
|
763
1142
|
...e.stroke
|
|
764
1143
|
},
|
|
765
1144
|
opacity: {
|
|
766
|
-
...
|
|
1145
|
+
...E,
|
|
767
1146
|
...n,
|
|
768
1147
|
...e.opacity
|
|
769
1148
|
}
|
|
770
1149
|
};
|
|
771
1150
|
}
|
|
772
|
-
function
|
|
1151
|
+
function R(e) {
|
|
773
1152
|
return e;
|
|
774
1153
|
}
|
|
775
|
-
function
|
|
776
|
-
return typeof e == "string" ? e.trim() ? e : null : e === !0 || t ?
|
|
1154
|
+
function z(e, t) {
|
|
1155
|
+
return typeof e == "string" ? e.trim() ? e : null : e === !0 || t ? D : null;
|
|
777
1156
|
}
|
|
778
|
-
function
|
|
1157
|
+
function B(e) {
|
|
779
1158
|
return e === "wireframe" ? "wireframe" : "solid";
|
|
780
1159
|
}
|
|
781
|
-
function
|
|
1160
|
+
function ae(e) {
|
|
1161
|
+
return e === "fluid" || e === "frosted" ? e : "off";
|
|
1162
|
+
}
|
|
1163
|
+
function oe(e) {
|
|
1164
|
+
return w(e) ? e : "15";
|
|
1165
|
+
}
|
|
1166
|
+
function V(e) {
|
|
782
1167
|
return e === "auto" ? "contrast" : e;
|
|
783
1168
|
}
|
|
784
|
-
function
|
|
785
|
-
let n =
|
|
1169
|
+
function H(e, t) {
|
|
1170
|
+
let n = V(e);
|
|
786
1171
|
return n === "white" ? "#ffffff" : n === "black" ? "#05070a" : t;
|
|
787
1172
|
}
|
|
788
|
-
function
|
|
789
|
-
return e.material === "wireframe" ? n :
|
|
1173
|
+
function U(e, t, n) {
|
|
1174
|
+
return e.material === "wireframe" ? n : H(e.dashColor, t.labelFill);
|
|
790
1175
|
}
|
|
791
|
-
function
|
|
1176
|
+
function W(e) {
|
|
792
1177
|
return e.material === "transparent" ? e.opacity.transparentAnnotation : e.opacity.solidAnnotation;
|
|
793
1178
|
}
|
|
794
|
-
function
|
|
795
|
-
let i =
|
|
1179
|
+
function G(e, t, n, r) {
|
|
1180
|
+
let i = W(e);
|
|
796
1181
|
return e.material === "wireframe" ? e.textStyle === "wireframe" ? {
|
|
797
1182
|
fill: "none",
|
|
798
1183
|
stroke: r,
|
|
@@ -805,81 +1190,219 @@ function U(e, t, n, r) {
|
|
|
805
1190
|
opacity: 1
|
|
806
1191
|
} : e.textStyle === "wireframe" ? {
|
|
807
1192
|
fill: "none",
|
|
808
|
-
stroke:
|
|
1193
|
+
stroke: H(e.textColor, t.labelFill),
|
|
809
1194
|
strokeWidth: e.stroke.labelWire,
|
|
810
1195
|
opacity: i
|
|
811
1196
|
} : {
|
|
812
|
-
fill:
|
|
1197
|
+
fill: H(e.textColor, t.labelFill),
|
|
813
1198
|
stroke: "none",
|
|
814
1199
|
strokeWidth: 0,
|
|
815
1200
|
opacity: i
|
|
816
1201
|
};
|
|
817
1202
|
}
|
|
818
|
-
function
|
|
1203
|
+
function K(e) {
|
|
819
1204
|
return JSON.stringify(e);
|
|
820
1205
|
}
|
|
1206
|
+
function se(t) {
|
|
1207
|
+
let [n, i] = r(0);
|
|
1208
|
+
return e(() => {
|
|
1209
|
+
if (!t) {
|
|
1210
|
+
i(0);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
let e = () => i(performance.now() / 1e3);
|
|
1214
|
+
e();
|
|
1215
|
+
let n = window.setInterval(e, 33);
|
|
1216
|
+
return () => window.clearInterval(n);
|
|
1217
|
+
}, [t]), t ? n : 0;
|
|
1218
|
+
}
|
|
1219
|
+
function ce(e) {
|
|
1220
|
+
return q(L(e.base, e.stroke, e.opacity)) ? !0 : e.hover ? q(L({
|
|
1221
|
+
...e.base,
|
|
1222
|
+
...e.hover
|
|
1223
|
+
}, e.stroke, e.opacity)) : !1;
|
|
1224
|
+
}
|
|
1225
|
+
function q(e) {
|
|
1226
|
+
return e.material === "solid" && e.effect !== "off";
|
|
1227
|
+
}
|
|
1228
|
+
function le(e) {
|
|
1229
|
+
let t = C(e);
|
|
1230
|
+
return {
|
|
1231
|
+
id: t.id,
|
|
1232
|
+
labelFill: t.labelFill,
|
|
1233
|
+
topEdge: t.topEdge,
|
|
1234
|
+
sideEdge: t.sideEdge,
|
|
1235
|
+
top: t.top,
|
|
1236
|
+
side: t.side,
|
|
1237
|
+
textWire: t.textWire,
|
|
1238
|
+
effectColors: ue(t)
|
|
1239
|
+
};
|
|
1240
|
+
}
|
|
1241
|
+
function ue(e) {
|
|
1242
|
+
let t = e.top[0]?.color ?? "#f5f0ff", n = e.top[Math.floor(e.top.length / 2)]?.color ?? t, r = e.top.at(-1)?.color ?? n, i = e.side[0]?.color ?? n;
|
|
1243
|
+
return [
|
|
1244
|
+
t,
|
|
1245
|
+
t,
|
|
1246
|
+
n,
|
|
1247
|
+
r,
|
|
1248
|
+
i,
|
|
1249
|
+
e.side[Math.floor(e.side.length / 2)]?.color ?? i,
|
|
1250
|
+
e.side.at(-1)?.color ?? e.sideEdge
|
|
1251
|
+
];
|
|
1252
|
+
}
|
|
1253
|
+
function J(e) {
|
|
1254
|
+
return Number(e.toFixed(1));
|
|
1255
|
+
}
|
|
821
1256
|
//#endregion
|
|
822
1257
|
//#region src/squircle/codeExport.ts
|
|
823
|
-
function
|
|
824
|
-
let
|
|
1258
|
+
function de({ layers: e, theme: t, geometry: n, componentName: r = "CustomSquircle", importPath: i = "./squircle", styleImportPath: a, ariaLabel: o }) {
|
|
1259
|
+
let s = _e(r), c = JSON.stringify(i), l = fe(i, a), u = JSON.stringify(o ?? `${s} composition`), d = JSON.stringify(e.map(pe), null, 2), f = n ? JSON.stringify(ge(n), null, 2) : null;
|
|
825
1260
|
return [
|
|
826
|
-
`import { SquircleScene, type SquircleLayerConfig, type SquircleTheme } from ${
|
|
1261
|
+
`import { SquircleScene, ${f ? "type SquircleGeometryConfig, type SquircleLayerConfig, type SquircleTheme" : "type SquircleLayerConfig, type SquircleTheme"} } from ${c};`,
|
|
1262
|
+
...l ? [`import ${JSON.stringify(l)};`] : [],
|
|
827
1263
|
"",
|
|
828
1264
|
`const theme: SquircleTheme = ${JSON.stringify(t)};`,
|
|
1265
|
+
...f ? ["", `const geometry: SquircleGeometryConfig = ${f};`] : [],
|
|
829
1266
|
"",
|
|
830
|
-
`const layers: SquircleLayerConfig[] = ${
|
|
1267
|
+
`const layers: SquircleLayerConfig[] = ${d};`,
|
|
831
1268
|
"",
|
|
832
|
-
`export function ${
|
|
1269
|
+
`export function ${s}() {`,
|
|
833
1270
|
" return (",
|
|
834
1271
|
" <SquircleScene",
|
|
835
1272
|
" theme={theme}",
|
|
836
1273
|
" layers={layers}",
|
|
837
|
-
|
|
1274
|
+
...f ? [" geometry={geometry}"] : [],
|
|
1275
|
+
` ariaLabel={${u}}`,
|
|
838
1276
|
" />",
|
|
839
1277
|
" );",
|
|
840
1278
|
"}",
|
|
841
1279
|
""
|
|
842
1280
|
].join("\n");
|
|
843
1281
|
}
|
|
844
|
-
function
|
|
845
|
-
return
|
|
1282
|
+
function fe(e, t) {
|
|
1283
|
+
return t === !1 ? null : typeof t == "string" ? t : e === "@dstackai/sqircle" ? "@dstackai/sqircle/style.css" : null;
|
|
1284
|
+
}
|
|
1285
|
+
function pe(e) {
|
|
1286
|
+
return ge({
|
|
846
1287
|
...e,
|
|
847
|
-
base:
|
|
848
|
-
hover: e.hover ?
|
|
1288
|
+
base: me(e.base),
|
|
1289
|
+
hover: e.hover ? me(e.hover) : void 0
|
|
849
1290
|
});
|
|
850
1291
|
}
|
|
851
|
-
function
|
|
852
|
-
let { gpu: t, gpuStyle: n, gpuColor: r, ...i } = e, a =
|
|
853
|
-
return
|
|
1292
|
+
function me(e) {
|
|
1293
|
+
let { gpu: t, gpuStyle: n, gpuColor: r, ...i } = e, a = he(i.text, t), o = i.textStyle ?? n, s = i.textColor ?? r;
|
|
1294
|
+
return ge({
|
|
854
1295
|
...i,
|
|
855
1296
|
text: a,
|
|
856
1297
|
textStyle: o,
|
|
857
1298
|
textColor: s
|
|
858
1299
|
});
|
|
859
1300
|
}
|
|
860
|
-
function
|
|
1301
|
+
function he(e, t) {
|
|
861
1302
|
if (typeof e == "string") return e;
|
|
862
1303
|
if (e === !0 || t) return "GPU";
|
|
863
1304
|
if (e === !1) return !1;
|
|
864
1305
|
}
|
|
865
|
-
function
|
|
1306
|
+
function ge(e) {
|
|
866
1307
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
867
1308
|
}
|
|
868
|
-
function
|
|
1309
|
+
function _e(e) {
|
|
869
1310
|
let t = e.trim().split(/[^a-zA-Z0-9]+/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("") || "CustomSquircle";
|
|
870
1311
|
return /^[A-Za-z_$]/.test(t) ? t : `Squircle${t}`;
|
|
871
1312
|
}
|
|
872
1313
|
//#endregion
|
|
873
1314
|
//#region src/squircle/SquircleEditor.tsx
|
|
874
|
-
var
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1315
|
+
var ve = 88, ye = "GPU", be = {
|
|
1316
|
+
exponent: s.exponent,
|
|
1317
|
+
prismHeight: s.prismHeight,
|
|
1318
|
+
inlayScale: s.inlayScale
|
|
1319
|
+
}, xe = 0, Se = 100, Ce = 4, Y = 24, we = 4, Te = 36, Ee = .35, De = .82, Oe = 34, ke = 92, Ae = 62, je = 400, Me = [
|
|
1320
|
+
{
|
|
1321
|
+
value: "wireframe",
|
|
1322
|
+
label: "Wire",
|
|
1323
|
+
title: "Gradient outline with transparent faces"
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
value: "solid",
|
|
1327
|
+
label: "Solid",
|
|
1328
|
+
title: "Filled prism with top and side gradients"
|
|
1329
|
+
},
|
|
1330
|
+
{
|
|
1331
|
+
value: "transparent",
|
|
1332
|
+
label: "Glass",
|
|
1333
|
+
title: "Translucent filled prism"
|
|
1334
|
+
}
|
|
1335
|
+
], Ne = [
|
|
1336
|
+
{
|
|
1337
|
+
value: "off",
|
|
1338
|
+
label: "Off",
|
|
1339
|
+
title: "Use the static top-face gradient"
|
|
1340
|
+
},
|
|
1341
|
+
{
|
|
1342
|
+
value: "fluid",
|
|
1343
|
+
label: "Fluid",
|
|
1344
|
+
title: "Animated clipped gradient blobs on the top face"
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
value: "frosted",
|
|
1348
|
+
label: "Frosted",
|
|
1349
|
+
title: "Muted animated blobs with a pale glass veil and rim"
|
|
1350
|
+
}
|
|
1351
|
+
], Pe = [{
|
|
1352
|
+
value: "solid",
|
|
1353
|
+
label: "Filled",
|
|
1354
|
+
title: "Filled top-plane text"
|
|
1355
|
+
}, {
|
|
1356
|
+
value: "wireframe",
|
|
1357
|
+
label: "Outline",
|
|
1358
|
+
title: "Outlined top-plane text"
|
|
1359
|
+
}], Fe = [
|
|
1360
|
+
{
|
|
1361
|
+
value: "auto",
|
|
1362
|
+
label: "Auto",
|
|
1363
|
+
title: "Use the palette contrast color"
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
value: "white",
|
|
1367
|
+
label: "White",
|
|
1368
|
+
title: "Use fixed white annotation paint"
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
value: "black",
|
|
1372
|
+
label: "Black",
|
|
1373
|
+
title: "Use fixed black annotation paint"
|
|
1374
|
+
}
|
|
1375
|
+
], Ie = [
|
|
1376
|
+
{
|
|
1377
|
+
value: "300",
|
|
1378
|
+
label: "Light",
|
|
1379
|
+
title: "Thin top-plane label"
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
value: "400",
|
|
1383
|
+
label: "Regular",
|
|
1384
|
+
title: "Default top-plane label weight"
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
value: "500",
|
|
1388
|
+
label: "Medium",
|
|
1389
|
+
title: "Slightly stronger top-plane label"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
value: "600",
|
|
1393
|
+
label: "Semi",
|
|
1394
|
+
title: "Bold but still clean on wireframe outlines"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
value: "700",
|
|
1398
|
+
label: "Bold",
|
|
1399
|
+
title: "Strongest top-plane label"
|
|
1400
|
+
}
|
|
878
1401
|
];
|
|
879
|
-
function
|
|
1402
|
+
function Le(e = "15") {
|
|
880
1403
|
return d([
|
|
881
1404
|
{
|
|
882
|
-
id: "
|
|
1405
|
+
id: "layer-1",
|
|
883
1406
|
visible: !0,
|
|
884
1407
|
base: {
|
|
885
1408
|
material: "wireframe",
|
|
@@ -887,7 +1410,7 @@ function se(e = "15") {
|
|
|
887
1410
|
}
|
|
888
1411
|
},
|
|
889
1412
|
{
|
|
890
|
-
id: "
|
|
1413
|
+
id: "layer-2",
|
|
891
1414
|
visible: !0,
|
|
892
1415
|
base: {
|
|
893
1416
|
material: "wireframe",
|
|
@@ -895,51 +1418,67 @@ function se(e = "15") {
|
|
|
895
1418
|
}
|
|
896
1419
|
},
|
|
897
1420
|
{
|
|
898
|
-
id: "
|
|
1421
|
+
id: "layer-3",
|
|
899
1422
|
visible: !0,
|
|
900
1423
|
base: {
|
|
901
1424
|
material: "wireframe",
|
|
902
1425
|
paletteId: e
|
|
903
1426
|
}
|
|
904
1427
|
}
|
|
905
|
-
],
|
|
1428
|
+
], ve);
|
|
906
1429
|
}
|
|
907
|
-
function
|
|
908
|
-
let [
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1430
|
+
function Re({ value: t, initialLayers: c, onChange: l, geometry: u, initialGeometry: f, onGeometryChange: p, title: m = "Squircle", description: h = "React component constructor with 0-N layers and exported code.", className: g, layerGap: _ = ve, showCode: v, showConfig: y = !0, codeComponentName: b, codeImportPath: x = "./squircle", theme: S, defaultTheme: C = "light", onThemeChange: w, showThemeSwitch: T = !0 }) {
|
|
1431
|
+
let [E, D] = r(() => c ?? Le()), [O, ee] = r(() => ({
|
|
1432
|
+
...be,
|
|
1433
|
+
...f
|
|
1434
|
+
})), [te, ne] = r(C), k = t ?? E, A = u ?? O, j = S ?? te, [M, N] = r(() => k.at(-1)?.id ?? null), [ie, P] = r("base"), [F, I] = r(!1), [L, R] = r(!1), z = k.find((e) => e.id === M) ?? null, B = z ? k.findIndex((e) => e.id === z.id) + 1 : null, ae = k.filter((e) => e.visible !== !1).length, oe = v ?? y, V = Math.max(0, ...k.map((e) => e.offset?.y ?? 0)), H = n(() => ({
|
|
1435
|
+
layers: k,
|
|
1436
|
+
geometry: {
|
|
1437
|
+
...A,
|
|
1438
|
+
viewBoxHeight: Math.max(A.viewBoxHeight ?? s.viewBoxHeight, V + 320)
|
|
1439
|
+
},
|
|
1440
|
+
selectedLayerId: M
|
|
912
1441
|
}), [
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
1442
|
+
A,
|
|
1443
|
+
k,
|
|
1444
|
+
V,
|
|
1445
|
+
M
|
|
1446
|
+
]), U = n(() => de({
|
|
1447
|
+
layers: k,
|
|
1448
|
+
theme: j,
|
|
1449
|
+
geometry: st(A),
|
|
1450
|
+
componentName: b ?? m,
|
|
1451
|
+
importPath: x,
|
|
1452
|
+
ariaLabel: `${m} composition`
|
|
922
1453
|
}), [
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1454
|
+
A,
|
|
1455
|
+
j,
|
|
1456
|
+
b,
|
|
1457
|
+
x,
|
|
1458
|
+
k,
|
|
1459
|
+
m
|
|
928
1460
|
]);
|
|
929
1461
|
e(() => {
|
|
930
|
-
|
|
931
|
-
}, [
|
|
932
|
-
|
|
933
|
-
}, [
|
|
934
|
-
function
|
|
935
|
-
let r = n.reflow ? d(e,
|
|
936
|
-
t ||
|
|
1462
|
+
M && k.some((e) => e.id === M) || N(k.at(-1)?.id ?? null);
|
|
1463
|
+
}, [k, M]), e(() => {
|
|
1464
|
+
R(!1);
|
|
1465
|
+
}, [U]);
|
|
1466
|
+
function W(e, n = {}) {
|
|
1467
|
+
let r = n.reflow ? d(e, _) : e;
|
|
1468
|
+
t || D(r), l?.(r);
|
|
1469
|
+
}
|
|
1470
|
+
function G(e) {
|
|
1471
|
+
let t = {
|
|
1472
|
+
...A,
|
|
1473
|
+
...e
|
|
1474
|
+
};
|
|
1475
|
+
u || ee(t), p?.(t);
|
|
937
1476
|
}
|
|
938
|
-
function
|
|
939
|
-
|
|
1477
|
+
function K(e, t) {
|
|
1478
|
+
W(k.map((n) => n.id === e ? t(n) : n));
|
|
940
1479
|
}
|
|
941
|
-
function
|
|
942
|
-
|
|
1480
|
+
function se(e) {
|
|
1481
|
+
z && K(z.id, (t) => ({
|
|
943
1482
|
...t,
|
|
944
1483
|
base: {
|
|
945
1484
|
...t.base,
|
|
@@ -947,205 +1486,326 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
947
1486
|
}
|
|
948
1487
|
}));
|
|
949
1488
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
1489
|
+
function ce(e) {
|
|
1490
|
+
z && K(z.id, (t) => ({
|
|
952
1491
|
...t,
|
|
953
1492
|
hover: {
|
|
954
|
-
...t.hover ??
|
|
1493
|
+
...t.hover ?? {},
|
|
955
1494
|
...e
|
|
956
1495
|
}
|
|
957
1496
|
}));
|
|
958
1497
|
}
|
|
959
|
-
function
|
|
1498
|
+
function q() {
|
|
960
1499
|
let e = {
|
|
961
|
-
id:
|
|
1500
|
+
id: it(k),
|
|
962
1501
|
visible: !0,
|
|
963
1502
|
base: {
|
|
964
1503
|
material: "wireframe",
|
|
965
|
-
paletteId:
|
|
1504
|
+
paletteId: k.at(-1)?.base.paletteId ?? "15"
|
|
966
1505
|
}
|
|
967
|
-
}, t = [...
|
|
968
|
-
|
|
1506
|
+
}, t = [...k, e];
|
|
1507
|
+
N(e.id), P("base"), W(t, { reflow: !0 });
|
|
969
1508
|
}
|
|
970
|
-
function
|
|
971
|
-
if (!
|
|
972
|
-
let e =
|
|
973
|
-
|
|
1509
|
+
function le() {
|
|
1510
|
+
if (!z) return;
|
|
1511
|
+
let e = k.filter((e) => e.id !== z.id);
|
|
1512
|
+
N(e.at(-1)?.id ?? null), P("base"), W(e, { reflow: !0 });
|
|
974
1513
|
}
|
|
975
|
-
function
|
|
976
|
-
|
|
1514
|
+
function ue(e) {
|
|
1515
|
+
K(e, (e) => ({
|
|
977
1516
|
...e,
|
|
978
1517
|
visible: e.visible === !1
|
|
979
1518
|
}));
|
|
980
1519
|
}
|
|
981
|
-
function
|
|
982
|
-
|
|
1520
|
+
function J(e) {
|
|
1521
|
+
S || ne(e), w?.(e);
|
|
983
1522
|
}
|
|
984
|
-
async function
|
|
1523
|
+
async function fe() {
|
|
985
1524
|
try {
|
|
986
|
-
await navigator.clipboard.writeText(
|
|
1525
|
+
await navigator.clipboard.writeText(U);
|
|
987
1526
|
} catch {
|
|
988
1527
|
let e = document.createElement("textarea");
|
|
989
|
-
e.value =
|
|
1528
|
+
e.value = U, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.top = "-9999px", document.body.append(e), e.select(), document.execCommand("copy"), e.remove();
|
|
990
1529
|
}
|
|
991
|
-
|
|
1530
|
+
R(!0), window.setTimeout(() => R(!1), 1400);
|
|
992
1531
|
}
|
|
993
1532
|
return /* @__PURE__ */ o("main", {
|
|
994
1533
|
className: [
|
|
995
1534
|
"squircle-editor",
|
|
996
|
-
`squircle-editor-${
|
|
997
|
-
|
|
1535
|
+
`squircle-editor-${j}`,
|
|
1536
|
+
g
|
|
998
1537
|
].filter(Boolean).join(" "),
|
|
999
|
-
"data-theme":
|
|
1538
|
+
"data-theme": j,
|
|
1000
1539
|
"aria-label": "Squircle editor",
|
|
1001
1540
|
children: [/* @__PURE__ */ o("header", {
|
|
1002
1541
|
className: "squircle-editor-topbar",
|
|
1003
|
-
children: [/* @__PURE__ */ o("div", {
|
|
1542
|
+
children: [/* @__PURE__ */ o("div", {
|
|
1543
|
+
className: "topbar-title",
|
|
1544
|
+
children: [/* @__PURE__ */ a("h1", { children: m }), /* @__PURE__ */ a("p", { children: h })]
|
|
1545
|
+
}), /* @__PURE__ */ a("div", {
|
|
1004
1546
|
className: "topbar-actions",
|
|
1005
|
-
children:
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
children: [/* @__PURE__ */ a("button", {
|
|
1011
|
-
type: "button",
|
|
1012
|
-
"aria-pressed": D === "light",
|
|
1013
|
-
onClick: () => G("light"),
|
|
1014
|
-
children: "Light"
|
|
1015
|
-
}), /* @__PURE__ */ a("button", {
|
|
1016
|
-
type: "button",
|
|
1017
|
-
"aria-pressed": D === "dark",
|
|
1018
|
-
onClick: () => G("dark"),
|
|
1019
|
-
children: "Dark"
|
|
1020
|
-
})]
|
|
1021
|
-
}) : null,
|
|
1022
|
-
/* @__PURE__ */ a("button", {
|
|
1547
|
+
children: T ? /* @__PURE__ */ o("div", {
|
|
1548
|
+
className: "theme-switch",
|
|
1549
|
+
role: "group",
|
|
1550
|
+
"aria-label": "Theme",
|
|
1551
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1023
1552
|
type: "button",
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
/* @__PURE__ */ a("button", {
|
|
1553
|
+
"aria-pressed": j === "light",
|
|
1554
|
+
onClick: () => J("light"),
|
|
1555
|
+
children: "Light"
|
|
1556
|
+
}), /* @__PURE__ */ a("button", {
|
|
1028
1557
|
type: "button",
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1558
|
+
"aria-pressed": j === "dark",
|
|
1559
|
+
onClick: () => J("dark"),
|
|
1560
|
+
children: "Dark"
|
|
1561
|
+
})]
|
|
1562
|
+
}) : null
|
|
1033
1563
|
})]
|
|
1034
1564
|
}), /* @__PURE__ */ o("section", {
|
|
1035
1565
|
className: "squircle-editor-workspace",
|
|
1036
1566
|
children: [
|
|
1037
1567
|
/* @__PURE__ */ o("aside", {
|
|
1038
|
-
className: "side-panel",
|
|
1039
|
-
children: [
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1568
|
+
className: "side-panel layers-panel",
|
|
1569
|
+
children: [
|
|
1570
|
+
/* @__PURE__ */ o("div", {
|
|
1571
|
+
className: "panel-heading",
|
|
1572
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Layers" }), /* @__PURE__ */ o("span", { children: [
|
|
1573
|
+
ae,
|
|
1574
|
+
"/",
|
|
1575
|
+
k.length,
|
|
1576
|
+
" visible"
|
|
1577
|
+
] })] }), /* @__PURE__ */ o("div", {
|
|
1578
|
+
className: "panel-actions",
|
|
1579
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1049
1580
|
type: "button",
|
|
1050
|
-
className:
|
|
1051
|
-
|
|
1052
|
-
|
|
1581
|
+
className: "icon-button primary-action",
|
|
1582
|
+
"aria-label": "Add layer",
|
|
1583
|
+
title: "Add layer",
|
|
1584
|
+
onClick: q,
|
|
1585
|
+
children: /* @__PURE__ */ a(Ke, {})
|
|
1053
1586
|
}), /* @__PURE__ */ a("button", {
|
|
1054
1587
|
type: "button",
|
|
1055
|
-
className: "icon-
|
|
1056
|
-
"aria-
|
|
1057
|
-
|
|
1058
|
-
|
|
1588
|
+
className: "icon-button",
|
|
1589
|
+
"aria-label": "Clear layers",
|
|
1590
|
+
title: "Clear layers",
|
|
1591
|
+
onClick: () => W([]),
|
|
1592
|
+
children: /* @__PURE__ */ a(qe, {})
|
|
1059
1593
|
})]
|
|
1060
|
-
}
|
|
1594
|
+
})]
|
|
1595
|
+
}),
|
|
1596
|
+
/* @__PURE__ */ a("div", {
|
|
1597
|
+
className: "squircle-editor-layer-list",
|
|
1598
|
+
children: [...k].reverse().map((e, t) => {
|
|
1599
|
+
let n = k.length - t, r = $e(e.base.paletteId), i = e.base.material ?? "wireframe", s = tt(e.base);
|
|
1600
|
+
return /* @__PURE__ */ o("article", {
|
|
1601
|
+
className: e.id === M ? "squircle-editor-layer-row is-active" : "squircle-editor-layer-row",
|
|
1602
|
+
children: [/* @__PURE__ */ o("button", {
|
|
1603
|
+
type: "button",
|
|
1604
|
+
className: "layer-select",
|
|
1605
|
+
onClick: () => N(e.id),
|
|
1606
|
+
title: `Edit ${rt(e.id, n, k.length)}`,
|
|
1607
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1608
|
+
className: "layer-card-topline",
|
|
1609
|
+
children: [
|
|
1610
|
+
/* @__PURE__ */ a("span", {
|
|
1611
|
+
className: "layer-number",
|
|
1612
|
+
children: String(n).padStart(2, "0")
|
|
1613
|
+
}),
|
|
1614
|
+
/* @__PURE__ */ a("strong", { children: rt(e.id, n, k.length) }),
|
|
1615
|
+
/* @__PURE__ */ a("span", {
|
|
1616
|
+
className: `material-pill material-pill-${i}`,
|
|
1617
|
+
children: nt(i)
|
|
1618
|
+
})
|
|
1619
|
+
]
|
|
1620
|
+
}), /* @__PURE__ */ o("span", {
|
|
1621
|
+
className: "layer-card-meta",
|
|
1622
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1623
|
+
className: "layer-palette-chip",
|
|
1624
|
+
children: [/* @__PURE__ */ a("span", {
|
|
1625
|
+
className: "palette-swatch",
|
|
1626
|
+
style: { background: `linear-gradient(135deg, ${r.swatch[0]}, ${r.swatch[1]})` }
|
|
1627
|
+
}), r.label]
|
|
1628
|
+
}), /* @__PURE__ */ o("span", {
|
|
1629
|
+
className: "layer-feature-tags",
|
|
1630
|
+
children: [
|
|
1631
|
+
$(e.base) ? /* @__PURE__ */ a("span", { children: "Text" }) : null,
|
|
1632
|
+
e.base.dash ? /* @__PURE__ */ a("span", { children: "Dash" }) : null,
|
|
1633
|
+
i === "solid" && s !== "off" ? /* @__PURE__ */ a("span", { children: s }) : null,
|
|
1634
|
+
e.hover ? /* @__PURE__ */ a("span", { children: "Hover" }) : null,
|
|
1635
|
+
!$(e.base) && !e.base.dash && !e.hover && s === "off" ? /* @__PURE__ */ a("span", { children: "Clean" }) : null
|
|
1636
|
+
]
|
|
1637
|
+
})]
|
|
1638
|
+
})]
|
|
1639
|
+
}), /* @__PURE__ */ a("button", {
|
|
1640
|
+
type: "button",
|
|
1641
|
+
className: "icon-button layer-visibility",
|
|
1642
|
+
"aria-label": e.visible === !1 ? "Show layer" : "Hide layer",
|
|
1643
|
+
"aria-pressed": e.visible !== !1,
|
|
1644
|
+
title: e.visible === !1 ? "Show layer" : "Hide layer",
|
|
1645
|
+
onClick: () => ue(e.id),
|
|
1646
|
+
children: e.visible === !1 ? /* @__PURE__ */ a(Ye, {}) : /* @__PURE__ */ a(Je, {})
|
|
1647
|
+
})]
|
|
1648
|
+
}, e.id);
|
|
1649
|
+
})
|
|
1650
|
+
}),
|
|
1651
|
+
/* @__PURE__ */ o(X, {
|
|
1652
|
+
title: "Shape",
|
|
1653
|
+
children: [
|
|
1654
|
+
/* @__PURE__ */ a(Q, {
|
|
1655
|
+
label: "Radius",
|
|
1656
|
+
value: at(A.exponent ?? s.exponent),
|
|
1657
|
+
min: xe,
|
|
1658
|
+
max: Se,
|
|
1659
|
+
step: 1,
|
|
1660
|
+
formatValue: (e) => `${Math.round(e)}%`,
|
|
1661
|
+
onChange: (e) => G({ exponent: ot(e) })
|
|
1662
|
+
}),
|
|
1663
|
+
/* @__PURE__ */ a(Q, {
|
|
1664
|
+
label: "Height",
|
|
1665
|
+
value: A.prismHeight ?? s.prismHeight,
|
|
1666
|
+
min: we,
|
|
1667
|
+
max: Te,
|
|
1668
|
+
step: 1,
|
|
1669
|
+
formatValue: (e) => `${Math.round(e)}px`,
|
|
1670
|
+
onChange: (e) => G({ prismHeight: e })
|
|
1671
|
+
}),
|
|
1672
|
+
/* @__PURE__ */ a(Q, {
|
|
1673
|
+
label: "Dash size",
|
|
1674
|
+
value: (A.inlayScale ?? s.inlayScale) * 100,
|
|
1675
|
+
min: Ee * 100,
|
|
1676
|
+
max: De * 100,
|
|
1677
|
+
step: 1,
|
|
1678
|
+
formatValue: (e) => `${Math.round(e)}%`,
|
|
1679
|
+
onChange: (e) => G({ inlayScale: lt(e / 100, 2) })
|
|
1680
|
+
})
|
|
1681
|
+
]
|
|
1061
1682
|
})
|
|
1062
|
-
|
|
1683
|
+
]
|
|
1063
1684
|
}),
|
|
1064
1685
|
/* @__PURE__ */ o("section", {
|
|
1065
1686
|
className: "squircle-editor-preview",
|
|
1066
|
-
children: [
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1687
|
+
children: [
|
|
1688
|
+
/* @__PURE__ */ o("div", {
|
|
1689
|
+
className: "preview-toolbar",
|
|
1690
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Preview" }), /* @__PURE__ */ a("span", { children: B ? `Editing Layer ${B}` : `${ae} visible layers` })] }), oe ? /* @__PURE__ */ o("div", {
|
|
1691
|
+
className: "preview-actions",
|
|
1692
|
+
children: [/* @__PURE__ */ o("button", {
|
|
1693
|
+
type: "button",
|
|
1694
|
+
className: "code-toggle-button",
|
|
1695
|
+
"aria-pressed": F,
|
|
1696
|
+
onClick: () => I((e) => !e),
|
|
1697
|
+
children: [/* @__PURE__ */ a(Ze, {}), "Code"]
|
|
1698
|
+
}), /* @__PURE__ */ o("button", {
|
|
1699
|
+
type: "button",
|
|
1700
|
+
className: "copy-code-button",
|
|
1701
|
+
"aria-label": "Copy React code",
|
|
1702
|
+
title: "Copy React code",
|
|
1703
|
+
onClick: fe,
|
|
1704
|
+
children: [/* @__PURE__ */ a(Ge, {}), /* @__PURE__ */ a("span", {
|
|
1705
|
+
className: "copy-status",
|
|
1706
|
+
"aria-live": "polite",
|
|
1707
|
+
children: L ? "Copied" : ""
|
|
1708
|
+
})]
|
|
1086
1709
|
})]
|
|
1087
|
-
})]
|
|
1088
|
-
}),
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1710
|
+
}) : null]
|
|
1711
|
+
}),
|
|
1712
|
+
/* @__PURE__ */ a("div", {
|
|
1713
|
+
className: "preview-stage",
|
|
1714
|
+
children: /* @__PURE__ */ a(re, {
|
|
1715
|
+
...H,
|
|
1716
|
+
theme: j,
|
|
1717
|
+
ariaLabel: "Editable squircle composition",
|
|
1718
|
+
onLayerSelect: (e) => {
|
|
1719
|
+
N(e), P("base");
|
|
1720
|
+
}
|
|
1721
|
+
})
|
|
1722
|
+
}),
|
|
1723
|
+
oe ? /* @__PURE__ */ o("section", {
|
|
1724
|
+
className: F ? "code-panel is-open" : "code-panel",
|
|
1725
|
+
"aria-label": "Generated React code",
|
|
1726
|
+
children: [/* @__PURE__ */ o("header", {
|
|
1727
|
+
className: "code-panel-header",
|
|
1728
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Code" }), /* @__PURE__ */ a("p", { children: "Ready-to-use React component." })] }), /* @__PURE__ */ o("button", {
|
|
1729
|
+
type: "button",
|
|
1730
|
+
className: "copy-code-button",
|
|
1731
|
+
"aria-label": "Copy React code",
|
|
1732
|
+
title: "Copy React code",
|
|
1733
|
+
onClick: fe,
|
|
1734
|
+
children: [/* @__PURE__ */ a(Ge, {}), /* @__PURE__ */ a("span", {
|
|
1735
|
+
className: "copy-status",
|
|
1736
|
+
"aria-live": "polite",
|
|
1737
|
+
children: L ? "Copied" : ""
|
|
1738
|
+
})]
|
|
1739
|
+
})]
|
|
1740
|
+
}), F ? /* @__PURE__ */ a("pre", {
|
|
1741
|
+
className: "code-output",
|
|
1742
|
+
children: /* @__PURE__ */ a("code", { children: U })
|
|
1743
|
+
}) : null]
|
|
1744
|
+
}) : null
|
|
1745
|
+
]
|
|
1093
1746
|
}),
|
|
1094
1747
|
/* @__PURE__ */ a("aside", {
|
|
1095
|
-
className:
|
|
1096
|
-
children:
|
|
1748
|
+
className: z ? "side-panel inspector-panel" : "side-panel inspector-panel is-empty",
|
|
1749
|
+
children: z ? /* @__PURE__ */ o(i, { children: [
|
|
1097
1750
|
/* @__PURE__ */ o("div", {
|
|
1098
|
-
className: "
|
|
1099
|
-
children: [/* @__PURE__ */
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1751
|
+
className: "inspector-heading",
|
|
1752
|
+
children: [/* @__PURE__ */ o("div", { children: [
|
|
1753
|
+
/* @__PURE__ */ a("span", {
|
|
1754
|
+
className: "inspector-kicker",
|
|
1755
|
+
children: "Selected"
|
|
1756
|
+
}),
|
|
1757
|
+
/* @__PURE__ */ a("h2", { children: B ? rt(z.id, B, k.length) : z.id }),
|
|
1758
|
+
/* @__PURE__ */ a("p", { children: Qe(z.base) })
|
|
1759
|
+
] }), /* @__PURE__ */ o("div", {
|
|
1760
|
+
className: "panel-actions",
|
|
1761
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1762
|
+
type: "button",
|
|
1763
|
+
className: "icon-button",
|
|
1764
|
+
"aria-label": "Close inspector",
|
|
1765
|
+
title: "Close inspector",
|
|
1766
|
+
onClick: () => N(null),
|
|
1767
|
+
children: /* @__PURE__ */ a(Xe, {})
|
|
1768
|
+
}), /* @__PURE__ */ a("button", {
|
|
1769
|
+
type: "button",
|
|
1770
|
+
className: "icon-button danger",
|
|
1771
|
+
"aria-label": "Delete layer",
|
|
1772
|
+
title: "Delete layer",
|
|
1773
|
+
onClick: le,
|
|
1774
|
+
children: /* @__PURE__ */ a(qe, {})
|
|
1775
|
+
})]
|
|
1104
1776
|
})]
|
|
1105
1777
|
}),
|
|
1106
|
-
/* @__PURE__ */ o(
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
/* @__PURE__ */ a(
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
Z(N.base) ? /* @__PURE__ */ a(ue, {
|
|
1125
|
-
label: "Text",
|
|
1126
|
-
value: Q(N.base),
|
|
1127
|
-
onChange: (e) => B({ text: e })
|
|
1128
|
-
}) : null,
|
|
1129
|
-
/* @__PURE__ */ a(Y, {
|
|
1130
|
-
label: "Dash",
|
|
1131
|
-
checked: N.base.dash ?? !1,
|
|
1132
|
-
onChange: (e) => B({ dash: e })
|
|
1133
|
-
}),
|
|
1134
|
-
/* @__PURE__ */ a(J, {
|
|
1135
|
-
label: "Text paint",
|
|
1136
|
-
value: pe(N.base),
|
|
1137
|
-
options: ["solid", "wireframe"],
|
|
1138
|
-
onChange: (e) => B({ textStyle: e })
|
|
1139
|
-
})
|
|
1140
|
-
]
|
|
1778
|
+
/* @__PURE__ */ o("div", {
|
|
1779
|
+
className: "state-switch",
|
|
1780
|
+
role: "group",
|
|
1781
|
+
"aria-label": "Layer state",
|
|
1782
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1783
|
+
type: "button",
|
|
1784
|
+
"aria-pressed": ie === "base",
|
|
1785
|
+
onClick: () => P("base"),
|
|
1786
|
+
children: "Base"
|
|
1787
|
+
}), /* @__PURE__ */ o("button", {
|
|
1788
|
+
type: "button",
|
|
1789
|
+
"aria-pressed": ie === "hover",
|
|
1790
|
+
onClick: () => P("hover"),
|
|
1791
|
+
children: ["Hover", z.hover ? /* @__PURE__ */ a("span", {
|
|
1792
|
+
className: "state-dot",
|
|
1793
|
+
"aria-hidden": "true"
|
|
1794
|
+
}) : null]
|
|
1795
|
+
})]
|
|
1141
1796
|
}),
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
title: "
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1797
|
+
ie === "base" ? /* @__PURE__ */ a(ze, {
|
|
1798
|
+
title: "Base State",
|
|
1799
|
+
variant: z.base,
|
|
1800
|
+
onChange: se
|
|
1801
|
+
}) : /* @__PURE__ */ o(X, {
|
|
1802
|
+
title: "Hover State",
|
|
1803
|
+
children: [/* @__PURE__ */ a(Ve, {
|
|
1804
|
+
label: "Hover variant",
|
|
1805
|
+
checked: !!z.hover,
|
|
1806
|
+
title: "Swap this layer to another variant on hover.",
|
|
1147
1807
|
onChange: (e) => {
|
|
1148
|
-
z
|
|
1808
|
+
K(z.id, (t) => ({
|
|
1149
1809
|
...t,
|
|
1150
1810
|
hover: e ? {
|
|
1151
1811
|
...t.base,
|
|
@@ -1153,26 +1813,26 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1153
1813
|
} : void 0
|
|
1154
1814
|
}));
|
|
1155
1815
|
}
|
|
1156
|
-
}),
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
onChange: (e) => V({ paletteId: e })
|
|
1164
|
-
})] }) : null]
|
|
1816
|
+
}), z.hover ? /* @__PURE__ */ a(Be, {
|
|
1817
|
+
variant: {
|
|
1818
|
+
...z.base,
|
|
1819
|
+
...z.hover
|
|
1820
|
+
},
|
|
1821
|
+
onChange: ce
|
|
1822
|
+
}) : null]
|
|
1165
1823
|
}),
|
|
1166
|
-
/* @__PURE__ */ o(
|
|
1824
|
+
/* @__PURE__ */ o(X, {
|
|
1167
1825
|
title: "Stroke Widths",
|
|
1826
|
+
collapsible: !0,
|
|
1827
|
+
defaultOpen: !1,
|
|
1168
1828
|
children: [
|
|
1169
|
-
/* @__PURE__ */ a(
|
|
1829
|
+
/* @__PURE__ */ a(Q, {
|
|
1170
1830
|
label: "Face",
|
|
1171
|
-
value:
|
|
1831
|
+
value: z.stroke?.face ?? .35,
|
|
1172
1832
|
min: 0,
|
|
1173
1833
|
max: 1.5,
|
|
1174
1834
|
step: .05,
|
|
1175
|
-
onChange: (e) => z
|
|
1835
|
+
onChange: (e) => K(z.id, (t) => ({
|
|
1176
1836
|
...t,
|
|
1177
1837
|
stroke: {
|
|
1178
1838
|
...t.stroke,
|
|
@@ -1180,13 +1840,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1180
1840
|
}
|
|
1181
1841
|
}))
|
|
1182
1842
|
}),
|
|
1183
|
-
/* @__PURE__ */ a(
|
|
1843
|
+
/* @__PURE__ */ a(Q, {
|
|
1184
1844
|
label: "Wire",
|
|
1185
|
-
value:
|
|
1845
|
+
value: z.stroke?.wire ?? 1.6,
|
|
1186
1846
|
min: .4,
|
|
1187
1847
|
max: 4,
|
|
1188
1848
|
step: .1,
|
|
1189
|
-
onChange: (e) => z
|
|
1849
|
+
onChange: (e) => K(z.id, (t) => ({
|
|
1190
1850
|
...t,
|
|
1191
1851
|
stroke: {
|
|
1192
1852
|
...t.stroke,
|
|
@@ -1194,13 +1854,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1194
1854
|
}
|
|
1195
1855
|
}))
|
|
1196
1856
|
}),
|
|
1197
|
-
/* @__PURE__ */ a(
|
|
1857
|
+
/* @__PURE__ */ a(Q, {
|
|
1198
1858
|
label: "Dash",
|
|
1199
|
-
value:
|
|
1859
|
+
value: z.stroke?.dash ?? 2.2,
|
|
1200
1860
|
min: .6,
|
|
1201
1861
|
max: 5,
|
|
1202
1862
|
step: .1,
|
|
1203
|
-
onChange: (e) => z
|
|
1863
|
+
onChange: (e) => K(z.id, (t) => ({
|
|
1204
1864
|
...t,
|
|
1205
1865
|
stroke: {
|
|
1206
1866
|
...t.stroke,
|
|
@@ -1208,13 +1868,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1208
1868
|
}
|
|
1209
1869
|
}))
|
|
1210
1870
|
}),
|
|
1211
|
-
/* @__PURE__ */ a(
|
|
1871
|
+
/* @__PURE__ */ a(Q, {
|
|
1212
1872
|
label: "Text outline",
|
|
1213
|
-
value:
|
|
1873
|
+
value: z.stroke?.labelWire ?? 1.1,
|
|
1214
1874
|
min: .4,
|
|
1215
1875
|
max: 2,
|
|
1216
1876
|
step: .05,
|
|
1217
|
-
onChange: (e) => z
|
|
1877
|
+
onChange: (e) => K(z.id, (t) => ({
|
|
1218
1878
|
...t,
|
|
1219
1879
|
stroke: {
|
|
1220
1880
|
...t.stroke,
|
|
@@ -1224,58 +1884,211 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1224
1884
|
})
|
|
1225
1885
|
]
|
|
1226
1886
|
})
|
|
1227
|
-
] }) : /* @__PURE__ */
|
|
1887
|
+
] }) : /* @__PURE__ */ o("div", {
|
|
1228
1888
|
className: "empty-note",
|
|
1229
|
-
children:
|
|
1889
|
+
children: [/* @__PURE__ */ a("h2", { children: "No layer selected" }), /* @__PURE__ */ a("button", {
|
|
1890
|
+
type: "button",
|
|
1891
|
+
className: "primary-action",
|
|
1892
|
+
onClick: q,
|
|
1893
|
+
children: "Add layer"
|
|
1894
|
+
})]
|
|
1230
1895
|
})
|
|
1231
1896
|
})
|
|
1232
1897
|
]
|
|
1233
1898
|
})]
|
|
1234
1899
|
});
|
|
1235
1900
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return /* @__PURE__ */ o("
|
|
1901
|
+
function X({ title: e, children: t, collapsible: n = !1, defaultOpen: r = !0 }) {
|
|
1902
|
+
return n ? /* @__PURE__ */ o("details", {
|
|
1903
|
+
className: "editor-section editor-section-details",
|
|
1904
|
+
open: r,
|
|
1905
|
+
children: [/* @__PURE__ */ a("summary", { children: /* @__PURE__ */ a("h3", { children: e }) }), /* @__PURE__ */ a("div", {
|
|
1906
|
+
className: "editor-section-body",
|
|
1907
|
+
children: t
|
|
1908
|
+
})]
|
|
1909
|
+
}) : /* @__PURE__ */ o("section", {
|
|
1238
1910
|
className: "editor-section",
|
|
1239
1911
|
children: [/* @__PURE__ */ a("h3", { children: e }), t]
|
|
1240
1912
|
});
|
|
1241
1913
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return /* @__PURE__ */
|
|
1914
|
+
function ze({ title: e, variant: t, onChange: n }) {
|
|
1915
|
+
return /* @__PURE__ */ a(X, {
|
|
1916
|
+
title: e,
|
|
1917
|
+
children: /* @__PURE__ */ a(Be, {
|
|
1918
|
+
variant: t,
|
|
1919
|
+
onChange: n
|
|
1920
|
+
})
|
|
1921
|
+
});
|
|
1922
|
+
}
|
|
1923
|
+
function Be({ variant: e, onChange: t }) {
|
|
1924
|
+
let n = e.material ?? "wireframe";
|
|
1925
|
+
return /* @__PURE__ */ o("div", {
|
|
1926
|
+
className: "variant-controls",
|
|
1927
|
+
children: [
|
|
1928
|
+
/* @__PURE__ */ a(Z, {
|
|
1929
|
+
label: "Material",
|
|
1930
|
+
value: n,
|
|
1931
|
+
options: Me,
|
|
1932
|
+
onChange: (e) => t({ material: e })
|
|
1933
|
+
}),
|
|
1934
|
+
/* @__PURE__ */ a(Ue, {
|
|
1935
|
+
value: et(e.paletteId),
|
|
1936
|
+
onChange: (e) => t({ paletteId: e })
|
|
1937
|
+
}),
|
|
1938
|
+
n === "solid" ? /* @__PURE__ */ a(Z, {
|
|
1939
|
+
label: "Effect",
|
|
1940
|
+
value: tt(e),
|
|
1941
|
+
options: Ne,
|
|
1942
|
+
onChange: (e) => t({ effect: e })
|
|
1943
|
+
}) : null,
|
|
1944
|
+
/* @__PURE__ */ o("div", {
|
|
1945
|
+
className: "feature-grid",
|
|
1946
|
+
"aria-label": "Top details",
|
|
1947
|
+
children: [/* @__PURE__ */ a(Ve, {
|
|
1948
|
+
label: "Text",
|
|
1949
|
+
checked: $(e),
|
|
1950
|
+
title: "Toggle top-plane text for this state.",
|
|
1951
|
+
onChange: (n) => t(n ? {
|
|
1952
|
+
text: ut(e),
|
|
1953
|
+
textColor: ft(e)
|
|
1954
|
+
} : {
|
|
1955
|
+
text: !1,
|
|
1956
|
+
textColor: void 0
|
|
1957
|
+
})
|
|
1958
|
+
}), /* @__PURE__ */ a(Ve, {
|
|
1959
|
+
label: "Dash",
|
|
1960
|
+
checked: e.dash ?? !1,
|
|
1961
|
+
title: "Toggle the dashed inlay for this state.",
|
|
1962
|
+
onChange: (n) => t(n ? {
|
|
1963
|
+
dash: !0,
|
|
1964
|
+
dashColor: pt(e)
|
|
1965
|
+
} : {
|
|
1966
|
+
dash: !1,
|
|
1967
|
+
dashColor: void 0
|
|
1968
|
+
})
|
|
1969
|
+
})]
|
|
1970
|
+
}),
|
|
1971
|
+
$(e) ? /* @__PURE__ */ o("div", {
|
|
1972
|
+
className: "nested-fields",
|
|
1973
|
+
children: [
|
|
1974
|
+
/* @__PURE__ */ a(We, {
|
|
1975
|
+
label: "Text",
|
|
1976
|
+
value: ut(e),
|
|
1977
|
+
onChange: (e) => t({ text: e })
|
|
1978
|
+
}),
|
|
1979
|
+
/* @__PURE__ */ a(Z, {
|
|
1980
|
+
label: "Text paint",
|
|
1981
|
+
value: dt(e),
|
|
1982
|
+
options: Pe,
|
|
1983
|
+
onChange: (e) => t({ textStyle: e })
|
|
1984
|
+
}),
|
|
1985
|
+
/* @__PURE__ */ a(He, {
|
|
1986
|
+
label: "Text color",
|
|
1987
|
+
value: ft(e),
|
|
1988
|
+
forcedValue: ht(e),
|
|
1989
|
+
onChange: (e) => t({ textColor: e })
|
|
1990
|
+
}),
|
|
1991
|
+
/* @__PURE__ */ a(Q, {
|
|
1992
|
+
label: "Text size",
|
|
1993
|
+
value: e.textSize ?? Ae,
|
|
1994
|
+
min: Oe,
|
|
1995
|
+
max: ke,
|
|
1996
|
+
step: 1,
|
|
1997
|
+
formatValue: (e) => `${Math.round(e)}px`,
|
|
1998
|
+
onChange: (e) => t({ textSize: e })
|
|
1999
|
+
}),
|
|
2000
|
+
/* @__PURE__ */ a(Z, {
|
|
2001
|
+
label: "Font weight",
|
|
2002
|
+
value: String(e.textFontWeight ?? je),
|
|
2003
|
+
options: Ie,
|
|
2004
|
+
onChange: (e) => t({ textFontWeight: Number(e) })
|
|
2005
|
+
})
|
|
2006
|
+
]
|
|
2007
|
+
}) : null,
|
|
2008
|
+
e.dash ? /* @__PURE__ */ a("div", {
|
|
2009
|
+
className: "nested-fields",
|
|
2010
|
+
children: /* @__PURE__ */ a(He, {
|
|
2011
|
+
label: "Dash color",
|
|
2012
|
+
value: pt(e),
|
|
2013
|
+
forcedValue: gt(e),
|
|
2014
|
+
onChange: (e) => t({ dashColor: e })
|
|
2015
|
+
})
|
|
2016
|
+
}) : null
|
|
2017
|
+
]
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
function Ve({ label: e, checked: t, title: n, onChange: r }) {
|
|
2021
|
+
return /* @__PURE__ */ o("button", {
|
|
2022
|
+
type: "button",
|
|
2023
|
+
className: "feature-switch",
|
|
2024
|
+
"aria-pressed": t,
|
|
2025
|
+
title: n,
|
|
2026
|
+
onClick: () => r(!t),
|
|
2027
|
+
children: [/* @__PURE__ */ a("span", {
|
|
2028
|
+
className: "feature-switch-label",
|
|
2029
|
+
children: e
|
|
2030
|
+
}), /* @__PURE__ */ a("span", {
|
|
2031
|
+
className: "feature-switch-state",
|
|
2032
|
+
children: t ? "On" : "Off"
|
|
2033
|
+
})]
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
function He({ label: e, value: t, forcedValue: n, onChange: r }) {
|
|
2037
|
+
return n ? /* @__PURE__ */ o("div", {
|
|
1244
2038
|
className: "field",
|
|
1245
|
-
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
children: n
|
|
1249
|
-
value: e,
|
|
1250
|
-
children: e
|
|
1251
|
-
}, e))
|
|
2039
|
+
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("div", {
|
|
2040
|
+
className: "forced-token",
|
|
2041
|
+
title: "This material controls annotation paint from the wireframe palette.",
|
|
2042
|
+
children: n
|
|
1252
2043
|
})]
|
|
2044
|
+
}) : /* @__PURE__ */ a(Z, {
|
|
2045
|
+
label: e,
|
|
2046
|
+
value: t,
|
|
2047
|
+
options: Fe,
|
|
2048
|
+
onChange: r
|
|
1253
2049
|
});
|
|
1254
2050
|
}
|
|
1255
|
-
function
|
|
1256
|
-
return /* @__PURE__ */ o("
|
|
2051
|
+
function Z({ label: e, value: t, options: n, onChange: r }) {
|
|
2052
|
+
return /* @__PURE__ */ o("div", {
|
|
1257
2053
|
className: "field",
|
|
1258
|
-
children: [/* @__PURE__ */ a("span", { children:
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
2054
|
+
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("div", {
|
|
2055
|
+
className: "segmented-field",
|
|
2056
|
+
role: "group",
|
|
2057
|
+
"aria-label": e,
|
|
2058
|
+
children: n.map((e) => /* @__PURE__ */ a("button", {
|
|
2059
|
+
type: "button",
|
|
2060
|
+
title: e.title,
|
|
2061
|
+
"aria-pressed": e.value === t,
|
|
2062
|
+
onClick: () => r(e.value),
|
|
2063
|
+
children: e.label
|
|
2064
|
+
}, e.value))
|
|
1265
2065
|
})]
|
|
1266
2066
|
});
|
|
1267
2067
|
}
|
|
1268
|
-
function
|
|
1269
|
-
return /* @__PURE__ */ o("
|
|
1270
|
-
className: "
|
|
1271
|
-
children: [/* @__PURE__ */ a("
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
2068
|
+
function Ue({ value: e, onChange: t }) {
|
|
2069
|
+
return /* @__PURE__ */ o("div", {
|
|
2070
|
+
className: "field palette-field",
|
|
2071
|
+
children: [/* @__PURE__ */ a("span", { children: "Palette" }), /* @__PURE__ */ a("div", {
|
|
2072
|
+
className: "palette-grid",
|
|
2073
|
+
role: "group",
|
|
2074
|
+
"aria-label": "Palette",
|
|
2075
|
+
children: x.map((n) => {
|
|
2076
|
+
let r = $e(n);
|
|
2077
|
+
return /* @__PURE__ */ o("button", {
|
|
2078
|
+
type: "button",
|
|
2079
|
+
title: r.label,
|
|
2080
|
+
"aria-pressed": e === n,
|
|
2081
|
+
onClick: () => t(n),
|
|
2082
|
+
children: [/* @__PURE__ */ a("span", {
|
|
2083
|
+
className: "palette-swatch",
|
|
2084
|
+
style: { background: `linear-gradient(135deg, ${r.swatch[0]}, ${r.swatch[1]})` }
|
|
2085
|
+
}), /* @__PURE__ */ a("span", { children: n })]
|
|
2086
|
+
}, n);
|
|
2087
|
+
})
|
|
2088
|
+
})]
|
|
1276
2089
|
});
|
|
1277
2090
|
}
|
|
1278
|
-
function
|
|
2091
|
+
function We({ label: e, value: t, onChange: n }) {
|
|
1279
2092
|
return /* @__PURE__ */ o("label", {
|
|
1280
2093
|
className: "field",
|
|
1281
2094
|
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("input", {
|
|
@@ -1285,24 +2098,24 @@ function ue({ label: e, value: t, onChange: n }) {
|
|
|
1285
2098
|
})]
|
|
1286
2099
|
});
|
|
1287
2100
|
}
|
|
1288
|
-
function
|
|
2101
|
+
function Q({ label: e, value: t, min: n, max: r, step: i, formatValue: s, onChange: c }) {
|
|
1289
2102
|
return /* @__PURE__ */ o("label", {
|
|
1290
2103
|
className: "field",
|
|
1291
2104
|
children: [/* @__PURE__ */ o("span", { children: [
|
|
1292
2105
|
e,
|
|
1293
2106
|
": ",
|
|
1294
|
-
t.toFixed(2)
|
|
2107
|
+
s ? s(t) : t.toFixed(2)
|
|
1295
2108
|
] }), /* @__PURE__ */ a("input", {
|
|
1296
2109
|
type: "range",
|
|
1297
2110
|
min: n,
|
|
1298
2111
|
max: r,
|
|
1299
2112
|
step: i,
|
|
1300
2113
|
value: t,
|
|
1301
|
-
onChange: (e) =>
|
|
2114
|
+
onChange: (e) => c(Number(e.target.value))
|
|
1302
2115
|
})]
|
|
1303
2116
|
});
|
|
1304
2117
|
}
|
|
1305
|
-
function
|
|
2118
|
+
function Ge() {
|
|
1306
2119
|
return /* @__PURE__ */ o("svg", {
|
|
1307
2120
|
className: "copy-icon",
|
|
1308
2121
|
viewBox: "0 0 24 24",
|
|
@@ -1317,23 +2130,131 @@ function de() {
|
|
|
1317
2130
|
}), /* @__PURE__ */ a("path", { d: "M5 15V6.8C5 5.8 5.8 5 6.8 5H15" })]
|
|
1318
2131
|
});
|
|
1319
2132
|
}
|
|
1320
|
-
function
|
|
1321
|
-
|
|
1322
|
-
|
|
2133
|
+
function Ke() {
|
|
2134
|
+
return /* @__PURE__ */ a("svg", {
|
|
2135
|
+
viewBox: "0 0 24 24",
|
|
2136
|
+
"aria-hidden": "true",
|
|
2137
|
+
focusable: "false",
|
|
2138
|
+
children: /* @__PURE__ */ a("path", { d: "M12 5v14M5 12h14" })
|
|
2139
|
+
});
|
|
1323
2140
|
}
|
|
1324
|
-
function
|
|
1325
|
-
return
|
|
2141
|
+
function qe() {
|
|
2142
|
+
return /* @__PURE__ */ a("svg", {
|
|
2143
|
+
viewBox: "0 0 24 24",
|
|
2144
|
+
"aria-hidden": "true",
|
|
2145
|
+
focusable: "false",
|
|
2146
|
+
children: /* @__PURE__ */ a("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3" })
|
|
2147
|
+
});
|
|
1326
2148
|
}
|
|
1327
|
-
function
|
|
1328
|
-
return
|
|
2149
|
+
function Je() {
|
|
2150
|
+
return /* @__PURE__ */ o("svg", {
|
|
2151
|
+
viewBox: "0 0 24 24",
|
|
2152
|
+
"aria-hidden": "true",
|
|
2153
|
+
focusable: "false",
|
|
2154
|
+
children: [/* @__PURE__ */ a("path", { d: "M2.5 12s3.4-6 9.5-6 9.5 6 9.5 6-3.4 6-9.5 6-9.5-6-9.5-6Z" }), /* @__PURE__ */ a("circle", {
|
|
2155
|
+
cx: "12",
|
|
2156
|
+
cy: "12",
|
|
2157
|
+
r: "2.8"
|
|
2158
|
+
})]
|
|
2159
|
+
});
|
|
1329
2160
|
}
|
|
1330
|
-
function
|
|
1331
|
-
return
|
|
2161
|
+
function Ye() {
|
|
2162
|
+
return /* @__PURE__ */ a("svg", {
|
|
2163
|
+
viewBox: "0 0 24 24",
|
|
2164
|
+
"aria-hidden": "true",
|
|
2165
|
+
focusable: "false",
|
|
2166
|
+
children: /* @__PURE__ */ a("path", { d: "M3 3l18 18M9.4 5.5A10.9 10.9 0 0 1 12 5c6.1 0 9.5 7 9.5 7a15.2 15.2 0 0 1-3 4M6.7 6.9A15.5 15.5 0 0 0 2.5 12s3.4 7 9.5 7c1.1 0 2.2-.2 3.1-.6" })
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
function Xe() {
|
|
2170
|
+
return /* @__PURE__ */ a("svg", {
|
|
2171
|
+
viewBox: "0 0 24 24",
|
|
2172
|
+
"aria-hidden": "true",
|
|
2173
|
+
focusable: "false",
|
|
2174
|
+
children: /* @__PURE__ */ a("path", { d: "M6 6l12 12M18 6L6 18" })
|
|
2175
|
+
});
|
|
2176
|
+
}
|
|
2177
|
+
function Ze() {
|
|
2178
|
+
return /* @__PURE__ */ a("svg", {
|
|
2179
|
+
viewBox: "0 0 24 24",
|
|
2180
|
+
"aria-hidden": "true",
|
|
2181
|
+
focusable: "false",
|
|
2182
|
+
children: /* @__PURE__ */ a("path", { d: "M9 18 3 12l6-6M15 6l6 6-6 6" })
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
function Qe(e) {
|
|
2186
|
+
let t = [nt(e.material ?? "wireframe"), $e(e.paletteId).label], n = tt(e);
|
|
2187
|
+
return (e.material ?? "wireframe") === "solid" && n !== "off" && t.push(n), $(e) && t.push(`text: ${ut(e)}`), e.dash && t.push("dash"), t.join(" / ");
|
|
2188
|
+
}
|
|
2189
|
+
function $e(e) {
|
|
2190
|
+
return b[e] ?? b[15];
|
|
2191
|
+
}
|
|
2192
|
+
function et(e) {
|
|
2193
|
+
return e && e in b ? e : "15";
|
|
2194
|
+
}
|
|
2195
|
+
function tt(e) {
|
|
2196
|
+
return e.effect === "fluid" || e.effect === "frosted" ? e.effect : "off";
|
|
2197
|
+
}
|
|
2198
|
+
function nt(e) {
|
|
2199
|
+
return e === "transparent" ? "Glass" : e === "solid" ? "Solid" : "Wire";
|
|
2200
|
+
}
|
|
2201
|
+
function rt(e, t, n) {
|
|
2202
|
+
return `Layer ${t}`;
|
|
2203
|
+
}
|
|
2204
|
+
function it(e) {
|
|
2205
|
+
let t = new Set(e.map((e) => e.id)), n = e.length + 1;
|
|
2206
|
+
for (; t.has(`layer-${n}`);) n += 1;
|
|
2207
|
+
return `layer-${n}`;
|
|
2208
|
+
}
|
|
2209
|
+
function at(e) {
|
|
2210
|
+
let t = (Y - e) / (Y - Ce);
|
|
2211
|
+
return ct(Math.round(t * 100), xe, Se);
|
|
2212
|
+
}
|
|
2213
|
+
function ot(e) {
|
|
2214
|
+
return lt(Y - ct(e, xe, Se) / 100 * (Y - Ce), 1);
|
|
2215
|
+
}
|
|
2216
|
+
function st(e) {
|
|
2217
|
+
return {
|
|
2218
|
+
exponent: e.exponent ?? s.exponent,
|
|
2219
|
+
prismHeight: e.prismHeight ?? s.prismHeight,
|
|
2220
|
+
inlayScale: e.inlayScale ?? s.inlayScale
|
|
2221
|
+
};
|
|
2222
|
+
}
|
|
2223
|
+
function ct(e, t, n) {
|
|
2224
|
+
return Math.min(n, Math.max(t, e));
|
|
2225
|
+
}
|
|
2226
|
+
function lt(e, t) {
|
|
2227
|
+
let n = 10 ** t;
|
|
2228
|
+
return Math.round(e * n) / n;
|
|
1332
2229
|
}
|
|
1333
2230
|
function $(e) {
|
|
2231
|
+
return typeof e.text == "string" ? e.text.trim().length > 0 : e.text === !0 || _t(e).gpu === !0;
|
|
2232
|
+
}
|
|
2233
|
+
function ut(e) {
|
|
2234
|
+
return typeof e.text == "string" ? e.text : (e.text === !0 || _t(e).gpu, ye);
|
|
2235
|
+
}
|
|
2236
|
+
function dt(e) {
|
|
2237
|
+
return e.textStyle ?? _t(e).gpuStyle ?? "solid";
|
|
2238
|
+
}
|
|
2239
|
+
function ft(e) {
|
|
2240
|
+
return mt(e.textColor ?? _t(e).gpuColor ?? "contrast");
|
|
2241
|
+
}
|
|
2242
|
+
function pt(e) {
|
|
2243
|
+
return mt(e.dashColor ?? "contrast");
|
|
2244
|
+
}
|
|
2245
|
+
function mt(e) {
|
|
2246
|
+
return e === "contrast" ? "auto" : e;
|
|
2247
|
+
}
|
|
2248
|
+
function ht(e) {
|
|
2249
|
+
return (e.material ?? "wireframe") === "wireframe" ? dt(e) === "wireframe" ? "Wire gradient" : "Surface gradient" : null;
|
|
2250
|
+
}
|
|
2251
|
+
function gt(e) {
|
|
2252
|
+
return (e.material ?? "wireframe") === "wireframe" ? "Wire gradient" : null;
|
|
2253
|
+
}
|
|
2254
|
+
function _t(e) {
|
|
1334
2255
|
return e;
|
|
1335
2256
|
}
|
|
1336
2257
|
//#endregion
|
|
1337
|
-
export { s as DEFAULT_GEOMETRY, S as DEFAULT_PALETTE_ID, b as SQUIRCLE_PALETTES, x as SQUIRCLE_PALETTE_IDS,
|
|
2258
|
+
export { s as DEFAULT_GEOMETRY, S as DEFAULT_PALETTE_ID, b as SQUIRCLE_PALETTES, x as SQUIRCLE_PALETTE_IDS, Re as SquircleEditor, re as SquircleScene, Le as createDefaultSquircleEditorLayers, c as createSquircleGeometry, u as createSquircleLayers, de as createSquircleReactCode, C as getSquirclePalette, w as isSquirclePaletteId, d as reflowLayerOffsets, _e as toComponentName };
|
|
1338
2259
|
|
|
1339
2260
|
//# sourceMappingURL=sqircle.js.map
|