@orangecheck/design 0.28.8 → 0.28.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -972,40 +972,86 @@ var OC_GLYPHS = {
972
972
  btc: `<path d="M373 1414V1676H531V1414ZM670 1414V1676H829V1414ZM373 -186V76H531V-186ZM670 -186V76H829V-186ZM129 0V1490H705Q863 1490 972.50 1441Q1082 1392 1139 1305.50Q1196 1219 1196 1103Q1196 1016 1164 951Q1132 886 1074 843Q1016 800 937 779V774Q1024 765 1095.50 721Q1167 677 1210 600.50Q1253 524 1253 416Q1253 293 1194.50 199Q1136 105 1020 52.50Q904 0 731 0ZM391 217H700Q838 217 910.50 272.50Q983 328 983 428Q983 497 950 547.50Q917 598 855.50 626Q794 654 707 654H391ZM391 858H688Q762 858 817 883.50Q872 909 902 956Q932 1003 932 1068Q932 1161 868 1217.50Q804 1274 689 1274H391Z" fill="__INK__" transform="translate(238.3907 806.9912) scale(0.395961 -0.395961)"/>`
973
973
  };
974
974
  var DEPTH = 22;
975
- var Z_STEP = 3;
976
975
  var LAYERS = Array.from({ length: DEPTH }, (_, i) => i);
