@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/tokens.mjs CHANGED
@@ -954,40 +954,86 @@ var OC_GLYPHS = {
954
954
  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)"/>`
955
955
  };
956
956
  var DEPTH = 22;
957
- var Z_STEP = 3;
958
957
  var LAYERS = Array.from({ length: DEPTH }, (_, i) => i);
959
- function layerStyle(i) {
958
+ var FILL = /* @__PURE__ */ new Set(["orangecheck", "btc", "vote"]);
959
+ var INK = "var(--oc-sigil-ink, var(--oc-sigil-ink-base, var(--primary)))";
960
+ var LIFT = "var(--oc-sigil-lift, white)";
961
+ var SHADE = `var(--oc-sigil-shade, color-mix(in oklab, black, ${INK} 30%))`;
962
+ function layerStyle(i, relief) {
960
963
  const t = i / (DEPTH - 1);
961
- const ink = "var(--oc-sigil-ink, var(--primary))";
962
- const bg = "var(--oc-sigil-bg, var(--background))";
963
964
  let color;
964
965
  if (t < 0.14) {
965
- color = `color-mix(in oklab, ${ink}, white ${Math.round((0.14 - t) * 26)}%)`;
966
- } else if (t < 0.6) {
967
- const k = (t - 0.14) / 0.46;
968
- color = `color-mix(in oklab, ${ink}, black ${Math.round(k * 34)}%)`;
966
+ color = `color-mix(in oklab, ${INK}, ${LIFT} ${Math.round((0.14 - t) / 0.14 * 18)}%)`;
967
+ } else if (t < 0.55) {
968
+ const k = (t - 0.14) / 0.41;
969
+ color = `color-mix(in oklab, ${INK}, ${SHADE} ${Math.round(k * 45)}%)`;
969
970
  } else {
970
- const k = (t - 0.6) / 0.4;
971
- color = `color-mix(in oklab, color-mix(in oklab, ${ink}, black 34%), ${bg} ${Math.round(k * 100)}%)`;
971
+ const k = (t - 0.55) / 0.45;
972
+ color = `color-mix(in oklab, color-mix(in oklab, ${INK}, ${SHADE} 45%), transparent ${Math.round(Math.pow(k, 1.3) * 100)}%)`;
972
973
  }
973
- return {
974
- transform: `translateZ(${-i * Z_STEP}px)`,
975
- color
976
- };
974
+ return { transform: `translateZ(${(-Math.pow(t, 1.4) * relief).toFixed(1)}px)`, color };
977
975
  }
978
- function sub(markup) {
979
- return markup.split("__INK__").join("currentColor").split("__BG__").join("none").split("__FG__").join("none");
976
+ var TILE = /* @__PURE__ */ new Set(["stamp", "pledge", "cosign", "me", "fleet", "docs"]);
977
+ var FOCUS = {
978
+ stamp: "translate(512 512) scale(1.5) translate(-512 -512)",
979
+ // anchor-cross
980
+ pledge: "translate(512 512) scale(1.7) translate(-491 -512)",
981
+ // ₱ mark, recentered
982
+ cosign: "translate(512 512) scale(1.35) translate(-512 -512)",
983
+ // two figures
984
+ me: "translate(512 512) scale(1.45) translate(-512 -544)",
985
+ // bust, recentered down
986
+ fleet: "translate(512 512) scale(1.5) translate(-512 -512)",
987
+ // play + bar
988
+ docs: "translate(512 512) scale(1.4) translate(-512 -512)",
989
+ // text lines
990
+ vote: "translate(512 512) scale(0.92) translate(-512 -542)",
991
+ // tall bars, nudged down
992
+ btc: "translate(512 512) scale(1.25) translate(-512 -512)"
993
+ // ₿
994
+ };
995
+ function normSw(w) {
996
+ return w < 1.3 ? 1.3 : w > 1.8 ? 1.7 : w;
980
997
  }
981
- function OcSigil({ glyph, corner = "bottom-left", parallax = true, className }) {
998
+ function prepare(glyph, markup) {
999
+ let m = markup.split("__INK__").join("currentColor").split("__BG__").join("none").split("__FG__").join("none");
1000
+ if (TILE.has(glyph)) {
1001
+ m = m.replace(/<rect x="6" y="6" width="12" height="12"[^>]*\/>/, "");
1002
+ }
1003
+ m = m.replace(/stroke-width="([\d.]+)"/g, (_, w) => `stroke-width="${normSw(parseFloat(w))}"`);
1004
+ const focus = FOCUS[glyph];
1005
+ return focus ? `<g transform="${focus}">${m}</g>` : m;
1006
+ }
1007
+ var SEED = {
1008
+ attest: [-7, 2],
1009
+ lock: [-4, -2],
1010
+ vote: [6, 0],
1011
+ stamp: [2, -2],
1012
+ agent: [-2, 3],
1013
+ pledge: [5, 2],
1014
+ chat: [-6, -1],
1015
+ cosign: [1, -3],
1016
+ vault: [4, 1],
1017
+ me: [-3, 2],
1018
+ fleet: [7, -2],
1019
+ docs: [0, 0],
1020
+ analytics: [-5, 1],
1021
+ btc: [4, 3],
1022
+ orangecheck: [0, 0]
1023
+ };
1024
+ function OcSigil({
1025
+ glyph,
1026
+ corner = "bottom-left",
1027
+ parallax = true,
1028
+ band = false,
1029
+ className
1030
+ }) {
982
1031
  const rawId = useId();
983
1032
  const id = useMemo(() => `oc-sigil-${rawId.replace(/[^a-zA-Z0-9_-]/g, "")}`, [rawId]);
984
1033
  const parRef = useRef(null);
985
- const seed = useMemo(() => {
986
- let h = 0;
987
- for (const ch of glyph) h = h * 31 + ch.charCodeAt(0) | 0;
988
- return (h % 7 - 3) * 1.5;
989
- }, [glyph]);
990
- const mark = useMemo(() => sub(OC_GLYPHS[glyph]), [glyph]);
1034
+ const mark = useMemo(() => prepare(glyph, OC_GLYPHS[glyph]), [glyph]);
1035
+ const relief = FILL.has(glyph) ? 30 : 48;
1036
+ const [seedY, seedX] = SEED[glyph];
991
1037
  useEffect(() => {
992
1038
  if (!parallax) return;
993
1039
  const el = parRef.current;
@@ -1002,16 +1048,16 @@ function OcSigil({ glyph, corner = "bottom-left", parallax = true, className })
1002
1048
  const allowed = () => !prm.matches && document.documentElement.getAttribute("data-oc-motion") !== "off";
1003
1049
  const onMove = (e) => {
1004
1050
  if (!allowed()) return;
1005
- tx = (e.clientX / innerWidth - 0.5) * 10;
1006
- ty = (e.clientY / innerHeight - 0.5) * -10;
1051
+ tx = Math.tanh((e.clientX / innerWidth - 0.5) * 2 * 1.2) * 5;
1052
+ ty = Math.tanh((e.clientY / innerHeight - 0.5) * 2 * 1.2) * -5;
1007
1053
  if (!raf) raf = requestAnimationFrame(step);
1008
1054
  };
1009
1055
  const step = () => {
1010
1056
  raf = 0;
1011
- cx += (tx - cx) * 0.06;
1012
- cy += (ty - cy) * 0.06;
1013
- el.style.setProperty("--oc-sigil-ry", `${Math.max(-5, Math.min(5, cx)).toFixed(2)}deg`);
1014
- el.style.setProperty("--oc-sigil-rx", `${Math.max(-5, Math.min(5, cy)).toFixed(2)}deg`);
1057
+ cx += (tx - cx) * 0.045;
1058
+ cy += (ty - cy) * 0.045;
1059
+ el.style.setProperty("--oc-sigil-ry", `${cx.toFixed(2)}deg`);
1060
+ el.style.setProperty("--oc-sigil-rx", `${cy.toFixed(2)}deg`);
1015
1061
  if (Math.abs(tx - cx) + Math.abs(ty - cy) > 0.05) raf = requestAnimationFrame(step);
1016
1062
  };
1017
1063
  const onPrm = () => {
@@ -1032,20 +1078,37 @@ function OcSigil({ glyph, corner = "bottom-left", parallax = true, className })
1032
1078
  "div",
1033
1079
  {
1034
1080
  "aria-hidden": "true",
1035
- className: cn("oc-sigil", `oc-sigil--${corner}`, className),
1036
- style: { "--oc-sigil-seed": `${seed}deg` },
1081
+ className: cn("oc-sigil", `oc-sigil--${corner}`, band && "oc-sigil--band", className),
1082
+ style: {
1083
+ "--oc-sigil-seed": `${seedY}deg`,
1084
+ "--oc-sigil-seed-x": `${seedX}deg`
1085
+ },
1037
1086
  children: [
1038
1087
  /* @__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 } }) }) }),
1039
- /* @__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(
1040
- "svg",
1041
- {
1042
- viewBox: "0 0 1024 1024",
1043
- className: "oc-sigil__layer",
1044
- style: layerStyle(n),
1045
- children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1046
- },
1047
- n
1048
- )) }) })
1088
+ /* @__PURE__ */ jsx("div", { className: "oc-sigil__drift oc-ambient", children: /* @__PURE__ */ jsxs("div", { ref: parRef, className: "oc-sigil__par", children: [
1089
+ LAYERS.map((n) => /* @__PURE__ */ jsx(
1090
+ "svg",
1091
+ {
1092
+ viewBox: "0 0 1024 1024",
1093
+ className: "oc-sigil__layer",
1094
+ style: layerStyle(n, relief),
1095
+ children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1096
+ },
1097
+ n
1098
+ )),
1099
+ /* @__PURE__ */ jsx(
1100
+ "svg",
1101
+ {
1102
+ viewBox: "0 0 1024 1024",
1103
+ className: "oc-sigil__layer oc-sigil__spec",
1104
+ style: {
1105
+ transform: "translateZ(1.5px)",
1106
+ color: `color-mix(in oklab, ${INK}, ${LIFT} 45%)`
1107
+ },
1108
+ children: /* @__PURE__ */ jsx("use", { href: `#${id}-mark` })
1109
+ }
1110
+ )
1111
+ ] }) })
1049
1112
  ]
1050
1113
  }
1051
1114
  );