@broberg/bodymap 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/three.cjs CHANGED
@@ -111,7 +111,16 @@ var defaultUi = {
111
111
  stageBg: STAGE_BG,
112
112
  border: "#e2e8f0",
113
113
  badgeBg: "#f1f5f9",
114
- danger: "#dc2626"
114
+ danger: "#dc2626",
115
+ dangerBorder: "#f6c9c9",
116
+ // F052.30 — was #0e8f8a, which measured 3.95:1 against white. AA needs 4.5,
117
+ // and this is the SELECTED intensity button on a surface where AA is a legal
118
+ // duty. It shipped from 0.2.0 and no check could see it: the colour was an
119
+ // inline literal, and the F052.19 contrast sweep only read this object.
120
+ // #0c7d77 is the same teal a shade deeper — 4.98:1, with headroom rather than
121
+ // sitting on the 4.5 boundary where any later tweak reopens it.
122
+ accent: "#0c7d77",
123
+ accentText: "#fff"
115
124
  };
116
125
  function uiColors(palette) {
117
126
  return { ...defaultUi, ...palette?.ui ?? {} };
@@ -298,8 +307,20 @@ function webglAvailable() {
298
307
  return false;
299
308
  }
300
309
  }
301
- var btn = { font: "inherit", cursor: "pointer", borderRadius: 8, border: "1px solid #e2e8f0", background: "#fff", padding: "6px 9px" };
302
- var seg = (on) => ({ ...btn, background: on ? "#0e8f8a" : "#fff", color: on ? "#fff" : "#1e293b", fontWeight: 600 });
310
+ var btn = (c) => ({
311
+ font: "inherit",
312
+ cursor: "pointer",
313
+ borderRadius: 8,
314
+ border: `1px solid ${c.border}`,
315
+ background: c.panelBg,
316
+ padding: "6px 9px"
317
+ });
318
+ var seg = (c, on) => ({
319
+ ...btn(c),
320
+ background: on ? c.accent : c.panelBg,
321
+ color: on ? c.accentText : c.text,
322
+ fontWeight: 600
323
+ });
303
324
  function BodyMap3D(props) {
304
325
  const {
305
326
  models,
@@ -689,7 +710,7 @@ function BodyMap3D(props) {
689
710
  "data-fullscreen": isFullscreen ? "true" : void 0,
690
711
  style: {
691
712
  fontFamily: "system-ui, sans-serif",
692
- color: "#1e293b",
713
+ color: chrome.text,
693
714
  // A viewport fill, not the Fullscreen API — see the `fullscreen` prop.
694
715
  // `fixed`+`inset:0` behaves the same on iOS Safari, where element
695
716
  // fullscreen does not exist at all, as it does everywhere else.
@@ -721,8 +742,8 @@ function BodyMap3D(props) {
721
742
  },
722
743
  children: [
723
744
  showSexToggle && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: 16, flexWrap: "wrap", marginBottom: 12, fontSize: 13 }, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
724
- /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-sex-male", onClick: () => changeSex("male"), style: seg(sex === "male"), children: UI.male }),
725
- /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-sex-female", onClick: () => changeSex("female"), style: seg(sex === "female"), children: UI.female })
745
+ /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-sex-male", onClick: () => changeSex("male"), style: seg(chrome, sex === "male"), children: UI.male }),
746
+ /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-sex-female", onClick: () => changeSex("female"), style: seg(chrome, sex === "female"), children: UI.female })
726
747
  ] }) }),
727
748
  /* @__PURE__ */ jsxRuntime.jsx("span", { ref: loadedRef, "data-testid": "bodymap3d-loaded", style: { display: "none" } }),
728
749
  ready && /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": "bodymap3d-ready", style: { position: "absolute", width: 1, height: 1, opacity: 0, pointerEvents: "none" } }),