977
- function layerStyle(i) {
976
+ var FILL = /* @__PURE__ */ new Set(["orangecheck", "btc", "vote"]);
977
+ var INK = "var(--oc-sigil-ink, var(--oc-sigil-ink-base, var(--primary)))";
978
+ var LIFT = "var(--oc-sigil-lift, white)";
979
+ var SHADE = `var(--oc-sigil-shade, color-mix(in oklab, black, ${INK} 30%))`;
980
+ function layerStyle(i, relief) {
978
981
  const t = i / (DEPTH - 1);
979
- const ink = "var(--oc-sigil-ink, var(--primary))";
980
- const bg = "var(--oc-sigil-bg, var(--background))";
981
982
  let color;
982
983
  if (t < 0.14) {
983
- color = `color-mix(in oklab, ${ink}, white ${Math.round((0.14 - t) * 26)}%)`;
984
- } else if (t < 0.6) {
985
- const k = (t - 0.14) / 0.46;
986
- color = `color-mix(in oklab, ${ink}, black ${Math.round(k * 34)}%)`;
984
+ color = `color-mix(in oklab, ${INK}, ${LIFT} ${Math.round((0.14 - t) / 0.14 * 18)}%)`;
985
+ } else if (t < 0.55) {
986
+ const k = (t - 0.14) / 0.41;
987
+ color = `color-mix(in oklab, ${INK}, ${SHADE} ${Math.round(k * 45)}%)`;
987
988
  } else {
988
- const k = (t - 0.6) / 0.4;
989
- color = `color-mix(in oklab, color-mix(in oklab, ${ink}, black 34%), ${bg} ${Math.round(k * 100)}%)`;
989
+ const k = (t - 0.55) / 0.45;
990
+ color = `color-mix(in oklab, color-mix(in oklab, ${INK}, ${SHADE} 45%), transparent ${Math.round(Math.pow(k, 1.3) * 100)}%)`;
990
991
  }
991
- return {
992
- transform: `translateZ(${-i * Z_STEP}px)`,
993
- color
994
- };
995
- }
996
- function sub(markup) {
997
- return markup.split("__INK__").join("currentColor").split("__BG__").join("none").split("__FG__").join("none");
992
+ return { transform: `translateZ(${(-Math.pow(t, 1.4) * relief).toFixed(1)}px)`, color };
993
+ }
994
+ var TILE = /* @__PURE__ */ new Set(["stamp", "pledge", "cosign", "me", "fleet", "docs"]);
995
+ var FOCUS = {
996
+ stamp: "translate(512 512) scale(1.5) translate(-512 -512)",
997
+ // anchor-cross
998
+ pledge: "translate(512 512) scale(1.7) translate(-491 -512)",
999
+ // ₱ mark, recentered
1000
+ cosign: "translate(512 512) scale(1.35) translate(-512 -512)",
1001
+ // two figures
1002
+ me: "translate(512 512) scale(1.45) translate(-512 -544)",
1003
+ // bust, recentered down
1004
+ fleet: "translate(512 512) scale(1.5) translate(-512 -512)",
1005
+ // play + bar
1006
+ docs: "translate(512 512) scale(1.4) translate(-512 -512)",
1007
+ // text lines
1008
+ vote: "translate(512 512) scale(0.92) translate(-512 -542)",
1009
+ // tall bars, nudged down
1010
+ btc: "translate(512 512) scale(1.25) translate(-512 -512)"
1011
+ // ₿
1012
+ };
1013
+ function normSw(w) {
1014
+ return w < 1.3 ? 1.3 : w > 1.8 ? 1.7 : w;
998
1015
  }
999
- function OcSigil({ glyph, corner = "bottom-left", parallax = true, className }) {
1016
+ function prepare(glyph, markup) {
1017
+ let m = markup.split("__INK__").join("currentColor").split("__BG__").join("none").split("__FG__").join("none");
1018
+ if (TILE.has(glyph)) {
1019
+ m = m.replace(/<rect x="6" y="6" width="12" height="12"[^>]*\/>/, "");
1020
+ }
1021
+ m = m.replace(/stroke-width="([\d.]+)"/g, (_, w) => `stroke-width="${normSw(parseFloat(w))}"`);
1022
+ const focus = FOCUS[glyph];
1023
+ return focus ? `<g transform="${focus}">${m}</g>` : m;
1024
+ }
1025
+ var SEED = {
1026
+ attest: [-7, 2],
1027
+ lock: [-4, -2],
1028
+ vote: [6, 0],
1029
+ stamp: [2, -2],
1030
+ agent: [-2, 3],
1031
+ pledge: [5, 2],
1032
+ chat: [-6, -1],
1033
+ cosign: [1, -3],
1034
+ vault: [4, 1],
1035
+ me: [-3, 2],
1036
+ fleet: [7, -2],
1037
+ docs: [0, 0],
1038
+ analytics: [-5, 1],
1039
+ btc: [4, 3],
1040
+ orangecheck: [0, 0]
1041
+ };
1042
+ function OcSigil({
1043
+ glyph,
1044
+ corner = "bottom-left",
1045
+ parallax = true,
1046
+ band = false,
1047
+ className
1048
+ }) {
1000
1049
  const rawId = useId();
1001
1050
  const id = useMemo(() => `oc-sigil-${rawId.replace(/[^a-zA-Z0-9_-]/g, "")}`, [rawId]);
1002
1051
  const parRef = useRef(null);
1003
- const seed = useMemo(() => {
1004
- let h = 0;
1005
- for (const ch of glyph) h = h * 31 + ch.charCodeAt(0) | 0;
1006
- return (h % 7 - 3) * 1.5;
1007
- }, [glyph]);
1008
- const mark = useMemo(() => sub(OC_GLYPHS[glyph]), [glyph]);
1052
+ const mark = useMemo(() => prepare(glyph, OC_GLYPHS[glyph]), [glyph]);
1053
+ const relief = FILL.has(glyph) ? 30 : 48;
1054
+ const [seedY, seedX] = SEED[glyph];
1009
1055
  useEffect(() => {
1010
1056
  if (!parallax) return;
1011
1057
  const el = parRef.current;
@@ -1020,16 +1066,16 @@ function OcSigil({ glyph, corner = "bottom-left", parallax = true, className })
1020
1066
  const allowed = () => !prm.matches && document.documentElement.getAttribute("data-oc-motion") !== "off";
1021
1067
  const onMove = (e) => {
1022
1068
  if (!allowed()) return;
1023
- tx = (e.clientX / innerWidth - 0.5) * 10;
1024
- ty = (e.clientY / innerHeight - 0.5) * -10;
1069
+ tx = Math.tanh((e.clientX / innerWidth - 0.5) * 2 * 1.2) * 5;
1070
+ ty = Math.tanh((e.clientY / innerHeight - 0.5) * 2 * 1.2) * -5;
1025
1071
  if (!raf) raf = requestAnimationFrame(step);
1026
1072
  };
1027
1073
  const step = () => {
1028
1074
  raf = 0;
1029
- cx += (tx - cx) * 0.06;
1030
- cy += (ty - cy) * 0.06;
1031
- el.style.setProperty("--oc-sigil-ry", `${Math.max(-5, Math.min(5, cx)).toFixed(2)}deg`);
1032
- el.style.setProperty("--oc-sigil-rx", `${Math.max(-5, Math.min(5, cy)).toFixed(2)}deg`);
1075
+ cx += (tx - cx) * 0.045;
1076
+ cy += (ty - cy) * 0.045;
1077
+ el.style.setProperty("--oc-sigil-ry", `${cx.toFixed(2)}deg`);
1078
+ el.style.setProperty("--oc-sigil-rx", `${cy.toFixed(2)}deg`);
1033
1079
  if (Math.abs(tx - cx) + Math.abs(ty - cy) > 0.05) raf = requestAnimationFrame(step);
1034
1080
  };
1035
1081
  const onPrm = () => {
@@ -1050,20 +1096,37 @@ function OcSigil({ glyph, corner = "bottom-left", parallax = true, className })
1050
1096
  "div",
1051
1097
  {
1052
1098
  "aria-hidden": "true",
1053
- className: cn("oc-sigil", `oc-sigil--${corner}`, className),
1054
- style: { "--oc-sigil-seed": `${seed}deg` },
1099
+ className: cn("oc-sigil", `oc-sigil--${corner}`, band && "oc-sigil--band", className),
1100
+ style: {
1101
+ "--oc-sigil-seed": `${seedY}deg`,
1102
+ "--oc-sigil-seed-x": `${seedX}deg`
1103
+ },
1055
1104
  children: [
1056
1105
  /* @__PURE__ */ jsx("svg", { width: "0", height: "0", style: { position: "absolute" }, "aria-hidden": "true", children: /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("g", { id: `${id}-mark`, dangerouslySetInnerHTML: { __html: mark } }) }) }),
1057
- /* @__PURE__ */ jsx("div", { className: "oc-sigil__drift oc-ambient", children: /* @__PURE__ */ jsx("div", { ref: parRef, className: "oc-sigil__par", children: LAYERS.map((n) => /* @__PURE__ */ jsx(
1058
- "svg",
1059
- {
1060
- viewBox: "0 0 1024 1024",
1061
- className: "oc-sigil__layer",
1062
- style: layerStyle(n),
1063
- children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1064
- },
1065
- n
1066
- )) }) })
1106
+ /* @__PURE__ */ jsx("div", { className: "oc-sigil__drift oc-ambient", children: /* @__PURE__ */ jsxs("div", { ref: parRef, className: "oc-sigil__par", children: [
1107
+ LAYERS.map((n) => /* @__PURE__ */ jsx(
1108
+ "svg",
1109
+ {
1110
+ viewBox: "0 0 1024 1024",
1111
+ className: "oc-sigil__layer",
1112
+ style: layerStyle(n, relief),
1113
+ children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1114
+ },
1115
+ n
1116
+ )),
1117
+ /* @__PURE__ */ jsx(
1118
+ "svg",
1119
+ {
1120
+ viewBox: "0 0 1024 1024",
1121
+ className: "oc-sigil__layer oc-sigil__spec",
1122
+ style: {
1123
+ transform: "translateZ(1.5px)",
1124
+ color: `color-mix(in oklab, ${INK}, ${LIFT} 45%)`
1125
+ },
1126
+ children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1127
+ }
1128
+ )
1129
+ ] }) })
1067
1130
  ]
1068
1131
  }
1069
1132
  );
@@ -2653,7 +2716,7 @@ function Sparkline({ data, width = 96, height = 24, area = false, className }) {
2653
2716
  }
2654
2717
  );
2655
2718
  }
2656
- function StatBlock({ label, value, sub: sub2, delta, tone = "default", className }) {
2719
+ function StatBlock({ label, value, sub, delta, tone = "default", className }) {
2657
2720
  const toneClass = tone === "success" ? "text-success" : tone === "warning" ? "text-warning" : tone === "destructive" ? "text-destructive" : "text-foreground";
2658
2721
  return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1", className), children: [
2659
2722
  /* @__PURE__ */ jsx("span", { className: "label-mono text-muted-foreground text-[10px]", children: label }),
@@ -2668,7 +2731,7 @@ function StatBlock({ label, value, sub: sub2, delta, tone = "default", className
2668
2731
  }
2669
2732
  ),
2670
2733
  /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-2", children: [
2671
- sub2 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[11px] tracking-wide lowercase", children: sub2 }),
2734
+ sub && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-mono text-[11px] tracking-wide lowercase", children: sub }),
2672
2735
  delta && /* @__PURE__ */ jsxs(
2673
2736
  "span",
2674
2737
  {