@dstackai/sqircle 0.1.0 → 0.1.1
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 +154 -16
- package/dist/SquircleEditor.d.ts +5 -2
- package/dist/assets/ConstructorPage-BZYA63EF.js +2 -0
- package/dist/assets/ConstructorPage-BthtTZhb.css +1 -0
- package/dist/assets/PageShell-CjHSnST7.js +1 -0
- package/dist/assets/demo-C2Ri3G4a.js +1 -0
- package/dist/assets/index-CYKmiCSm.js +1 -0
- package/dist/assets/pages-DQf07DWd.js +9 -0
- package/dist/assets/pages-hENaA-mA.css +1 -0
- package/dist/codeExport.d.ts +4 -2
- package/dist/constructor.html +15 -0
- package/dist/demo.html +15 -0
- package/dist/index.html +15 -0
- package/dist/react.html +15 -0
- package/dist/sqircle.js +763 -310
- package/dist/sqircle.js.map +1 -1
- package/dist/static/styles.css +883 -0
- package/dist/style.css +1 -1
- package/docs/README.md +12 -7
- package/docs/design/colors.md +12 -12
- package/docs/design/geometry.md +14 -13
- package/docs/design/rendering.md +18 -19
- package/docs/design/single-squircle-states.md +47 -109
- package/docs/examples/README.md +33 -0
- package/docs/react/README.md +101 -62
- package/docs/react/editor.md +159 -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)), M = v(E), N = 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: M,
|
|
39
|
+
sideBounds: N,
|
|
40
40
|
viewBox: `0 0 ${y(r)} ${y(i)}`
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -566,8 +566,8 @@ var w = {
|
|
|
566
566
|
transparentFace: .38,
|
|
567
567
|
transparentAnnotation: .62,
|
|
568
568
|
solidAnnotation: .88
|
|
569
|
-
}, E = "GPU", D = 62, O = "Arial, Helvetica, sans-serif",
|
|
570
|
-
function
|
|
569
|
+
}, E = "GPU", D = 62, O = "Arial, Helvetica, sans-serif", ee = 400;
|
|
570
|
+
function te({ 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
571
|
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
572
|
...r,
|
|
573
573
|
viewBoxHeight: b
|
|
@@ -583,10 +583,10 @@ function A({ layers: e, geometry: r, selectedLayerId: i, theme: s = "light", idP
|
|
|
583
583
|
role: "img",
|
|
584
584
|
"aria-label": d,
|
|
585
585
|
style: S,
|
|
586
|
-
children: [/* @__PURE__ */ a(
|
|
586
|
+
children: [/* @__PURE__ */ a(ne, {
|
|
587
587
|
prefix: g,
|
|
588
588
|
geometry: x
|
|
589
|
-
}), v.map((e) => /* @__PURE__ */ a(
|
|
589
|
+
}), v.map((e) => /* @__PURE__ */ a(A, {
|
|
590
590
|
layer: e,
|
|
591
591
|
geometry: x,
|
|
592
592
|
prefix: g,
|
|
@@ -595,9 +595,9 @@ function A({ layers: e, geometry: r, selectedLayerId: i, theme: s = "light", idP
|
|
|
595
595
|
}, e.id))]
|
|
596
596
|
});
|
|
597
597
|
}
|
|
598
|
-
function
|
|
598
|
+
function ne({ prefix: e, geometry: t }) {
|
|
599
599
|
return /* @__PURE__ */ a("defs", { children: Object.values(b).map((n) => /* @__PURE__ */ o("g", { children: [
|
|
600
|
-
/* @__PURE__ */ a(
|
|
600
|
+
/* @__PURE__ */ a(k, {
|
|
601
601
|
id: `${e}-top-${n.id}`,
|
|
602
602
|
x1: t.topBounds.minX,
|
|
603
603
|
y1: t.topBounds.minY,
|
|
@@ -605,7 +605,7 @@ function j({ prefix: e, geometry: t }) {
|
|
|
605
605
|
y2: t.topBounds.maxY,
|
|
606
606
|
stops: n.top
|
|
607
607
|
}),
|
|
608
|
-
/* @__PURE__ */ a(
|
|
608
|
+
/* @__PURE__ */ a(k, {
|
|
609
609
|
id: `${e}-side-${n.id}`,
|
|
610
610
|
x1: t.sideBounds.minX,
|
|
611
611
|
y1: t.sideBounds.minY,
|
|
@@ -613,7 +613,7 @@ function j({ prefix: e, geometry: t }) {
|
|
|
613
613
|
y2: t.sideBounds.maxY,
|
|
614
614
|
stops: n.side
|
|
615
615
|
}),
|
|
616
|
-
/* @__PURE__ */ a(
|
|
616
|
+
/* @__PURE__ */ a(k, {
|
|
617
617
|
id: `${e}-text-surface-${n.id}`,
|
|
618
618
|
x1: -425.63,
|
|
619
619
|
y1: -.1,
|
|
@@ -621,7 +621,7 @@ function j({ prefix: e, geometry: t }) {
|
|
|
621
621
|
y2: .07,
|
|
622
622
|
stops: n.top
|
|
623
623
|
}),
|
|
624
|
-
/* @__PURE__ */ a(
|
|
624
|
+
/* @__PURE__ */ a(k, {
|
|
625
625
|
id: `${e}-text-wire-${n.id}`,
|
|
626
626
|
x1: -64,
|
|
627
627
|
y1: -24,
|
|
@@ -631,7 +631,7 @@ function j({ prefix: e, geometry: t }) {
|
|
|
631
631
|
})
|
|
632
632
|
] }, n.id)) });
|
|
633
633
|
}
|
|
634
|
-
function
|
|
634
|
+
function k({ id: e, x1: t, y1: n, x2: r, y2: i, stops: o }) {
|
|
635
635
|
return /* @__PURE__ */ a("linearGradient", {
|
|
636
636
|
id: e,
|
|
637
637
|
x1: t,
|
|
@@ -645,11 +645,11 @@ function M({ id: e, x1: t, y1: n, x2: r, y2: i, stops: o }) {
|
|
|
645
645
|
}, `${e.offset}-${e.color}`))
|
|
646
646
|
});
|
|
647
647
|
}
|
|
648
|
-
function
|
|
649
|
-
let s =
|
|
648
|
+
function A({ layer: e, geometry: t, prefix: n, selected: r, onSelect: i }) {
|
|
649
|
+
let s = M(e.base, e.stroke, e.opacity), c = e.hover ? M({
|
|
650
650
|
...e.base,
|
|
651
651
|
...e.hover
|
|
652
|
-
}, e.stroke, e.opacity) : null, l = !!(c &&
|
|
652
|
+
}, e.stroke, e.opacity) : null, l = !!(c && B(c) !== B(s)), u = e.offset?.x ?? 0, d = e.offset?.y ?? 0;
|
|
653
653
|
return /* @__PURE__ */ o("g", {
|
|
654
654
|
className: [
|
|
655
655
|
"sq-layer",
|
|
@@ -661,12 +661,12 @@ function N({ layer: e, geometry: t, prefix: n, selected: r, onSelect: i }) {
|
|
|
661
661
|
"data-hover-enabled": String(l),
|
|
662
662
|
transform: `translate(${u} ${d})`,
|
|
663
663
|
onClick: i ? () => i(e.id) : void 0,
|
|
664
|
-
children: [/* @__PURE__ */ a(
|
|
664
|
+
children: [/* @__PURE__ */ a(j, {
|
|
665
665
|
className: "sq-base",
|
|
666
666
|
variant: s,
|
|
667
667
|
geometry: t,
|
|
668
668
|
prefix: n
|
|
669
|
-
}), l && c ? /* @__PURE__ */ a(
|
|
669
|
+
}), l && c ? /* @__PURE__ */ a(j, {
|
|
670
670
|
className: "sq-hover",
|
|
671
671
|
variant: c,
|
|
672
672
|
geometry: t,
|
|
@@ -674,7 +674,7 @@ function N({ layer: e, geometry: t, prefix: n, selected: r, onSelect: i }) {
|
|
|
674
674
|
}) : null]
|
|
675
675
|
});
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function j({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
678
678
|
let s = C(t.paletteId), c = `url(#${r}-top-${s.id})`, u = `url(#${r}-side-${s.id})`, d = `url(#${r}-text-surface-${s.id})`, f = `url(#${r}-text-wire-${s.id})`, p = l(n.wallPoints), m = l(n.topPoints), h = l(n.hiddenPoints), g = l(n.inlayPoints);
|
|
679
679
|
return /* @__PURE__ */ o("g", {
|
|
680
680
|
className: [
|
|
@@ -727,9 +727,9 @@ function P({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
|
727
727
|
t.dash ? /* @__PURE__ */ a("polygon", {
|
|
728
728
|
className: "sq-inlay",
|
|
729
729
|
points: g,
|
|
730
|
-
stroke:
|
|
730
|
+
stroke: re(t, s, c),
|
|
731
731
|
strokeWidth: t.material === "wireframe" ? t.stroke.wireDash : t.stroke.dash,
|
|
732
|
-
opacity:
|
|
732
|
+
opacity: R(t)
|
|
733
733
|
}) : null,
|
|
734
734
|
t.text ? /* @__PURE__ */ a("text", {
|
|
735
735
|
className: "sq-label",
|
|
@@ -739,24 +739,24 @@ function P({ className: e, variant: t, geometry: n, prefix: r }) {
|
|
|
739
739
|
fontFamily: t.textFontFamily,
|
|
740
740
|
fontSize: t.textSize,
|
|
741
741
|
fontWeight: t.textFontWeight,
|
|
742
|
-
...
|
|
742
|
+
...z(t, s, d, f),
|
|
743
743
|
children: t.text
|
|
744
744
|
}) : null
|
|
745
745
|
]
|
|
746
746
|
});
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function M(e, t = {}, n = {}) {
|
|
749
749
|
return {
|
|
750
750
|
material: e.material ?? "wireframe",
|
|
751
751
|
paletteId: e.paletteId ?? "15",
|
|
752
|
-
text:
|
|
752
|
+
text: P(e.text, N(e).gpu),
|
|
753
753
|
dash: e.dash ?? !1,
|
|
754
|
-
textStyle:
|
|
755
|
-
textColor:
|
|
754
|
+
textStyle: F(e.textStyle ?? N(e).gpuStyle ?? "solid"),
|
|
755
|
+
textColor: I(e.textColor ?? N(e).gpuColor ?? "contrast"),
|
|
756
756
|
textSize: e.textSize ?? D,
|
|
757
757
|
textFontFamily: e.textFontFamily ?? O,
|
|
758
|
-
textFontWeight: e.textFontWeight ??
|
|
759
|
-
dashColor:
|
|
758
|
+
textFontWeight: e.textFontWeight ?? ee,
|
|
759
|
+
dashColor: I(e.dashColor ?? "contrast"),
|
|
760
760
|
stroke: {
|
|
761
761
|
...w,
|
|
762
762
|
...t,
|
|
@@ -769,30 +769,30 @@ function F(e, t = {}, n = {}) {
|
|
|
769
769
|
}
|
|
770
770
|
};
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function N(e) {
|
|
773
773
|
return e;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function P(e, t) {
|
|
776
776
|
return typeof e == "string" ? e.trim() ? e : null : e === !0 || t ? E : null;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function F(e) {
|
|
779
779
|
return e === "wireframe" ? "wireframe" : "solid";
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function I(e) {
|
|
782
782
|
return e === "auto" ? "contrast" : e;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
let n =
|
|
784
|
+
function L(e, t) {
|
|
785
|
+
let n = I(e);
|
|
786
786
|
return n === "white" ? "#ffffff" : n === "black" ? "#05070a" : t;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
789
|
-
return e.material === "wireframe" ? n :
|
|
788
|
+
function re(e, t, n) {
|
|
789
|
+
return e.material === "wireframe" ? n : L(e.dashColor, t.labelFill);
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function R(e) {
|
|
792
792
|
return e.material === "transparent" ? e.opacity.transparentAnnotation : e.opacity.solidAnnotation;
|
|
793
793
|
}
|
|
794
|
-
function
|
|
795
|
-
let i =
|
|
794
|
+
function z(e, t, n, r) {
|
|
795
|
+
let i = R(e);
|
|
796
796
|
return e.material === "wireframe" ? e.textStyle === "wireframe" ? {
|
|
797
797
|
fill: "none",
|
|
798
798
|
stroke: r,
|
|
@@ -805,81 +805,153 @@ function U(e, t, n, r) {
|
|
|
805
805
|
opacity: 1
|
|
806
806
|
} : e.textStyle === "wireframe" ? {
|
|
807
807
|
fill: "none",
|
|
808
|
-
stroke:
|
|
808
|
+
stroke: L(e.textColor, t.labelFill),
|
|
809
809
|
strokeWidth: e.stroke.labelWire,
|
|
810
810
|
opacity: i
|
|
811
811
|
} : {
|
|
812
|
-
fill:
|
|
812
|
+
fill: L(e.textColor, t.labelFill),
|
|
813
813
|
stroke: "none",
|
|
814
814
|
strokeWidth: 0,
|
|
815
815
|
opacity: i
|
|
816
816
|
};
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function B(e) {
|
|
819
819
|
return JSON.stringify(e);
|
|
820
820
|
}
|
|
821
821
|
//#endregion
|
|
822
822
|
//#region src/squircle/codeExport.ts
|
|
823
|
-
function
|
|
824
|
-
let
|
|
823
|
+
function ie({ layers: e, theme: t, geometry: n, componentName: r = "CustomSquircle", importPath: i = "./squircle", styleImportPath: a, ariaLabel: o }) {
|
|
824
|
+
let s = G(r), c = JSON.stringify(i), l = V(i, a), u = JSON.stringify(o ?? `${s} composition`), d = JSON.stringify(e.map(ae), null, 2), f = n ? JSON.stringify(W(n), null, 2) : null;
|
|
825
825
|
return [
|
|
826
|
-
`import { SquircleScene, type SquircleLayerConfig, type SquircleTheme } from ${
|
|
826
|
+
`import { SquircleScene, ${f ? "type SquircleGeometryConfig, type SquircleLayerConfig, type SquircleTheme" : "type SquircleLayerConfig, type SquircleTheme"} } from ${c};`,
|
|
827
|
+
...l ? [`import ${JSON.stringify(l)};`] : [],
|
|
827
828
|
"",
|
|
828
829
|
`const theme: SquircleTheme = ${JSON.stringify(t)};`,
|
|
830
|
+
...f ? ["", `const geometry: SquircleGeometryConfig = ${f};`] : [],
|
|
829
831
|
"",
|
|
830
|
-
`const layers: SquircleLayerConfig[] = ${
|
|
832
|
+
`const layers: SquircleLayerConfig[] = ${d};`,
|
|
831
833
|
"",
|
|
832
|
-
`export function ${
|
|
834
|
+
`export function ${s}() {`,
|
|
833
835
|
" return (",
|
|
834
836
|
" <SquircleScene",
|
|
835
837
|
" theme={theme}",
|
|
836
838
|
" layers={layers}",
|
|
837
|
-
|
|
839
|
+
...f ? [" geometry={geometry}"] : [],
|
|
840
|
+
` ariaLabel={${u}}`,
|
|
838
841
|
" />",
|
|
839
842
|
" );",
|
|
840
843
|
"}",
|
|
841
844
|
""
|
|
842
845
|
].join("\n");
|
|
843
846
|
}
|
|
844
|
-
function
|
|
845
|
-
return
|
|
847
|
+
function V(e, t) {
|
|
848
|
+
return t === !1 ? null : typeof t == "string" ? t : e === "@dstackai/sqircle" ? "@dstackai/sqircle/style.css" : null;
|
|
849
|
+
}
|
|
850
|
+
function ae(e) {
|
|
851
|
+
return W({
|
|
846
852
|
...e,
|
|
847
|
-
base:
|
|
848
|
-
hover: e.hover ?
|
|
853
|
+
base: H(e.base),
|
|
854
|
+
hover: e.hover ? H(e.hover) : void 0
|
|
849
855
|
});
|
|
850
856
|
}
|
|
851
|
-
function
|
|
852
|
-
let { gpu: t, gpuStyle: n, gpuColor: r, ...i } = e, a =
|
|
853
|
-
return
|
|
857
|
+
function H(e) {
|
|
858
|
+
let { gpu: t, gpuStyle: n, gpuColor: r, ...i } = e, a = U(i.text, t), o = i.textStyle ?? n, s = i.textColor ?? r;
|
|
859
|
+
return W({
|
|
854
860
|
...i,
|
|
855
861
|
text: a,
|
|
856
862
|
textStyle: o,
|
|
857
863
|
textColor: s
|
|
858
864
|
});
|
|
859
865
|
}
|
|
860
|
-
function
|
|
866
|
+
function U(e, t) {
|
|
861
867
|
if (typeof e == "string") return e;
|
|
862
868
|
if (e === !0 || t) return "GPU";
|
|
863
869
|
if (e === !1) return !1;
|
|
864
870
|
}
|
|
865
|
-
function
|
|
871
|
+
function W(e) {
|
|
866
872
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0));
|
|
867
873
|
}
|
|
868
|
-
function
|
|
874
|
+
function G(e) {
|
|
869
875
|
let t = e.trim().split(/[^a-zA-Z0-9]+/).filter(Boolean).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("") || "CustomSquircle";
|
|
870
876
|
return /^[A-Za-z_$]/.test(t) ? t : `Squircle${t}`;
|
|
871
877
|
}
|
|
872
878
|
//#endregion
|
|
873
879
|
//#region src/squircle/SquircleEditor.tsx
|
|
874
|
-
var
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
880
|
+
var oe = 88, K = "GPU", se = {
|
|
881
|
+
exponent: s.exponent,
|
|
882
|
+
prismHeight: s.prismHeight,
|
|
883
|
+
inlayScale: s.inlayScale
|
|
884
|
+
}, ce = 0, le = 100, q = 4, J = 24, ue = 4, de = 36, fe = .35, pe = .82, me = 34, he = 92, ge = 62, _e = 400, ve = [
|
|
885
|
+
{
|
|
886
|
+
value: "wireframe",
|
|
887
|
+
label: "Wire",
|
|
888
|
+
title: "Gradient outline with transparent faces"
|
|
889
|
+
},
|
|
890
|
+
{
|
|
891
|
+
value: "solid",
|
|
892
|
+
label: "Solid",
|
|
893
|
+
title: "Filled prism with top and side gradients"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
value: "transparent",
|
|
897
|
+
label: "Glass",
|
|
898
|
+
title: "Translucent filled prism"
|
|
899
|
+
}
|
|
900
|
+
], ye = [{
|
|
901
|
+
value: "solid",
|
|
902
|
+
label: "Filled",
|
|
903
|
+
title: "Filled top-plane text"
|
|
904
|
+
}, {
|
|
905
|
+
value: "wireframe",
|
|
906
|
+
label: "Outline",
|
|
907
|
+
title: "Outlined top-plane text"
|
|
908
|
+
}], be = [
|
|
909
|
+
{
|
|
910
|
+
value: "auto",
|
|
911
|
+
label: "Auto",
|
|
912
|
+
title: "Use the palette contrast color"
|
|
913
|
+
},
|
|
914
|
+
{
|
|
915
|
+
value: "white",
|
|
916
|
+
label: "White",
|
|
917
|
+
title: "Use fixed white annotation paint"
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
value: "black",
|
|
921
|
+
label: "Black",
|
|
922
|
+
title: "Use fixed black annotation paint"
|
|
923
|
+
}
|
|
924
|
+
], xe = [
|
|
925
|
+
{
|
|
926
|
+
value: "300",
|
|
927
|
+
label: "Light",
|
|
928
|
+
title: "Thin top-plane label"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
value: "400",
|
|
932
|
+
label: "Regular",
|
|
933
|
+
title: "Default top-plane label weight"
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
value: "500",
|
|
937
|
+
label: "Medium",
|
|
938
|
+
title: "Slightly stronger top-plane label"
|
|
939
|
+
},
|
|
940
|
+
{
|
|
941
|
+
value: "600",
|
|
942
|
+
label: "Semi",
|
|
943
|
+
title: "Bold but still clean on wireframe outlines"
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
value: "700",
|
|
947
|
+
label: "Bold",
|
|
948
|
+
title: "Strongest top-plane label"
|
|
949
|
+
}
|
|
878
950
|
];
|
|
879
|
-
function
|
|
951
|
+
function Se(e = "15") {
|
|
880
952
|
return d([
|
|
881
953
|
{
|
|
882
|
-
id: "
|
|
954
|
+
id: "layer-1",
|
|
883
955
|
visible: !0,
|
|
884
956
|
base: {
|
|
885
957
|
material: "wireframe",
|
|
@@ -887,7 +959,7 @@ function se(e = "15") {
|
|
|
887
959
|
}
|
|
888
960
|
},
|
|
889
961
|
{
|
|
890
|
-
id: "
|
|
962
|
+
id: "layer-2",
|
|
891
963
|
visible: !0,
|
|
892
964
|
base: {
|
|
893
965
|
material: "wireframe",
|
|
@@ -895,51 +967,67 @@ function se(e = "15") {
|
|
|
895
967
|
}
|
|
896
968
|
},
|
|
897
969
|
{
|
|
898
|
-
id: "
|
|
970
|
+
id: "layer-3",
|
|
899
971
|
visible: !0,
|
|
900
972
|
base: {
|
|
901
973
|
material: "wireframe",
|
|
902
974
|
paletteId: e
|
|
903
975
|
}
|
|
904
976
|
}
|
|
905
|
-
],
|
|
977
|
+
], oe);
|
|
906
978
|
}
|
|
907
|
-
function
|
|
908
|
-
let [
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
979
|
+
function Ce({ 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: _ = oe, showCode: v, showConfig: y = !0, codeComponentName: b, codeImportPath: x = "./squircle", theme: S, defaultTheme: C = "light", onThemeChange: w, showThemeSwitch: T = !0 }) {
|
|
980
|
+
let [E, D] = r(() => c ?? Se()), [O, ee] = r(() => ({
|
|
981
|
+
...se,
|
|
982
|
+
...f
|
|
983
|
+
})), [ne, k] = r(C), A = t ?? E, j = u ?? O, M = S ?? ne, [N, P] = r(() => A.at(-1)?.id ?? null), [F, I] = r("base"), [L, re] = r(!1), [R, z] = r(!1), B = A.find((e) => e.id === N) ?? null, V = B ? A.findIndex((e) => e.id === B.id) + 1 : null, ae = A.filter((e) => e.visible !== !1).length, H = v ?? y, U = Math.max(0, ...A.map((e) => e.offset?.y ?? 0)), W = n(() => ({
|
|
984
|
+
layers: A,
|
|
985
|
+
geometry: {
|
|
986
|
+
...j,
|
|
987
|
+
viewBoxHeight: Math.max(j.viewBoxHeight ?? s.viewBoxHeight, U + 320)
|
|
988
|
+
},
|
|
989
|
+
selectedLayerId: N
|
|
912
990
|
}), [
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
991
|
+
j,
|
|
992
|
+
A,
|
|
993
|
+
U,
|
|
994
|
+
N
|
|
995
|
+
]), G = n(() => ie({
|
|
996
|
+
layers: A,
|
|
997
|
+
theme: M,
|
|
998
|
+
geometry: We(j),
|
|
999
|
+
componentName: b ?? m,
|
|
1000
|
+
importPath: x,
|
|
1001
|
+
ariaLabel: `${m} composition`
|
|
922
1002
|
}), [
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
1003
|
+
j,
|
|
1004
|
+
M,
|
|
1005
|
+
b,
|
|
1006
|
+
x,
|
|
1007
|
+
A,
|
|
1008
|
+
m
|
|
928
1009
|
]);
|
|
929
1010
|
e(() => {
|
|
930
|
-
|
|
931
|
-
}, [
|
|
932
|
-
|
|
933
|
-
}, [
|
|
934
|
-
function
|
|
935
|
-
let r = n.reflow ? d(e,
|
|
936
|
-
t ||
|
|
1011
|
+
N && A.some((e) => e.id === N) || P(A.at(-1)?.id ?? null);
|
|
1012
|
+
}, [A, N]), e(() => {
|
|
1013
|
+
z(!1);
|
|
1014
|
+
}, [G]);
|
|
1015
|
+
function K(e, n = {}) {
|
|
1016
|
+
let r = n.reflow ? d(e, _) : e;
|
|
1017
|
+
t || D(r), l?.(r);
|
|
1018
|
+
}
|
|
1019
|
+
function q(e) {
|
|
1020
|
+
let t = {
|
|
1021
|
+
...j,
|
|
1022
|
+
...e
|
|
1023
|
+
};
|
|
1024
|
+
u || ee(t), p?.(t);
|
|
937
1025
|
}
|
|
938
|
-
function
|
|
939
|
-
|
|
1026
|
+
function J(e, t) {
|
|
1027
|
+
K(A.map((n) => n.id === e ? t(n) : n));
|
|
940
1028
|
}
|
|
941
|
-
function
|
|
942
|
-
|
|
1029
|
+
function me(e) {
|
|
1030
|
+
B && J(B.id, (t) => ({
|
|
943
1031
|
...t,
|
|
944
1032
|
base: {
|
|
945
1033
|
...t.base,
|
|
@@ -947,205 +1035,325 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
947
1035
|
}
|
|
948
1036
|
}));
|
|
949
1037
|
}
|
|
950
|
-
function
|
|
951
|
-
|
|
1038
|
+
function he(e) {
|
|
1039
|
+
B && J(B.id, (t) => ({
|
|
952
1040
|
...t,
|
|
953
1041
|
hover: {
|
|
954
|
-
...t.hover ??
|
|
1042
|
+
...t.hover ?? {},
|
|
955
1043
|
...e
|
|
956
1044
|
}
|
|
957
1045
|
}));
|
|
958
1046
|
}
|
|
959
|
-
function
|
|
1047
|
+
function ge() {
|
|
960
1048
|
let e = {
|
|
961
|
-
id:
|
|
1049
|
+
id: Ve(A),
|
|
962
1050
|
visible: !0,
|
|
963
1051
|
base: {
|
|
964
1052
|
material: "wireframe",
|
|
965
|
-
paletteId:
|
|
1053
|
+
paletteId: A.at(-1)?.base.paletteId ?? "15"
|
|
966
1054
|
}
|
|
967
|
-
}, t = [...
|
|
968
|
-
|
|
1055
|
+
}, t = [...A, e];
|
|
1056
|
+
P(e.id), I("base"), K(t, { reflow: !0 });
|
|
969
1057
|
}
|
|
970
|
-
function
|
|
971
|
-
if (!
|
|
972
|
-
let e =
|
|
973
|
-
|
|
1058
|
+
function _e() {
|
|
1059
|
+
if (!B) return;
|
|
1060
|
+
let e = A.filter((e) => e.id !== B.id);
|
|
1061
|
+
P(e.at(-1)?.id ?? null), I("base"), K(e, { reflow: !0 });
|
|
974
1062
|
}
|
|
975
|
-
function
|
|
976
|
-
|
|
1063
|
+
function ve(e) {
|
|
1064
|
+
J(e, (e) => ({
|
|
977
1065
|
...e,
|
|
978
1066
|
visible: e.visible === !1
|
|
979
1067
|
}));
|
|
980
1068
|
}
|
|
981
|
-
function
|
|
982
|
-
|
|
1069
|
+
function ye(e) {
|
|
1070
|
+
S || k(e), w?.(e);
|
|
983
1071
|
}
|
|
984
|
-
async function
|
|
1072
|
+
async function be() {
|
|
985
1073
|
try {
|
|
986
|
-
await navigator.clipboard.writeText(
|
|
1074
|
+
await navigator.clipboard.writeText(G);
|
|
987
1075
|
} catch {
|
|
988
1076
|
let e = document.createElement("textarea");
|
|
989
|
-
e.value =
|
|
1077
|
+
e.value = G, e.setAttribute("readonly", ""), e.style.position = "fixed", e.style.top = "-9999px", document.body.append(e), e.select(), document.execCommand("copy"), e.remove();
|
|
990
1078
|
}
|
|
991
|
-
|
|
1079
|
+
z(!0), window.setTimeout(() => z(!1), 1400);
|
|
992
1080
|
}
|
|
993
1081
|
return /* @__PURE__ */ o("main", {
|
|
994
1082
|
className: [
|
|
995
1083
|
"squircle-editor",
|
|
996
|
-
`squircle-editor-${
|
|
997
|
-
|
|
1084
|
+
`squircle-editor-${M}`,
|
|
1085
|
+
g
|
|
998
1086
|
].filter(Boolean).join(" "),
|
|
999
|
-
"data-theme":
|
|
1087
|
+
"data-theme": M,
|
|
1000
1088
|
"aria-label": "Squircle editor",
|
|
1001
1089
|
children: [/* @__PURE__ */ o("header", {
|
|
1002
1090
|
className: "squircle-editor-topbar",
|
|
1003
|
-
children: [/* @__PURE__ */ o("div", {
|
|
1091
|
+
children: [/* @__PURE__ */ o("div", {
|
|
1092
|
+
className: "topbar-title",
|
|
1093
|
+
children: [/* @__PURE__ */ a("h1", { children: m }), /* @__PURE__ */ a("p", { children: h })]
|
|
1094
|
+
}), /* @__PURE__ */ a("div", {
|
|
1004
1095
|
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", {
|
|
1096
|
+
children: T ? /* @__PURE__ */ o("div", {
|
|
1097
|
+
className: "theme-switch",
|
|
1098
|
+
role: "group",
|
|
1099
|
+
"aria-label": "Theme",
|
|
1100
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1023
1101
|
type: "button",
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
/* @__PURE__ */ a("button", {
|
|
1102
|
+
"aria-pressed": M === "light",
|
|
1103
|
+
onClick: () => ye("light"),
|
|
1104
|
+
children: "Light"
|
|
1105
|
+
}), /* @__PURE__ */ a("button", {
|
|
1028
1106
|
type: "button",
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1107
|
+
"aria-pressed": M === "dark",
|
|
1108
|
+
onClick: () => ye("dark"),
|
|
1109
|
+
children: "Dark"
|
|
1110
|
+
})]
|
|
1111
|
+
}) : null
|
|
1033
1112
|
})]
|
|
1034
1113
|
}), /* @__PURE__ */ o("section", {
|
|
1035
1114
|
className: "squircle-editor-workspace",
|
|
1036
1115
|
children: [
|
|
1037
1116
|
/* @__PURE__ */ o("aside", {
|
|
1038
|
-
className: "side-panel",
|
|
1039
|
-
children: [
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1117
|
+
className: "side-panel layers-panel",
|
|
1118
|
+
children: [
|
|
1119
|
+
/* @__PURE__ */ o("div", {
|
|
1120
|
+
className: "panel-heading",
|
|
1121
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Layers" }), /* @__PURE__ */ o("span", { children: [
|
|
1122
|
+
ae,
|
|
1123
|
+
"/",
|
|
1124
|
+
A.length,
|
|
1125
|
+
" visible"
|
|
1126
|
+
] })] }), /* @__PURE__ */ o("div", {
|
|
1127
|
+
className: "panel-actions",
|
|
1128
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1049
1129
|
type: "button",
|
|
1050
|
-
className:
|
|
1051
|
-
|
|
1052
|
-
|
|
1130
|
+
className: "icon-button primary-action",
|
|
1131
|
+
"aria-label": "Add layer",
|
|
1132
|
+
title: "Add layer",
|
|
1133
|
+
onClick: ge,
|
|
1134
|
+
children: /* @__PURE__ */ a(je, {})
|
|
1053
1135
|
}), /* @__PURE__ */ a("button", {
|
|
1054
1136
|
type: "button",
|
|
1055
|
-
className: "icon-
|
|
1056
|
-
"aria-
|
|
1057
|
-
|
|
1058
|
-
|
|
1137
|
+
className: "icon-button",
|
|
1138
|
+
"aria-label": "Clear layers",
|
|
1139
|
+
title: "Clear layers",
|
|
1140
|
+
onClick: () => K([]),
|
|
1141
|
+
children: /* @__PURE__ */ a(Me, {})
|
|
1059
1142
|
})]
|
|
1060
|
-
}
|
|
1143
|
+
})]
|
|
1144
|
+
}),
|
|
1145
|
+
/* @__PURE__ */ a("div", {
|
|
1146
|
+
className: "squircle-editor-layer-list",
|
|
1147
|
+
children: [...A].reverse().map((e, t) => {
|
|
1148
|
+
let n = A.length - t, r = Re(e.base.paletteId), i = e.base.material ?? "wireframe";
|
|
1149
|
+
return /* @__PURE__ */ o("article", {
|
|
1150
|
+
className: e.id === N ? "squircle-editor-layer-row is-active" : "squircle-editor-layer-row",
|
|
1151
|
+
children: [/* @__PURE__ */ o("button", {
|
|
1152
|
+
type: "button",
|
|
1153
|
+
className: "layer-select",
|
|
1154
|
+
onClick: () => P(e.id),
|
|
1155
|
+
title: `Edit ${Be(e.id, n, A.length)}`,
|
|
1156
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1157
|
+
className: "layer-card-topline",
|
|
1158
|
+
children: [
|
|
1159
|
+
/* @__PURE__ */ a("span", {
|
|
1160
|
+
className: "layer-number",
|
|
1161
|
+
children: String(n).padStart(2, "0")
|
|
1162
|
+
}),
|
|
1163
|
+
/* @__PURE__ */ a("strong", { children: Be(e.id, n, A.length) }),
|
|
1164
|
+
/* @__PURE__ */ a("span", {
|
|
1165
|
+
className: `material-pill material-pill-${i}`,
|
|
1166
|
+
children: ze(i)
|
|
1167
|
+
})
|
|
1168
|
+
]
|
|
1169
|
+
}), /* @__PURE__ */ o("span", {
|
|
1170
|
+
className: "layer-card-meta",
|
|
1171
|
+
children: [/* @__PURE__ */ o("span", {
|
|
1172
|
+
className: "layer-palette-chip",
|
|
1173
|
+
children: [/* @__PURE__ */ a("span", {
|
|
1174
|
+
className: "palette-swatch",
|
|
1175
|
+
style: { background: `linear-gradient(135deg, ${r.swatch[0]}, ${r.swatch[1]})` }
|
|
1176
|
+
}), r.label]
|
|
1177
|
+
}), /* @__PURE__ */ o("span", {
|
|
1178
|
+
className: "layer-feature-tags",
|
|
1179
|
+
children: [
|
|
1180
|
+
Q(e.base) ? /* @__PURE__ */ a("span", { children: "Text" }) : null,
|
|
1181
|
+
e.base.dash ? /* @__PURE__ */ a("span", { children: "Dash" }) : null,
|
|
1182
|
+
e.hover ? /* @__PURE__ */ a("span", { children: "Hover" }) : null,
|
|
1183
|
+
!Q(e.base) && !e.base.dash && !e.hover ? /* @__PURE__ */ a("span", { children: "Clean" }) : null
|
|
1184
|
+
]
|
|
1185
|
+
})]
|
|
1186
|
+
})]
|
|
1187
|
+
}), /* @__PURE__ */ a("button", {
|
|
1188
|
+
type: "button",
|
|
1189
|
+
className: "icon-button layer-visibility",
|
|
1190
|
+
"aria-label": e.visible === !1 ? "Show layer" : "Hide layer",
|
|
1191
|
+
"aria-pressed": e.visible !== !1,
|
|
1192
|
+
title: e.visible === !1 ? "Show layer" : "Hide layer",
|
|
1193
|
+
onClick: () => ve(e.id),
|
|
1194
|
+
children: e.visible === !1 ? /* @__PURE__ */ a(Pe, {}) : /* @__PURE__ */ a(Ne, {})
|
|
1195
|
+
})]
|
|
1196
|
+
}, e.id);
|
|
1197
|
+
})
|
|
1198
|
+
}),
|
|
1199
|
+
/* @__PURE__ */ o(Y, {
|
|
1200
|
+
title: "Shape",
|
|
1201
|
+
children: [
|
|
1202
|
+
/* @__PURE__ */ a(Z, {
|
|
1203
|
+
label: "Radius",
|
|
1204
|
+
value: He(j.exponent ?? s.exponent),
|
|
1205
|
+
min: ce,
|
|
1206
|
+
max: le,
|
|
1207
|
+
step: 1,
|
|
1208
|
+
formatValue: (e) => `${Math.round(e)}%`,
|
|
1209
|
+
onChange: (e) => q({ exponent: Ue(e) })
|
|
1210
|
+
}),
|
|
1211
|
+
/* @__PURE__ */ a(Z, {
|
|
1212
|
+
label: "Height",
|
|
1213
|
+
value: j.prismHeight ?? s.prismHeight,
|
|
1214
|
+
min: ue,
|
|
1215
|
+
max: de,
|
|
1216
|
+
step: 1,
|
|
1217
|
+
formatValue: (e) => `${Math.round(e)}px`,
|
|
1218
|
+
onChange: (e) => q({ prismHeight: e })
|
|
1219
|
+
}),
|
|
1220
|
+
/* @__PURE__ */ a(Z, {
|
|
1221
|
+
label: "Dash size",
|
|
1222
|
+
value: (j.inlayScale ?? s.inlayScale) * 100,
|
|
1223
|
+
min: fe * 100,
|
|
1224
|
+
max: pe * 100,
|
|
1225
|
+
step: 1,
|
|
1226
|
+
formatValue: (e) => `${Math.round(e)}%`,
|
|
1227
|
+
onChange: (e) => q({ inlayScale: Ke(e / 100, 2) })
|
|
1228
|
+
})
|
|
1229
|
+
]
|
|
1061
1230
|
})
|
|
1062
|
-
|
|
1231
|
+
]
|
|
1063
1232
|
}),
|
|
1064
1233
|
/* @__PURE__ */ o("section", {
|
|
1065
1234
|
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
|
-
|
|
1235
|
+
children: [
|
|
1236
|
+
/* @__PURE__ */ o("div", {
|
|
1237
|
+
className: "preview-toolbar",
|
|
1238
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Preview" }), /* @__PURE__ */ a("span", { children: V ? `Editing Layer ${V}` : `${ae} visible layers` })] }), H ? /* @__PURE__ */ o("div", {
|
|
1239
|
+
className: "preview-actions",
|
|
1240
|
+
children: [/* @__PURE__ */ o("button", {
|
|
1241
|
+
type: "button",
|
|
1242
|
+
className: "code-toggle-button",
|
|
1243
|
+
"aria-pressed": L,
|
|
1244
|
+
onClick: () => re((e) => !e),
|
|
1245
|
+
children: [/* @__PURE__ */ a(Ie, {}), "Code"]
|
|
1246
|
+
}), /* @__PURE__ */ o("button", {
|
|
1247
|
+
type: "button",
|
|
1248
|
+
className: "copy-code-button",
|
|
1249
|
+
"aria-label": "Copy React code",
|
|
1250
|
+
title: "Copy React code",
|
|
1251
|
+
onClick: be,
|
|
1252
|
+
children: [/* @__PURE__ */ a(Ae, {}), /* @__PURE__ */ a("span", {
|
|
1253
|
+
className: "copy-status",
|
|
1254
|
+
"aria-live": "polite",
|
|
1255
|
+
children: R ? "Copied" : ""
|
|
1256
|
+
})]
|
|
1086
1257
|
})]
|
|
1087
|
-
})]
|
|
1088
|
-
}),
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1258
|
+
}) : null]
|
|
1259
|
+
}),
|
|
1260
|
+
/* @__PURE__ */ a("div", {
|
|
1261
|
+
className: "preview-stage",
|
|
1262
|
+
children: /* @__PURE__ */ a(te, {
|
|
1263
|
+
...W,
|
|
1264
|
+
theme: M,
|
|
1265
|
+
ariaLabel: "Editable squircle composition",
|
|
1266
|
+
onLayerSelect: (e) => {
|
|
1267
|
+
P(e), I("base");
|
|
1268
|
+
}
|
|
1269
|
+
})
|
|
1270
|
+
}),
|
|
1271
|
+
H ? /* @__PURE__ */ o("section", {
|
|
1272
|
+
className: L ? "code-panel is-open" : "code-panel",
|
|
1273
|
+
"aria-label": "Generated React code",
|
|
1274
|
+
children: [/* @__PURE__ */ o("header", {
|
|
1275
|
+
className: "code-panel-header",
|
|
1276
|
+
children: [/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("h2", { children: "Code" }), /* @__PURE__ */ a("p", { children: "Ready-to-use React component." })] }), /* @__PURE__ */ o("button", {
|
|
1277
|
+
type: "button",
|
|
1278
|
+
className: "copy-code-button",
|
|
1279
|
+
"aria-label": "Copy React code",
|
|
1280
|
+
title: "Copy React code",
|
|
1281
|
+
onClick: be,
|
|
1282
|
+
children: [/* @__PURE__ */ a(Ae, {}), /* @__PURE__ */ a("span", {
|
|
1283
|
+
className: "copy-status",
|
|
1284
|
+
"aria-live": "polite",
|
|
1285
|
+
children: R ? "Copied" : ""
|
|
1286
|
+
})]
|
|
1287
|
+
})]
|
|
1288
|
+
}), L ? /* @__PURE__ */ a("pre", {
|
|
1289
|
+
className: "code-output",
|
|
1290
|
+
children: /* @__PURE__ */ a("code", { children: G })
|
|
1291
|
+
}) : null]
|
|
1292
|
+
}) : null
|
|
1293
|
+
]
|
|
1093
1294
|
}),
|
|
1094
1295
|
/* @__PURE__ */ a("aside", {
|
|
1095
|
-
className:
|
|
1096
|
-
children:
|
|
1296
|
+
className: B ? "side-panel inspector-panel" : "side-panel inspector-panel is-empty",
|
|
1297
|
+
children: B ? /* @__PURE__ */ o(i, { children: [
|
|
1097
1298
|
/* @__PURE__ */ o("div", {
|
|
1098
|
-
className: "
|
|
1099
|
-
children: [/* @__PURE__ */
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1299
|
+
className: "inspector-heading",
|
|
1300
|
+
children: [/* @__PURE__ */ o("div", { children: [
|
|
1301
|
+
/* @__PURE__ */ a("span", {
|
|
1302
|
+
className: "inspector-kicker",
|
|
1303
|
+
children: "Selected"
|
|
1304
|
+
}),
|
|
1305
|
+
/* @__PURE__ */ a("h2", { children: V ? Be(B.id, V, A.length) : B.id }),
|
|
1306
|
+
/* @__PURE__ */ a("p", { children: Le(B.base) })
|
|
1307
|
+
] }), /* @__PURE__ */ o("div", {
|
|
1308
|
+
className: "panel-actions",
|
|
1309
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1310
|
+
type: "button",
|
|
1311
|
+
className: "icon-button",
|
|
1312
|
+
"aria-label": "Close inspector",
|
|
1313
|
+
title: "Close inspector",
|
|
1314
|
+
onClick: () => P(null),
|
|
1315
|
+
children: /* @__PURE__ */ a(Fe, {})
|
|
1316
|
+
}), /* @__PURE__ */ a("button", {
|
|
1317
|
+
type: "button",
|
|
1318
|
+
className: "icon-button danger",
|
|
1319
|
+
"aria-label": "Delete layer",
|
|
1320
|
+
title: "Delete layer",
|
|
1321
|
+
onClick: _e,
|
|
1322
|
+
children: /* @__PURE__ */ a(Me, {})
|
|
1323
|
+
})]
|
|
1104
1324
|
})]
|
|
1105
1325
|
}),
|
|
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
|
-
]
|
|
1326
|
+
/* @__PURE__ */ o("div", {
|
|
1327
|
+
className: "state-switch",
|
|
1328
|
+
role: "group",
|
|
1329
|
+
"aria-label": "Layer state",
|
|
1330
|
+
children: [/* @__PURE__ */ a("button", {
|
|
1331
|
+
type: "button",
|
|
1332
|
+
"aria-pressed": F === "base",
|
|
1333
|
+
onClick: () => I("base"),
|
|
1334
|
+
children: "Base"
|
|
1335
|
+
}), /* @__PURE__ */ o("button", {
|
|
1336
|
+
type: "button",
|
|
1337
|
+
"aria-pressed": F === "hover",
|
|
1338
|
+
onClick: () => I("hover"),
|
|
1339
|
+
children: ["Hover", B.hover ? /* @__PURE__ */ a("span", {
|
|
1340
|
+
className: "state-dot",
|
|
1341
|
+
"aria-hidden": "true"
|
|
1342
|
+
}) : null]
|
|
1343
|
+
})]
|
|
1141
1344
|
}),
|
|
1142
|
-
/* @__PURE__ */
|
|
1143
|
-
title: "
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1345
|
+
F === "base" ? /* @__PURE__ */ a(we, {
|
|
1346
|
+
title: "Base State",
|
|
1347
|
+
variant: B.base,
|
|
1348
|
+
onChange: me
|
|
1349
|
+
}) : /* @__PURE__ */ o(Y, {
|
|
1350
|
+
title: "Hover State",
|
|
1351
|
+
children: [/* @__PURE__ */ a(Ee, {
|
|
1352
|
+
label: "Hover variant",
|
|
1353
|
+
checked: !!B.hover,
|
|
1354
|
+
title: "Swap this layer to another variant on hover.",
|
|
1147
1355
|
onChange: (e) => {
|
|
1148
|
-
|
|
1356
|
+
J(B.id, (t) => ({
|
|
1149
1357
|
...t,
|
|
1150
1358
|
hover: e ? {
|
|
1151
1359
|
...t.base,
|
|
@@ -1153,26 +1361,26 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1153
1361
|
} : void 0
|
|
1154
1362
|
}));
|
|
1155
1363
|
}
|
|
1156
|
-
}),
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
onChange: (e) => V({ paletteId: e })
|
|
1164
|
-
})] }) : null]
|
|
1364
|
+
}), B.hover ? /* @__PURE__ */ a(Te, {
|
|
1365
|
+
variant: {
|
|
1366
|
+
...B.base,
|
|
1367
|
+
...B.hover
|
|
1368
|
+
},
|
|
1369
|
+
onChange: he
|
|
1370
|
+
}) : null]
|
|
1165
1371
|
}),
|
|
1166
|
-
/* @__PURE__ */ o(
|
|
1372
|
+
/* @__PURE__ */ o(Y, {
|
|
1167
1373
|
title: "Stroke Widths",
|
|
1374
|
+
collapsible: !0,
|
|
1375
|
+
defaultOpen: !1,
|
|
1168
1376
|
children: [
|
|
1169
|
-
/* @__PURE__ */ a(
|
|
1377
|
+
/* @__PURE__ */ a(Z, {
|
|
1170
1378
|
label: "Face",
|
|
1171
|
-
value:
|
|
1379
|
+
value: B.stroke?.face ?? .35,
|
|
1172
1380
|
min: 0,
|
|
1173
1381
|
max: 1.5,
|
|
1174
1382
|
step: .05,
|
|
1175
|
-
onChange: (e) =>
|
|
1383
|
+
onChange: (e) => J(B.id, (t) => ({
|
|
1176
1384
|
...t,
|
|
1177
1385
|
stroke: {
|
|
1178
1386
|
...t.stroke,
|
|
@@ -1180,13 +1388,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1180
1388
|
}
|
|
1181
1389
|
}))
|
|
1182
1390
|
}),
|
|
1183
|
-
/* @__PURE__ */ a(
|
|
1391
|
+
/* @__PURE__ */ a(Z, {
|
|
1184
1392
|
label: "Wire",
|
|
1185
|
-
value:
|
|
1393
|
+
value: B.stroke?.wire ?? 1.6,
|
|
1186
1394
|
min: .4,
|
|
1187
1395
|
max: 4,
|
|
1188
1396
|
step: .1,
|
|
1189
|
-
onChange: (e) =>
|
|
1397
|
+
onChange: (e) => J(B.id, (t) => ({
|
|
1190
1398
|
...t,
|
|
1191
1399
|
stroke: {
|
|
1192
1400
|
...t.stroke,
|
|
@@ -1194,13 +1402,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1194
1402
|
}
|
|
1195
1403
|
}))
|
|
1196
1404
|
}),
|
|
1197
|
-
/* @__PURE__ */ a(
|
|
1405
|
+
/* @__PURE__ */ a(Z, {
|
|
1198
1406
|
label: "Dash",
|
|
1199
|
-
value:
|
|
1407
|
+
value: B.stroke?.dash ?? 2.2,
|
|
1200
1408
|
min: .6,
|
|
1201
1409
|
max: 5,
|
|
1202
1410
|
step: .1,
|
|
1203
|
-
onChange: (e) =>
|
|
1411
|
+
onChange: (e) => J(B.id, (t) => ({
|
|
1204
1412
|
...t,
|
|
1205
1413
|
stroke: {
|
|
1206
1414
|
...t.stroke,
|
|
@@ -1208,13 +1416,13 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1208
1416
|
}
|
|
1209
1417
|
}))
|
|
1210
1418
|
}),
|
|
1211
|
-
/* @__PURE__ */ a(
|
|
1419
|
+
/* @__PURE__ */ a(Z, {
|
|
1212
1420
|
label: "Text outline",
|
|
1213
|
-
value:
|
|
1421
|
+
value: B.stroke?.labelWire ?? 1.1,
|
|
1214
1422
|
min: .4,
|
|
1215
1423
|
max: 2,
|
|
1216
1424
|
step: .05,
|
|
1217
|
-
onChange: (e) =>
|
|
1425
|
+
onChange: (e) => J(B.id, (t) => ({
|
|
1218
1426
|
...t,
|
|
1219
1427
|
stroke: {
|
|
1220
1428
|
...t.stroke,
|
|
@@ -1224,58 +1432,201 @@ function ce({ value: t, initialLayers: s, onChange: c, title: l = "Squircle", de
|
|
|
1224
1432
|
})
|
|
1225
1433
|
]
|
|
1226
1434
|
})
|
|
1227
|
-
] }) : /* @__PURE__ */
|
|
1435
|
+
] }) : /* @__PURE__ */ o("div", {
|
|
1228
1436
|
className: "empty-note",
|
|
1229
|
-
children:
|
|
1437
|
+
children: [/* @__PURE__ */ a("h2", { children: "No layer selected" }), /* @__PURE__ */ a("button", {
|
|
1438
|
+
type: "button",
|
|
1439
|
+
className: "primary-action",
|
|
1440
|
+
onClick: ge,
|
|
1441
|
+
children: "Add layer"
|
|
1442
|
+
})]
|
|
1230
1443
|
})
|
|
1231
1444
|
})
|
|
1232
1445
|
]
|
|
1233
1446
|
})]
|
|
1234
1447
|
});
|
|
1235
1448
|
}
|
|
1236
|
-
function
|
|
1237
|
-
return /* @__PURE__ */ o("
|
|
1449
|
+
function Y({ title: e, children: t, collapsible: n = !1, defaultOpen: r = !0 }) {
|
|
1450
|
+
return n ? /* @__PURE__ */ o("details", {
|
|
1451
|
+
className: "editor-section editor-section-details",
|
|
1452
|
+
open: r,
|
|
1453
|
+
children: [/* @__PURE__ */ a("summary", { children: /* @__PURE__ */ a("h3", { children: e }) }), /* @__PURE__ */ a("div", {
|
|
1454
|
+
className: "editor-section-body",
|
|
1455
|
+
children: t
|
|
1456
|
+
})]
|
|
1457
|
+
}) : /* @__PURE__ */ o("section", {
|
|
1238
1458
|
className: "editor-section",
|
|
1239
1459
|
children: [/* @__PURE__ */ a("h3", { children: e }), t]
|
|
1240
1460
|
});
|
|
1241
1461
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return /* @__PURE__ */
|
|
1462
|
+
function we({ title: e, variant: t, onChange: n }) {
|
|
1463
|
+
return /* @__PURE__ */ a(Y, {
|
|
1464
|
+
title: e,
|
|
1465
|
+
children: /* @__PURE__ */ a(Te, {
|
|
1466
|
+
variant: t,
|
|
1467
|
+
onChange: n
|
|
1468
|
+
})
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
function Te({ variant: e, onChange: t }) {
|
|
1472
|
+
return /* @__PURE__ */ o("div", {
|
|
1473
|
+
className: "variant-controls",
|
|
1474
|
+
children: [
|
|
1475
|
+
/* @__PURE__ */ a(X, {
|
|
1476
|
+
label: "Material",
|
|
1477
|
+
value: e.material ?? "wireframe",
|
|
1478
|
+
options: ve,
|
|
1479
|
+
onChange: (e) => t({ material: e })
|
|
1480
|
+
}),
|
|
1481
|
+
/* @__PURE__ */ a(Oe, {
|
|
1482
|
+
value: e.paletteId ?? "15",
|
|
1483
|
+
onChange: (e) => t({ paletteId: e })
|
|
1484
|
+
}),
|
|
1485
|
+
/* @__PURE__ */ o("div", {
|
|
1486
|
+
className: "feature-grid",
|
|
1487
|
+
"aria-label": "Top details",
|
|
1488
|
+
children: [/* @__PURE__ */ a(Ee, {
|
|
1489
|
+
label: "Text",
|
|
1490
|
+
checked: Q(e),
|
|
1491
|
+
title: "Toggle top-plane text for this state.",
|
|
1492
|
+
onChange: (n) => t(n ? {
|
|
1493
|
+
text: qe(e),
|
|
1494
|
+
textColor: Ye(e)
|
|
1495
|
+
} : {
|
|
1496
|
+
text: !1,
|
|
1497
|
+
textColor: void 0
|
|
1498
|
+
})
|
|
1499
|
+
}), /* @__PURE__ */ a(Ee, {
|
|
1500
|
+
label: "Dash",
|
|
1501
|
+
checked: e.dash ?? !1,
|
|
1502
|
+
title: "Toggle the dashed inlay for this state.",
|
|
1503
|
+
onChange: (n) => t(n ? {
|
|
1504
|
+
dash: !0,
|
|
1505
|
+
dashColor: Xe(e)
|
|
1506
|
+
} : {
|
|
1507
|
+
dash: !1,
|
|
1508
|
+
dashColor: void 0
|
|
1509
|
+
})
|
|
1510
|
+
})]
|
|
1511
|
+
}),
|
|
1512
|
+
Q(e) ? /* @__PURE__ */ o("div", {
|
|
1513
|
+
className: "nested-fields",
|
|
1514
|
+
children: [
|
|
1515
|
+
/* @__PURE__ */ a(ke, {
|
|
1516
|
+
label: "Text",
|
|
1517
|
+
value: qe(e),
|
|
1518
|
+
onChange: (e) => t({ text: e })
|
|
1519
|
+
}),
|
|
1520
|
+
/* @__PURE__ */ a(X, {
|
|
1521
|
+
label: "Text paint",
|
|
1522
|
+
value: Je(e),
|
|
1523
|
+
options: ye,
|
|
1524
|
+
onChange: (e) => t({ textStyle: e })
|
|
1525
|
+
}),
|
|
1526
|
+
/* @__PURE__ */ a(De, {
|
|
1527
|
+
label: "Text color",
|
|
1528
|
+
value: Ye(e),
|
|
1529
|
+
forcedValue: Qe(e),
|
|
1530
|
+
onChange: (e) => t({ textColor: e })
|
|
1531
|
+
}),
|
|
1532
|
+
/* @__PURE__ */ a(Z, {
|
|
1533
|
+
label: "Text size",
|
|
1534
|
+
value: e.textSize ?? ge,
|
|
1535
|
+
min: me,
|
|
1536
|
+
max: he,
|
|
1537
|
+
step: 1,
|
|
1538
|
+
formatValue: (e) => `${Math.round(e)}px`,
|
|
1539
|
+
onChange: (e) => t({ textSize: e })
|
|
1540
|
+
}),
|
|
1541
|
+
/* @__PURE__ */ a(X, {
|
|
1542
|
+
label: "Font weight",
|
|
1543
|
+
value: String(e.textFontWeight ?? _e),
|
|
1544
|
+
options: xe,
|
|
1545
|
+
onChange: (e) => t({ textFontWeight: Number(e) })
|
|
1546
|
+
})
|
|
1547
|
+
]
|
|
1548
|
+
}) : null,
|
|
1549
|
+
e.dash ? /* @__PURE__ */ a("div", {
|
|
1550
|
+
className: "nested-fields",
|
|
1551
|
+
children: /* @__PURE__ */ a(De, {
|
|
1552
|
+
label: "Dash color",
|
|
1553
|
+
value: Xe(e),
|
|
1554
|
+
forcedValue: $e(e),
|
|
1555
|
+
onChange: (e) => t({ dashColor: e })
|
|
1556
|
+
})
|
|
1557
|
+
}) : null
|
|
1558
|
+
]
|
|
1559
|
+
});
|
|
1560
|
+
}
|
|
1561
|
+
function Ee({ label: e, checked: t, title: n, onChange: r }) {
|
|
1562
|
+
return /* @__PURE__ */ o("button", {
|
|
1563
|
+
type: "button",
|
|
1564
|
+
className: "feature-switch",
|
|
1565
|
+
"aria-pressed": t,
|
|
1566
|
+
title: n,
|
|
1567
|
+
onClick: () => r(!t),
|
|
1568
|
+
children: [/* @__PURE__ */ a("span", {
|
|
1569
|
+
className: "feature-switch-label",
|
|
1570
|
+
children: e
|
|
1571
|
+
}), /* @__PURE__ */ a("span", {
|
|
1572
|
+
className: "feature-switch-state",
|
|
1573
|
+
children: t ? "On" : "Off"
|
|
1574
|
+
})]
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1577
|
+
function De({ label: e, value: t, forcedValue: n, onChange: r }) {
|
|
1578
|
+
return n ? /* @__PURE__ */ o("div", {
|
|
1244
1579
|
className: "field",
|
|
1245
|
-
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
children: n
|
|
1249
|
-
value: e,
|
|
1250
|
-
children: e
|
|
1251
|
-
}, e))
|
|
1580
|
+
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("div", {
|
|
1581
|
+
className: "forced-token",
|
|
1582
|
+
title: "This material controls annotation paint from the wireframe palette.",
|
|
1583
|
+
children: n
|
|
1252
1584
|
})]
|
|
1585
|
+
}) : /* @__PURE__ */ a(X, {
|
|
1586
|
+
label: e,
|
|
1587
|
+
value: t,
|
|
1588
|
+
options: be,
|
|
1589
|
+
onChange: r
|
|
1253
1590
|
});
|
|
1254
1591
|
}
|
|
1255
|
-
function
|
|
1256
|
-
return /* @__PURE__ */ o("
|
|
1592
|
+
function X({ label: e, value: t, options: n, onChange: r }) {
|
|
1593
|
+
return /* @__PURE__ */ o("div", {
|
|
1257
1594
|
className: "field",
|
|
1258
|
-
children: [/* @__PURE__ */ a("span", { children:
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1595
|
+
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("div", {
|
|
1596
|
+
className: "segmented-field",
|
|
1597
|
+
role: "group",
|
|
1598
|
+
"aria-label": e,
|
|
1599
|
+
children: n.map((e) => /* @__PURE__ */ a("button", {
|
|
1600
|
+
type: "button",
|
|
1601
|
+
title: e.title,
|
|
1602
|
+
"aria-pressed": e.value === t,
|
|
1603
|
+
onClick: () => r(e.value),
|
|
1604
|
+
children: e.label
|
|
1605
|
+
}, e.value))
|
|
1265
1606
|
})]
|
|
1266
1607
|
});
|
|
1267
1608
|
}
|
|
1268
|
-
function
|
|
1269
|
-
return /* @__PURE__ */ o("
|
|
1270
|
-
className: "
|
|
1271
|
-
children: [/* @__PURE__ */ a("
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1609
|
+
function Oe({ value: e, onChange: t }) {
|
|
1610
|
+
return /* @__PURE__ */ o("div", {
|
|
1611
|
+
className: "field palette-field",
|
|
1612
|
+
children: [/* @__PURE__ */ a("span", { children: "Palette" }), /* @__PURE__ */ a("div", {
|
|
1613
|
+
className: "palette-grid",
|
|
1614
|
+
role: "group",
|
|
1615
|
+
"aria-label": "Palette",
|
|
1616
|
+
children: x.map((n) => /* @__PURE__ */ o("button", {
|
|
1617
|
+
type: "button",
|
|
1618
|
+
title: b[n].label,
|
|
1619
|
+
"aria-pressed": e === n,
|
|
1620
|
+
onClick: () => t(n),
|
|
1621
|
+
children: [/* @__PURE__ */ a("span", {
|
|
1622
|
+
className: "palette-swatch",
|
|
1623
|
+
style: { background: `linear-gradient(135deg, ${b[n].swatch[0]}, ${b[n].swatch[1]})` }
|
|
1624
|
+
}), /* @__PURE__ */ a("span", { children: n })]
|
|
1625
|
+
}, n))
|
|
1626
|
+
})]
|
|
1276
1627
|
});
|
|
1277
1628
|
}
|
|
1278
|
-
function
|
|
1629
|
+
function ke({ label: e, value: t, onChange: n }) {
|
|
1279
1630
|
return /* @__PURE__ */ o("label", {
|
|
1280
1631
|
className: "field",
|
|
1281
1632
|
children: [/* @__PURE__ */ a("span", { children: e }), /* @__PURE__ */ a("input", {
|
|
@@ -1285,24 +1636,24 @@ function ue({ label: e, value: t, onChange: n }) {
|
|
|
1285
1636
|
})]
|
|
1286
1637
|
});
|
|
1287
1638
|
}
|
|
1288
|
-
function
|
|
1639
|
+
function Z({ label: e, value: t, min: n, max: r, step: i, formatValue: s, onChange: c }) {
|
|
1289
1640
|
return /* @__PURE__ */ o("label", {
|
|
1290
1641
|
className: "field",
|
|
1291
1642
|
children: [/* @__PURE__ */ o("span", { children: [
|
|
1292
1643
|
e,
|
|
1293
1644
|
": ",
|
|
1294
|
-
t.toFixed(2)
|
|
1645
|
+
s ? s(t) : t.toFixed(2)
|
|
1295
1646
|
] }), /* @__PURE__ */ a("input", {
|
|
1296
1647
|
type: "range",
|
|
1297
1648
|
min: n,
|
|
1298
1649
|
max: r,
|
|
1299
1650
|
step: i,
|
|
1300
1651
|
value: t,
|
|
1301
|
-
onChange: (e) =>
|
|
1652
|
+
onChange: (e) => c(Number(e.target.value))
|
|
1302
1653
|
})]
|
|
1303
1654
|
});
|
|
1304
1655
|
}
|
|
1305
|
-
function
|
|
1656
|
+
function Ae() {
|
|
1306
1657
|
return /* @__PURE__ */ o("svg", {
|
|
1307
1658
|
className: "copy-icon",
|
|
1308
1659
|
viewBox: "0 0 24 24",
|
|
@@ -1317,23 +1668,125 @@ function de() {
|
|
|
1317
1668
|
}), /* @__PURE__ */ a("path", { d: "M5 15V6.8C5 5.8 5.8 5 6.8 5H15" })]
|
|
1318
1669
|
});
|
|
1319
1670
|
}
|
|
1320
|
-
function
|
|
1321
|
-
|
|
1322
|
-
|
|
1671
|
+
function je() {
|
|
1672
|
+
return /* @__PURE__ */ a("svg", {
|
|
1673
|
+
viewBox: "0 0 24 24",
|
|
1674
|
+
"aria-hidden": "true",
|
|
1675
|
+
focusable: "false",
|
|
1676
|
+
children: /* @__PURE__ */ a("path", { d: "M12 5v14M5 12h14" })
|
|
1677
|
+
});
|
|
1678
|
+
}
|
|
1679
|
+
function Me() {
|
|
1680
|
+
return /* @__PURE__ */ a("svg", {
|
|
1681
|
+
viewBox: "0 0 24 24",
|
|
1682
|
+
"aria-hidden": "true",
|
|
1683
|
+
focusable: "false",
|
|
1684
|
+
children: /* @__PURE__ */ a("path", { d: "M4 7h16M10 11v6M14 11v6M6 7l1 13h10l1-13M9 7V4h6v3" })
|
|
1685
|
+
});
|
|
1323
1686
|
}
|
|
1324
|
-
function
|
|
1325
|
-
return
|
|
1687
|
+
function Ne() {
|
|
1688
|
+
return /* @__PURE__ */ o("svg", {
|
|
1689
|
+
viewBox: "0 0 24 24",
|
|
1690
|
+
"aria-hidden": "true",
|
|
1691
|
+
focusable: "false",
|
|
1692
|
+
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", {
|
|
1693
|
+
cx: "12",
|
|
1694
|
+
cy: "12",
|
|
1695
|
+
r: "2.8"
|
|
1696
|
+
})]
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
function Pe() {
|
|
1700
|
+
return /* @__PURE__ */ a("svg", {
|
|
1701
|
+
viewBox: "0 0 24 24",
|
|
1702
|
+
"aria-hidden": "true",
|
|
1703
|
+
focusable: "false",
|
|
1704
|
+
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" })
|
|
1705
|
+
});
|
|
1706
|
+
}
|
|
1707
|
+
function Fe() {
|
|
1708
|
+
return /* @__PURE__ */ a("svg", {
|
|
1709
|
+
viewBox: "0 0 24 24",
|
|
1710
|
+
"aria-hidden": "true",
|
|
1711
|
+
focusable: "false",
|
|
1712
|
+
children: /* @__PURE__ */ a("path", { d: "M6 6l12 12M18 6L6 18" })
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
function Ie() {
|
|
1716
|
+
return /* @__PURE__ */ a("svg", {
|
|
1717
|
+
viewBox: "0 0 24 24",
|
|
1718
|
+
"aria-hidden": "true",
|
|
1719
|
+
focusable: "false",
|
|
1720
|
+
children: /* @__PURE__ */ a("path", { d: "M9 18 3 12l6-6M15 6l6 6-6 6" })
|
|
1721
|
+
});
|
|
1722
|
+
}
|
|
1723
|
+
function Le(e) {
|
|
1724
|
+
let t = [ze(e.material ?? "wireframe"), Re(e.paletteId).label];
|
|
1725
|
+
return Q(e) && t.push(`text: ${qe(e)}`), e.dash && t.push("dash"), t.join(" / ");
|
|
1726
|
+
}
|
|
1727
|
+
function Re(e) {
|
|
1728
|
+
return b[e] ?? b[15];
|
|
1729
|
+
}
|
|
1730
|
+
function ze(e) {
|
|
1731
|
+
return e === "transparent" ? "Glass" : e === "solid" ? "Solid" : "Wire";
|
|
1732
|
+
}
|
|
1733
|
+
function Be(e, t, n) {
|
|
1734
|
+
return `Layer ${t}`;
|
|
1735
|
+
}
|
|
1736
|
+
function Ve(e) {
|
|
1737
|
+
let t = new Set(e.map((e) => e.id)), n = e.length + 1;
|
|
1738
|
+
for (; t.has(`layer-${n}`);) n += 1;
|
|
1739
|
+
return `layer-${n}`;
|
|
1740
|
+
}
|
|
1741
|
+
function He(e) {
|
|
1742
|
+
let t = (J - e) / (J - q);
|
|
1743
|
+
return Ge(Math.round(t * 100), ce, le);
|
|
1744
|
+
}
|
|
1745
|
+
function Ue(e) {
|
|
1746
|
+
return Ke(J - Ge(e, ce, le) / 100 * (J - q), 1);
|
|
1747
|
+
}
|
|
1748
|
+
function We(e) {
|
|
1749
|
+
return {
|
|
1750
|
+
exponent: e.exponent ?? s.exponent,
|
|
1751
|
+
prismHeight: e.prismHeight ?? s.prismHeight,
|
|
1752
|
+
inlayScale: e.inlayScale ?? s.inlayScale
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
function Ge(e, t, n) {
|
|
1756
|
+
return Math.min(n, Math.max(t, e));
|
|
1757
|
+
}
|
|
1758
|
+
function Ke(e, t) {
|
|
1759
|
+
let n = 10 ** t;
|
|
1760
|
+
return Math.round(e * n) / n;
|
|
1326
1761
|
}
|
|
1327
1762
|
function Q(e) {
|
|
1328
|
-
return typeof e.text == "string" ? e.text :
|
|
1763
|
+
return typeof e.text == "string" ? e.text.trim().length > 0 : e.text === !0 || $(e).gpu === !0;
|
|
1764
|
+
}
|
|
1765
|
+
function qe(e) {
|
|
1766
|
+
return typeof e.text == "string" ? e.text : (e.text === !0 || $(e).gpu, K);
|
|
1329
1767
|
}
|
|
1330
|
-
function
|
|
1768
|
+
function Je(e) {
|
|
1331
1769
|
return e.textStyle ?? $(e).gpuStyle ?? "solid";
|
|
1332
1770
|
}
|
|
1771
|
+
function Ye(e) {
|
|
1772
|
+
return Ze(e.textColor ?? $(e).gpuColor ?? "contrast");
|
|
1773
|
+
}
|
|
1774
|
+
function Xe(e) {
|
|
1775
|
+
return Ze(e.dashColor ?? "contrast");
|
|
1776
|
+
}
|
|
1777
|
+
function Ze(e) {
|
|
1778
|
+
return e === "contrast" ? "auto" : e;
|
|
1779
|
+
}
|
|
1780
|
+
function Qe(e) {
|
|
1781
|
+
return (e.material ?? "wireframe") === "wireframe" ? Je(e) === "wireframe" ? "Wire gradient" : "Surface gradient" : null;
|
|
1782
|
+
}
|
|
1783
|
+
function $e(e) {
|
|
1784
|
+
return (e.material ?? "wireframe") === "wireframe" ? "Wire gradient" : null;
|
|
1785
|
+
}
|
|
1333
1786
|
function $(e) {
|
|
1334
1787
|
return e;
|
|
1335
1788
|
}
|
|
1336
1789
|
//#endregion
|
|
1337
|
-
export { s as DEFAULT_GEOMETRY, S as DEFAULT_PALETTE_ID, b as SQUIRCLE_PALETTES, x as SQUIRCLE_PALETTE_IDS,
|
|
1790
|
+
export { s as DEFAULT_GEOMETRY, S as DEFAULT_PALETTE_ID, b as SQUIRCLE_PALETTES, x as SQUIRCLE_PALETTE_IDS, Ce as SquircleEditor, te as SquircleScene, Se as createDefaultSquircleEditorLayers, c as createSquircleGeometry, u as createSquircleLayers, ie as createSquircleReactCode, C as getSquirclePalette, d as reflowLayerOffsets, G as toComponentName };
|
|
1338
1791
|
|
|
1339
1792
|
//# sourceMappingURL=sqircle.js.map
|