@@ -735,7 +756,7 @@ function BodyMap3D(props) {
735
756
  "aria-label": isFullscreen ? UI.collapse ?? "Close" : UI.expand ?? "Expand",
736
757
  onClick: () => setFullscreen(!isFullscreen),
737
758
  style: {
738
- ...btn,
759
+ ...btn(chrome),
739
760
  color: chrome.text,
740
761
  borderColor: chrome.border,
741
762
  background: chrome.panelBg,
@@ -786,16 +807,16 @@ function BodyMap3D(props) {
786
807
  "data-testid": "bodymap3d-close",
787
808
  "aria-label": L.close,
788
809
  onClick: () => setSelected(null),
789
- style: { ...btn, width: 32, height: 32, padding: 0, fontSize: 20, lineHeight: 1, color: chrome.mutedText, borderColor: chrome.border, background: chrome.panelBg },
810
+ style: { ...btn(chrome), width: 32, height: 32, padding: 0, fontSize: 20, lineHeight: 1, color: chrome.mutedText, borderColor: chrome.border, background: chrome.panelBg },
790
811
  children: "\xD7"
791
812
  }
792
813
  )
793
814
  ] }),
794
815
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, fontWeight: 700, letterSpacing: ".06em", textTransform: "uppercase", color: chrome.mutedText, marginBottom: 7 }, children: L.intensity }),
795
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginBottom: 12 }, children: Array.from({ length: 11 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": `bodymap3d-intensity-${i}`, onClick: () => setPain(region.key, i, current?.type), style: { ...btn, display: "inline-flex", alignItems: "center", justifyContent: "center", minWidth: 30, height: 30, padding: 0, background: current?.intensity === i ? "#0e8f8a" : "#fff", color: current?.intensity === i ? "#fff" : "#1e293b" }, children: i }, i)) }),
816
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginBottom: 12 }, children: Array.from({ length: 11 }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": `bodymap3d-intensity-${i}`, onClick: () => setPain(region.key, i, current?.type), style: { ...btn(chrome), display: "inline-flex", alignItems: "center", justifyContent: "center", minWidth: 30, height: 30, padding: 0, background: current?.intensity === i ? chrome.accent : chrome.panelBg, color: current?.intensity === i ? chrome.accentText : chrome.text }, children: i }, i)) }),
796
817
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, fontWeight: 700, letterSpacing: ".06em", textTransform: "uppercase", color: chrome.mutedText, marginBottom: 7 }, children: L.quality }),
797
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 14 }, children: PAIN_TYPES.map((t) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": `bodymap3d-type-${t}`, onClick: () => setPain(region.key, current?.intensity ?? 5, t), style: { ...btn, borderRadius: 999, padding: "6px 12px", background: current?.type === t ? "#1e293b" : "#fff", color: current?.type === t ? "#fff" : "#64748b" }, children: L.qualities[t] ?? t }, t)) }),
798
- current && /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-remove", onClick: () => removePain(region.key), style: { ...btn, color: chrome.danger, borderColor: "#f6c9c9" }, children: L.remove })
818
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, marginBottom: 14 }, children: PAIN_TYPES.map((t) => /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": `bodymap3d-type-${t}`, onClick: () => setPain(region.key, current?.intensity ?? 5, t), style: { ...btn(chrome), borderRadius: 999, padding: "6px 12px", background: current?.type === t ? chrome.text : chrome.panelBg, color: current?.type === t ? chrome.panelBg : chrome.mutedText }, children: L.qualities[t] ?? t }, t)) }),
819
+ current && /* @__PURE__ */ jsxRuntime.jsx("button", { "data-testid": "bodymap3d-remove", onClick: () => removePain(region.key), style: { ...btn(chrome), color: chrome.danger, borderColor: chrome.dangerBorder }, children: L.remove })
799
820
  ] }) : showEmptyHint ? /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "bodymap3d-empty", style: { border: `1px solid ${chrome.border}`, borderRadius: 14, padding: 16, background: chrome.panelBg, color: chrome.mutedText, fontSize: 13.5 }, children: UI.hoverHint }) : null })
800
821
  ] })
801
822
  ]