@broberg/bodymap 0.11.0 → 0.12.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
@@ -311,6 +311,12 @@ function webglAvailable() {
311
311
  return false;
312
312
  }
313
313
  }
314
+ var INTENSITY_SIZE = 46;
315
+ function shouldShowHint(opts) {
316
+ if (opts.openRegion) return false;
317
+ if (opts.hint === false) return false;
318
+ return opts.anySelectable || opts.hasExplicitHoverHint;
319
+ }
314
320
  var btn = (c) => ({
315
321
  font: "inherit",
316
322
  cursor: "pointer",
@@ -705,7 +711,12 @@ function BodyMap3D(props) {
705
711
  const region = selected ? REGIONS.find((r) => r.key === selected) : null;
706
712
  const current = selected ? pointOf(selected) : void 0;
707
713
  const anySelectable = REGIONS.some((r) => isSelectable(r.key, config ?? {}));
708
- const showEmptyHint = hint === false ? false : anySelectable || ui?.hoverHint !== void 0;
714
+ const showEmptyHint = shouldShowHint({
715
+ openRegion: selected,
716
+ hint,
717
+ anySelectable,
718
+ hasExplicitHoverHint: ui?.hoverHint !== void 0
719
+ });
709
720
  const hintText = (hint ? hint.text : void 0) ?? UI.hoverHint;
710
721
  const hintAtStage = isFullscreen && !!hint && hint.placement === "stage-bottom";
711
722
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -813,13 +824,23 @@ function BodyMap3D(props) {
813
824
  "data-testid": "bodymap3d-close",
814
825
  "aria-label": L.close,
815
826
  onClick: () => setSelected(null),
816
- style: { ...btn(chrome), width: 32, height: 32, padding: 0, fontSize: 20, lineHeight: 1, color: chrome.mutedText, borderColor: chrome.border, background: chrome.panelBg },
827
+ style: { ...btn(chrome), width: 40, height: 40, minWidth: 40, padding: 0, borderRadius: "50%", fontSize: 20, lineHeight: 1, color: chrome.mutedText, borderColor: chrome.border, background: chrome.panelBg },
817
828
  children: "\xD7"
818
829
  }
819
830
  )
820
831
  ] }),
821
832
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, fontWeight: 700, letterSpacing: ".06em", textTransform: "uppercase", color: chrome.mutedText, marginBottom: 7 }, children: L.intensity }),
822
- /* @__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)) }),
833
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: 4, marginBottom: 12 }, children: Array.from({ length: 11 }, (_, i) => (
834
+ /* F052.34 — CIRCLES, and all eleven the same size.
835
+ Dimensioned by «10», the widest label: sizing by the average
836
+ would make the two-digit one an ellipse among circles, which
837
+ is worse than eleven rounded squares because the odd one out
838
+ becomes a different SHAPE rather than slightly wider.
839
+ 46px is the SIBLING's touch size, not a new number: the 2D
840
+ renderer already used it and this one was on 30px, under the
841
+ >=44px floor F052.8 set. See INTENSITY_SIZE. */
842
+ /* @__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", width: INTENSITY_SIZE, height: INTENSITY_SIZE, minWidth: INTENSITY_SIZE, padding: 0, borderRadius: "50%", background: current?.intensity === i ? chrome.accent : chrome.panelBg, color: current?.intensity === i ? chrome.accentText : chrome.text }, children: i }, i)
843
+ )) }),
823
844
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: 11, fontWeight: 700, letterSpacing: ".06em", textTransform: "uppercase", color: chrome.mutedText, marginBottom: 7 }, children: L.quality }),
824
845
  /* @__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)) }),
825
846
  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 })
@@ -856,11 +877,13 @@ function BodyMap3D(props) {
856
877
  }
857
878
 
858
879
  exports.BodyMap3D = BodyMap3D;
880
+ exports.INTENSITY_SIZE = INTENSITY_SIZE;
859
881
  exports.TAP_MAX_DISTANCE = TAP_MAX_DISTANCE;
860
882
  exports.ensureNormals = ensureNormals;
861
883
  exports.isTap = isTap;
862
884
  exports.seamBlend = seamBlend;
863
885
  exports.seamWeight = seamWeight;
864
886
  exports.serializeReport = serializeReport;
887
+ exports.shouldShowHint = shouldShowHint;
865
888
  //# sourceMappingURL=three.cjs.map
866
889
  //# sourceMappingURL=three.cjs.map